@Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { super.handle(target, baseRequest, request, response); if (isStarted() && url.equals(target)) { Handler nested = getHandler(); if (nested instanceof ContextHandler){ target = ((ContextHandler) nested).getContextPath() + url; baseRequest.setRequestURI(target); baseRequest.setPathInfo(target); } } } }
@Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String[] welcomeFiles = _context.getWelcomeFiles(); if (welcomeFiles != null && target.endsWith("/")) { for (String welcomeFile : welcomeFiles) { String path = target; path += welcomeFile; Context context = _context.getServletContext(); URL resource = context.getResource(path); if (resource != null) { target = path; baseRequest.setPathInfo(target); _context.handle(target, baseRequest, request, response); return; } } } } }
@Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String[] welcomeFiles = _context.getWelcomeFiles(); if (welcomeFiles != null && target.endsWith("/")) { for (String welcomeFile : welcomeFiles) { String path = target; path += welcomeFile; Context context = _context.getServletContext(); URL resource = context.getResource(path); if (resource != null) { target = path; baseRequest.setPathInfo(target); _context.handle(target, baseRequest, request, response); return; } } } } }
String uri=outerRequest.getQueryString()==null?outerRequest.getRequestURI():(outerRequest.getRequestURI()+"?"+outerRequest.getQueryString()); _request.setUri(new HttpURI(uri)); _request.setPathInfo(outerRequest.getRequestURI()); _request.setQueryString(outerRequest.getQueryString()); _request.setProtocol(outerRequest.getProtocol());
_request.setRequestURI(""); _request.setPathInfo(info); _version = version == null ? HttpVersion.HTTP_0_9 : version; _request.setHttpVersion(_version);
_request.setRequestURI(""); _request.setPathInfo(info); _version = version == null ? HttpVersion.HTTP_0_9 : version; _request.setHttpVersion(_version);
setPathInfo(encoded==null?"":encoded); throw new BadMessageException(400,"Bad URI"); setPathInfo(path);
@Override public void doHandle(final String target, final Request baseRequest, final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException { final String newTarget = redirectContext + target; RequestUpdateHandler.ForwardedRequest newRequest = new RequestUpdateHandler.ForwardedRequest( request, redirectContext, newTarget); // if the request already has the /{gatewaypath}/{topology} part then skip if (!StringUtils.startsWithIgnoreCase(target, redirectContext)) { baseRequest.setPathInfo(redirectContext + baseRequest.getPathInfo()); baseRequest.setURIPathQuery(redirectContext + baseRequest.getRequestURI()); LOG.topologyPortMappingUpdateRequest(target, newTarget); nextHandle(newTarget, baseRequest, newRequest, response); } else { nextHandle(target, baseRequest, newRequest, response); } }
@Override public void doHandle(final String target, final Request baseRequest, final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException { final String newTarget = redirectContext + target; RequestUpdateHandler.ForwardedRequest newRequest = new RequestUpdateHandler.ForwardedRequest( request, redirectContext, newTarget); // if the request already has the /{gatewaypath}/{topology} part then skip if (!StringUtils.startsWithIgnoreCase(target, redirectContext)) { baseRequest.setPathInfo(redirectContext + baseRequest.getPathInfo()); baseRequest.setURIPathQuery(redirectContext + baseRequest.getRequestURI()); LOG.topologyPortMappingUpdateRequest(target, newTarget); nextHandle(newTarget, baseRequest, newRequest, response); } else { nextHandle(target, baseRequest, newRequest, response); } }
((Request)request).setPathInfo(applied);
public void handleAsync(HttpChannel channel) throws IOException, ServletException { final HttpChannelState state = channel.getRequest().getHttpChannelState(); final AsyncContextEvent event = state.getAsyncContextEvent(); final Request baseRequest=channel.getRequest(); final String path=event.getPath(); if (path!=null) { // this is a dispatch with a path ServletContext context=event.getServletContext(); String query=baseRequest.getQueryString(); baseRequest.setURIPathQuery(URIUtil.addEncodedPaths(context==null?null:URIUtil.encodePath(context.getContextPath()), path)); HttpURI uri = baseRequest.getHttpURI(); baseRequest.setPathInfo(uri.getDecodedPath()); if (uri.getQuery()!=null) baseRequest.mergeQueryParameters(query,uri.getQuery(), true); //we have to assume dispatch path and query are UTF8 } final String target=baseRequest.getPathInfo(); final HttpServletRequest request=(HttpServletRequest)event.getSuppliedRequest(); final HttpServletResponse response=(HttpServletResponse)event.getSuppliedResponse(); if (LOG.isDebugEnabled()) LOG.debug("{} {} {} on {}", request.getDispatcherType(), request.getMethod(), target, channel); handle(target, baseRequest, request, response); if (LOG.isDebugEnabled()) LOG.debug("handledAsync={} async={} committed={} on {}", channel.getRequest().isHandled(),request.isAsyncStarted(),response.isCommitted(),channel); }
public void handleAsync(HttpChannel<?> connection) throws IOException, ServletException { final HttpChannelState state = connection.getRequest().getHttpChannelState(); final AsyncContextEvent event = state.getAsyncContextEvent(); final Request baseRequest=connection.getRequest(); final String path=event.getPath(); if (path!=null) { // this is a dispatch with a path ServletContext context=event.getServletContext(); HttpURI uri = new HttpURI(URIUtil.addPaths(context==null?null:context.getContextPath(), path)); baseRequest.setUri(uri); baseRequest.setRequestURI(null); baseRequest.setPathInfo(uri.getDecodedPath()); if (uri.getQuery()!=null) baseRequest.mergeQueryParameters(uri.getQuery(), true); //we have to assume dispatch path and query are UTF8 } final String target=baseRequest.getPathInfo(); final HttpServletRequest request=(HttpServletRequest)event.getSuppliedRequest(); final HttpServletResponse response=(HttpServletResponse)event.getSuppliedResponse(); if (LOG.isDebugEnabled()) { LOG.debug(request.getDispatcherType()+" "+request.getMethod()+" "+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 state = connection.getRequest().getHttpChannelState(); final AsyncContextEvent event = state.getAsyncContextEvent(); final Request baseRequest=connection.getRequest(); final String path=event.getPath(); if (path!=null) { // this is a dispatch with a path ServletContext context=event.getServletContext(); String query=baseRequest.getQueryString(); baseRequest.setURIPathQuery(URIUtil.addPaths(context==null?null:context.getContextPath(), path)); HttpURI uri = baseRequest.getHttpURI(); baseRequest.setPathInfo(uri.getDecodedPath()); if (uri.getQuery()!=null) baseRequest.mergeQueryParameters(query,uri.getQuery(), true); //we have to assume dispatch path and query are UTF8 } final String target=baseRequest.getPathInfo(); final HttpServletRequest request=(HttpServletRequest)event.getSuppliedRequest(); final HttpServletResponse response=(HttpServletResponse)event.getSuppliedResponse(); if (LOG.isDebugEnabled()) { LOG.debug(request.getDispatcherType()+" "+request.getMethod()+" "+target+" on "+connection); handle(target, baseRequest, request, response); LOG.debug("RESPONSE "+target+" "+connection.getResponse().getStatus()); } else handle(target, baseRequest, request, response); }
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()); //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 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()); //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(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()); //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(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()); //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(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()); //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); }