Interface ResponseHandler

All Known Implementing Classes:
CallableRequestDispatch, FutureResponse, NonWorkingResponseHandler, RequestDispatch

public interface ResponseHandler

This interface defines a component that is capable of acting as a handler for a Response. An implementation of this interface is required to be passed alongside every Request as part of the API (see RequestHandler.handleRequest(Request, ResponseHandler) and RequestHandler.handleRequest(Request, ResponseHandler)).

The jDISC API is designed to not provide an implicit reference from Response to corresponding Request, but rather leave that to the implementation of context-aware ResponseHandlers. By creating light-weight ResponseHandlers on a per-Request basis, any necessary reference can be embedded within.

Author:
Simon Thoresen Hult
  • Method Details

    • handleResponse

      ContentChannel handleResponse(Response response)
      This method will process the given Response and return a ContentChannel into which the caller can write the Response's content.
      Parameters:
      response - the Response to handle
      Returns:
      the ContentChannel to write the Response content to. Notice that the ContentChannel holds a Container reference, so failure to close this will prevent the Container from ever shutting down.