The Handler is the component that deals with received requests. The core API of a handler is the handle method:
public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException;
An implementation of this method may handle the request, pass the request onto another handler (or servlet) or may modify and/or wrap the request and then pass it on. This gives three styles of Handler:
- Coordinating Handlers - Handlers that route requests to other handlers (eg HandlerCollection, ContextHandlerCollection)
- Filtering Handlers - Handlers that augment a request and pass it on to other handlers (eg. HandlerWrapper, ContextHandler, SessionHandler)
- Generating Handlers - Handlers that produce content (eg ResourceHandler and ServletHandler)
Essentially the WebAppContext is a conveniance convenience class to assist the construction and configuration of other handlers to achieve a standard web application configuration.