public void handleAsync(HttpChannel<?> connection) throws IOException, ServletException { final HttpChannelState async = connection.getRequest().getHttpChannelState(); final HttpChannelState.AsyncEventState state = async.getAsyncEventState(); final Request baseRequest=connection.getRequest(); final String path=state.getPath(); if (path!=null) { // this is a dispatch with a path ServletContext context=state.getServletContext(); HttpURI uri = new HttpURI(context==null?path:URIUtil.addPaths(context.getContextPath(),path)); baseRequest.setUri(uri); baseRequest.setRequestURI(null); baseRequest.setPathInfo(baseRequest.getRequestURI()); if (uri.getQuery()!=null) baseRequest.mergeQueryString(uri.getQuery()); //we have to assume dispatch path and query are UTF8 } 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); }
public void handleAsync(HttpChannel<?> connection) throws IOException, ServletException { final HttpChannelState async = connection.getRequest().getHttpChannelState(); final HttpChannelState.AsyncEventState state = async.getAsyncEventState(); final Request baseRequest=connection.getRequest(); final String path=state.getPath(); if (path!=null) { // this is a dispatch with a path ServletContext context=state.getServletContext(); HttpURI uri = new HttpURI(context==null?path:URIUtil.addPaths(context.getContextPath(),path)); baseRequest.setUri(uri); baseRequest.setRequestURI(null); baseRequest.setPathInfo(baseRequest.getRequestURI()); if (uri.getQuery()!=null) baseRequest.mergeQueryString(uri.getQuery()); //we have to assume dispatch path and query are UTF8 } 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); }
public ContextHandler getContextHandler() { final AsyncEventState event=_event; if (event!=null) return ((Context)event.getServletContext()).getContextHandler(); return null; }
public ContextHandler getContextHandler() { final AsyncEventState event=_event; if (event!=null) return ((Context)event.getServletContext()).getContextHandler(); return null; }
@Override public void run() { ((Context)event.getServletContext()).getContextHandler().handle(run); } });
@Override public void run() { ((Context)event.getServletContext()).getContextHandler().handle(run); } });