| java.lang.Object winstone.HttpListener
All known Subclasses: winstone.ssl.HttpsListener,
HttpListener | public class HttpListener implements Listener,Runnable(Code) | | Implements the main listener daemon thread. This is the class that gets
launched by the command line, and owns the server socket, etc. Note that this
class is also used as the base class for the HTTPS listener.
author: Rick Knowles version: $Id: HttpListener.java,v 1.15 2007/05/01 04:39:49 rickknowles Exp $ |
Method Summary | |
public void | allocateRequestResponse(Socket socket, InputStream inSocket, OutputStream outSocket, RequestHandlerThread handler, boolean iAmFirst) Called by the request handler thread, because it needs specific setup
code for this connection's protocol (ie construction of request/response
objects, in/out streams, etc). | public void | deallocateRequestResponse(RequestHandlerThread handler, WinstoneRequest req, WinstoneResponse rsp, WinstoneInputStream inData, WinstoneOutputStream outData) Called by the request handler thread, because it needs specific shutdown
code for this connection's protocol (ie releasing input/output streams,
etc). | public void | destroy() Interrupts the listener thread. | protected String | getConnectorName() The name to use when getting properties - this is just so that we can
override for the SSL connector. | protected String | getConnectorScheme() | protected int | getDefaultPort() The default port to use - this is just so that we can override for the
SSL connector. | protected ServerSocket | getServerSocket() Gets a server socket - this is mostly for the purpose of allowing an
override in the SSL connector. | public void | parseHeaders(WinstoneRequest req, WinstoneInputStream inData) Parse the incoming stream into a list of headers (stopping at the first
blank line), then call the parseHeaders(req, list) method on that list. | protected void | parseSocketInfo(Socket socket, WinstoneRequest req) | public String | parseURI(RequestHandlerThread handler, WinstoneRequest req, WinstoneResponse rsp, WinstoneInputStream inData, Socket socket, boolean iAmFirst) | public boolean | processKeepAlive(WinstoneRequest request, WinstoneResponse response, InputStream inSocket) Tries to wait for extra requests on the same socket. | public void | releaseSocket(Socket socket, InputStream inSocket, OutputStream outSocket) Called by the request handler thread, because it needs specific shutdown
code for this connection's protocol if the keep-alive period expires (ie
closing sockets, etc). | public void | run() The main run method. | public boolean | start() |
BACKLOG_COUNT | protected static int BACKLOG_COUNT(Code) | | |
CONNECTION_TIMEOUT | protected static int CONNECTION_TIMEOUT(Code) | | |
DEFAULT_HNL | protected static boolean DEFAULT_HNL(Code) | | |
KEEP_ALIVE_SLEEP | protected static int KEEP_ALIVE_SLEEP(Code) | | |
KEEP_ALIVE_SLEEP_MAX | protected static int KEEP_ALIVE_SLEEP_MAX(Code) | | |
KEEP_ALIVE_TIMEOUT | protected static int KEEP_ALIVE_TIMEOUT(Code) | | |
LISTENER_TIMEOUT | protected static int LISTENER_TIMEOUT(Code) | | |
doHostnameLookups | protected boolean doHostnameLookups(Code) | | |
interrupted | protected boolean interrupted(Code) | | |
listenPort | protected int listenPort(Code) | | |
HttpListener | protected HttpListener()(Code) | | |
allocateRequestResponse | public void allocateRequestResponse(Socket socket, InputStream inSocket, OutputStream outSocket, RequestHandlerThread handler, boolean iAmFirst) throws SocketException, IOException(Code) | | Called by the request handler thread, because it needs specific setup
code for this connection's protocol (ie construction of request/response
objects, in/out streams, etc).
This implementation parses incoming AJP13 packets, and builds an
outputstream that is capable of writing back the response in AJP13
packets.
|
destroy | public void destroy()(Code) | | Interrupts the listener thread. This will trigger a listener shutdown
once the so timeout has passed.
|
getConnectorName | protected String getConnectorName()(Code) | | The name to use when getting properties - this is just so that we can
override for the SSL connector.
|
getConnectorScheme | protected String getConnectorScheme()(Code) | | |
getDefaultPort | protected int getDefaultPort()(Code) | | The default port to use - this is just so that we can override for the
SSL connector.
|
getServerSocket | protected ServerSocket getServerSocket() throws IOException(Code) | | Gets a server socket - this is mostly for the purpose of allowing an
override in the SSL connector.
|
processKeepAlive | public boolean processKeepAlive(WinstoneRequest request, WinstoneResponse response, InputStream inSocket) throws IOException, InterruptedException(Code) | | Tries to wait for extra requests on the same socket. If any are found
before the timeout expires, it exits with a true, indicating a new
request is waiting. If the protocol does not support keep-alives, or the
request instructed us to close the connection, or the timeout expires,
return a false, instructing the handler thread to begin shutting down the
socket and relase itself.
|
releaseSocket | public void releaseSocket(Socket socket, InputStream inSocket, OutputStream outSocket) throws IOException(Code) | | Called by the request handler thread, because it needs specific shutdown
code for this connection's protocol if the keep-alive period expires (ie
closing sockets, etc).
This implementation simply shuts down the socket and streams.
|
run | public void run()(Code) | | The main run method. This continually listens for incoming connections,
and allocates any that it finds to a request handler thread, before going
back to listen again.
|
start | public boolean start()(Code) | | |
|
|