java.lang.Object
raining.core.NioSocket
raining.server.AdvServer
- public class AdvServer
- extends raining.core.NioSocket
A more functional server that permits handlers and protocols to be
defined and passed in.
TODO: refactor the http processing out of here, so it can be reused.
TODO: read from priority file
TODO: handle different mime-types. ??
TODO: handle errors 400: if request not a GET
TODO: 304 if not modified since
TODO: send last-modified
TODO: try later, and close if beyond a limit
TODO: flow control, if beyond a limit, rather than just close conn
TODO: take care of absolute URL
| Fields inherited from class raining.core.NioSocket |
acceptcount, acceptctr, activeSocketCount, ADD_EVENT, conncount, connctr, crcount, ctcount, debug, DEL_EVENT, id, READ_BUFFER_SIZE, readcount, REPORT_AFTER, rsb, selector, stopWhenIdle, totalBytesRead, WRITE_BUFFER_SIZE, writecount |
| Methods inherited from class raining.core.NioSocket |
accept_accounting, accept, add_to_map, channel, clear_read_buffer, conn_reset_handler, conn_time_out_handler, connect_accounting, create_client_socket, create_client_socket, create_server_socket, del_from_map, getReadData, getReadDataAsBuffer, getReadDataAsString, handle_close, handle_connect, handle_read_complete, handle_read_complete, handle_read_event, handle_read, handle_terminator, handle_write_complete, handle_write_event, handle_write, is_read_complete, nio_close, on_exit_handler, readable, recv, resetSocketCounter, send, serverflag, setDebug, setReadBufferSize, setSendData, setSendData, setSendData, setWriteBufferSize, socketCount, socketCountChangeEvent, start, start, stop_now, stopWhenIdle, stopWhenIdle, writeable |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
http503response
public static final byte[] http503response
P
private static final java.lang.String P
- See Also:
- Constant Field Values
handle_priority_on_accept
public boolean handle_priority_on_accept
- flag to denote whether priority handling is to be done.
priorityHandler
public PriorityHandler priorityHandler
precalcheaders
public static final boolean precalcheaders
- are we precalculating headers, are we using "stale" headers.
this should be from a props file.
- See Also:
- Constant Field Values
defaultfile
public static final java.lang.String defaultfile
- the name of the default file to be served in / given in http
request.
TODO this is to be picked from server.properties.
- See Also:
- Constant Field Values
serverProps
public static java.util.Properties serverProps
rejectcount
protected int rejectcount
conf_try_later
protected int conf_try_later
conf_max_connections
protected int conf_max_connections
AdvServer
public AdvServer(java.lang.String host,
int port)
throws java.lang.Exception
- Constructor taking port and host of server to connect to.
It will listen on port on localhost.
main
public static void main(java.lang.String[] args)
setServerProperties
public void setServerProperties(java.util.Properties props)
- Set the properties file to be used by the server.
handle_accept
public void handle_accept()
- when a connection is accepted, create a new NIO object for the
incoming socket.
setPriorityHandler
public void setPriorityHandler(PriorityHandler ph)
- set the given handler as a priorityHandler.