/* Handle a request from a connection. * Called to handle a request on the connection when either the header has been received, * or after the entire request has been received (for short requests of known length), or * on the dispatch of an async request. */ public void handleAsync(AbstractHttpConnection connection) throws IOException, ServletException { final AsyncContinuation async = connection.getRequest().getAsyncContinuation(); final AsyncContinuation.AsyncEventState state = async.getAsyncEventState(); final Request baseRequest = connection.getRequest(); final String path = state.getPath(); if (path != null) { // this is a dispatch with a path final String contextPath = state.getServletContext().getContextPath(); HttpURI uri = new HttpURI(URIUtil.addPaths(contextPath, path)); baseRequest.setUri(uri); baseRequest.setRequestURI(null); baseRequest.setPathInfo(baseRequest.getRequestURI()); if (uri.getQuery() != null) baseRequest.mergeQueryString(uri.getQuery()); } final String target = baseRequest.getPathInfo(); final HttpServletRequest request = (HttpServletRequest) async.getRequest(); final HttpServletResponse response = (HttpServletResponse) async.getResponse(); if (LOG.isDebugEnabled()) { LOG.debug("REQUEST " + target + " on " + connection); handle(target, baseRequest, request, response); LOG.debug("RESPONSE " + target + " " + connection.getResponse().getStatus()); } else handle(target, baseRequest, request, response); }
/* Handle a request from a connection. * Called to handle a request on the connection when either the header has been received, * or after the entire request has been received (for short requests of known length), or * on the dispatch of an async request. */ public void handle(AbstractHttpConnection connection) throws IOException, ServletException { final String target = connection.getRequest().getPathInfo(); final Request request = connection.getRequest(); final Response response = connection.getResponse(); if (LOG.isDebugEnabled()) { LOG.debug("REQUEST " + target + " on " + connection); handle(target, request, request, response); LOG.debug("RESPONSE " + target + " " + connection.getResponse().getStatus()); } else handle(target, request, request, response); }