Section 5.1.2 Request and Response
The request and response objects used in the signature of the handle method are HttpServletRequest and HttpServletResponse. These are the standard APIs and moderately restricted in what can be done to the request and response. More often than not, access to the Jetty implementations of these classes is required: Request and Response. As the request and response may be wrapped by handlers, filters, and servlets, however, it is not possible to pass the implementation directly. The following mantra retrieves the core implementation objects from under any wrappers:
Request base_request = request instanceof Request?(Request)request:HttpConnection.
getCurrentConnection().getRequest();
Request base_request = response instanceof Response?(Response)request:HttpConnection.
getCurrentConnection().getResponse();
If the handler passes the request on to another handler, it should use the request/response objects passed in and not the base objects. This is to preserve any wrapping done by up stream handlers.


