1 The requestHandlerService

The requestHandlerservice is used as the basis of all of the network request based services (directly, or indirectly) and handles the communication to the client (in whatever form that may take).

PreemptiveResponse (responseData) - respdata will be sent via protocol.marshalResponse

from requestHandler/requestHandler.py Hook sequences

BeginSession Just after connection is gotten, scoped for IP,PORT or UNIXPATH (job, sock, sessionDict)

while 1: InitRequest after the request data has been received (job, reqdata, sessiondict) HandleRequest called to actually handle the request (job, reqdata, sessiondict) PostRequest called after response sent (job, reqdata, sessionDict) CleanupRequest right after PostRequest (job, reqdata, sessionDict)

EndSession called when session ends.

has DocumentTimeout stuff

requestHandler.requestHandler.addRequestHandler(handler - should be subclass (or provide the same interface as) requestHandler.protocol.Protocol, ports)

requestHandler.protocol.Protocol

class Protocol:
    """
    abstract class for protocols used in handling request and response
    """

    def marshalRequest(self, socket, sessionDict):
        '''
        should return the marshalled request data
        '''
        raise NotImplementedError

    def marshalResponse(self, response, sessionDict):
        '''
        should return response data
        '''
        raise NotImplementedError

    def marshalException(self, exc_text, sessionDict):
        '''
        should return response data appropriate for the current exception.
        '''
        raise NotImplementedError

    def keepAliveTimeout(self, sessionDict):
        '''
        how long to keep alive a session.  A negative number will terminate the
        session.
        '''
        return -1