Interface RequestHandler

    • Method Detail

      • handleRequest

        ContentChannel handleRequest​(Request request,
                                     ResponseHandler handler)

        This method will process the given Request and return a ContentChannel into which the caller can write the Request's content. For every call to this method, the implementation must call the provided ResponseHandler exactly once.

        Notice that unless this method throws an Exception, a reference to the currently active Container instance is kept internally until ResponseHandler.handleResponse(Response) has been called. This ensures that the configured environment of the Request is stable throughout its lifetime. Failure to call back with a Response will prevent the release of that reference, and therefore prevent the corresponding Container from ever shutting down. The requirement to call ResponseHandler.handleResponse(Response) is regardless of any subsequent errors that may occur while working with the returned ContentChannel.

        Parameters:
        request - The Request to handle.
        handler - The handler to pass the corresponding Response to.
        Returns:
        The ContentChannel to write the Request content to. Notice that the ContentChannel itself also holds a Container reference, so failure to close this will prevent the Container from ever shutting down.