@Override public void setRequestURI(String uri) { request.getHttpURI().setPath(uri); }
private static MetaData.Request toRequestMetadata(ServiceRequestContext ctx, AggregatedHttpMessage aReq) { // Construct the HttpURI final StringBuilder uriBuf = new StringBuilder(); final HttpHeaders aHeaders = aReq.headers(); uriBuf.append(ctx.sessionProtocol().isTls() ? "https" : "http"); uriBuf.append("://"); uriBuf.append(aHeaders.authority()); uriBuf.append(aHeaders.path()); final HttpURI uri = new HttpURI(uriBuf.toString()); uri.setPath(ctx.mappedPath()); // Convert HttpHeaders to HttpFields final HttpFields jHeaders = new HttpFields(aHeaders.size()); aHeaders.forEach(e -> { final AsciiString key = e.getKey(); if (!key.isEmpty() && key.byteAt(0) != ':') { jHeaders.add(key.toString(), e.getValue()); } }); return new MetaData.Request( aHeaders.method().name(), uri, HttpVersion.HTTP_1_1, jHeaders, aReq.content().length()); }
@Override public RequestDispatcher getRequestDispatcher(String uriInContext) { if (uriInContext == null) return null; if (!uriInContext.startsWith("/")) return null; try { HttpURI uri = new HttpURI(null,null,0,uriInContext); String pathInfo=URIUtil.canonicalPath(uri.getDecodedPath()); if (pathInfo==null) return null; String contextPath=getContextPath(); if (contextPath!=null && contextPath.length()>0) uri.setPath(URIUtil.addPaths(contextPath,uri.getPath())); return new Dispatcher(ContextHandler.this,uri,pathInfo); } catch (Exception e) { LOG.ignore(e); } return null; }
@Override public RequestDispatcher getRequestDispatcher(String uriInContext) { // uriInContext is encoded, potentially with query if (uriInContext == null) return null; if (!uriInContext.startsWith("/")) return null; try { HttpURI uri = new HttpURI(null,null,0,uriInContext); String pathInfo = URIUtil.canonicalPath(uri.getDecodedPath()); if (pathInfo == null) return null; String contextPath = getContextPath(); if (contextPath != null && contextPath.length() > 0) uri.setPath(URIUtil.addPaths(contextPath,uri.getPath())); return new Dispatcher(ContextHandler.this,uri,pathInfo); } catch (Exception e) { LOG.ignore(e); } return null; }
uri.setPath(path);