winstone
Interface Listener

All Known Implementing Classes:
Ajp13Listener, HttpListener, HttpsListener

public interface Listener

Interface that defines the necessary methods for being a connection listener within winstone.

Author:
Rick Knowles

Method Summary
 void allocateRequestResponse(java.net.Socket socket, java.io.InputStream inSocket, java.io.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).
 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).
 void destroy()
          Interrupts the listener thread.
 java.lang.String parseURI(RequestHandlerThread handler, WinstoneRequest req, WinstoneResponse rsp, WinstoneInputStream inData, java.net.Socket socket, boolean iAmFirst)
          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).The iAmFirst variable identifies whether or not this is the initial request on on this socket (ie a keep alive or a first-time accept)
 boolean processKeepAlive(WinstoneRequest request, WinstoneResponse response, java.io.InputStream inSocket)
          Tries to wait for extra requests on the same socket.
 void releaseSocket(java.net.Socket socket, java.io.InputStream inSocket, java.io.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).
 boolean start()
          After the listener is loaded and initialized, this starts the thread
 

Method Detail

destroy

void destroy()
Interrupts the listener thread. This will trigger a listener shutdown once the so timeout has passed.


start

boolean start()
              throws java.io.IOException
After the listener is loaded and initialized, this starts the thread

Throws:
java.io.IOException

allocateRequestResponse

void allocateRequestResponse(java.net.Socket socket,
                             java.io.InputStream inSocket,
                             java.io.OutputStream outSocket,
                             RequestHandlerThread handler,
                             boolean iAmFirst)
                             throws java.io.IOException
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). The iAmFirst variable identifies whether or not this is the initial request on on this socket (ie a keep alive or a first-time accept)

Throws:
java.io.IOException

deallocateRequestResponse

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).


parseURI

java.lang.String parseURI(RequestHandlerThread handler,
                          WinstoneRequest req,
                          WinstoneResponse rsp,
                          WinstoneInputStream inData,
                          java.net.Socket socket,
                          boolean iAmFirst)
                          throws java.io.IOException
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).The iAmFirst variable identifies whether or not this is the initial request on on this socket (ie a keep alive or a first-time accept)

Throws:
java.io.IOException

releaseSocket

void releaseSocket(java.net.Socket socket,
                   java.io.InputStream inSocket,
                   java.io.OutputStream outSocket)
                   throws java.io.IOException
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).

Throws:
java.io.IOException

processKeepAlive

boolean processKeepAlive(WinstoneRequest request,
                         WinstoneResponse response,
                         java.io.InputStream inSocket)
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 timeout expires, return a false, instructing the handler thread to begin shutting down the socket and relase itself.



Copyright © 2013. All Rights Reserved.