@Override public String getRootURL() { return request.getRootURL().toString(); } }
@Override public String getUrl() { return request.getRootURL().append(getUriAsString()).toString(); }
@Before public void setUp() throws Exception { initMocks(this); jetty9Request = new Jetty9Request(request); when(request.getHttpURI()).thenReturn(new HttpURI("foo/bar/baz")); when(request.getRootURL()).thenReturn(new StringBuilder("http://junk/")); }
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (_newContextURL==null) return; String path=_newContextURL; if (!_discardPathInfo && request.getPathInfo()!=null) path=URIUtil.addPaths(path, request.getPathInfo()); StringBuilder location = URIUtil.hasScheme(path)?new StringBuilder():baseRequest.getRootURL(); location.append(path); if (!_discardQuery && request.getQueryString()!=null) { location.append('?'); String q=request.getQueryString(); q=q.replaceAll("\r\n?&=","!"); location.append(q); } response.setHeader(HttpHeaders.LOCATION,location.toString()); if (_expires!=null) response.setHeader(HttpHeaders.EXPIRES,_expires); response.setStatus(_permanent?HttpServletResponse.SC_MOVED_PERMANENTLY:HttpServletResponse.SC_FOUND); response.setContentLength(0); baseRequest.setHandled(true); }
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (_newContextURL==null) return; String path=_newContextURL; if (!_discardPathInfo && request.getPathInfo()!=null) path=URIUtil.addPaths(path, request.getPathInfo()); StringBuilder location = URIUtil.hasScheme(path)?new StringBuilder():baseRequest.getRootURL(); location.append(path); if (!_discardQuery && request.getQueryString()!=null) { location.append('?'); String q=request.getQueryString(); q=q.replaceAll("\r\n?&=","!"); location.append(q); } response.setHeader(HttpHeaders.LOCATION,location.toString()); if (_expires!=null) response.setHeader(HttpHeaders.EXPIRES,_expires); response.setStatus(_permanent?HttpServletResponse.SC_MOVED_PERMANENTLY:HttpServletResponse.SC_FOUND); response.setContentLength(0); baseRequest.setHandled(true); }
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (_newContextURL==null) return; String path=_newContextURL; if (!_discardPathInfo && request.getPathInfo()!=null) path=URIUtil.addPaths(path, request.getPathInfo()); StringBuilder location = URIUtil.hasScheme(path)?new StringBuilder():baseRequest.getRootURL(); location.append(path); if (!_discardQuery && request.getQueryString()!=null) { location.append('?'); String q=request.getQueryString(); q=q.replaceAll("\r\n?&=","!"); location.append(q); } response.setHeader(HttpHeaders.LOCATION,location.toString()); if (_expires!=null) response.setHeader(HttpHeaders.EXPIRES,_expires); response.setStatus(_permanent?HttpServletResponse.SC_MOVED_PERMANENTLY:HttpServletResponse.SC_FOUND); response.setContentLength(0); baseRequest.setHandled(true); }
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (_newContextURL==null) return; String path=_newContextURL; if (!_discardPathInfo && request.getPathInfo()!=null) path=URIUtil.addPaths(path, request.getPathInfo()); StringBuilder location = URIUtil.hasScheme(path)?new StringBuilder():baseRequest.getRootURL(); location.append(path); if (!_discardQuery && request.getQueryString()!=null) { location.append('?'); String q=request.getQueryString(); q=q.replaceAll("\r\n?&=","!"); location.append(q); } response.setHeader(HttpHeaders.LOCATION,location.toString()); if (_expires!=null) response.setHeader(HttpHeaders.EXPIRES,_expires); response.setStatus(_permanent?HttpServletResponse.SC_MOVED_PERMANENTLY:HttpServletResponse.SC_FOUND); response.setContentLength(0); baseRequest.setHandled(true); }
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (_newContextURL==null) return; String path=_newContextURL; if (!_discardPathInfo && request.getPathInfo()!=null) path=URIUtil.addPaths(path, request.getPathInfo()); StringBuilder location = URIUtil.hasScheme(path)?new StringBuilder():baseRequest.getRootURL(); location.append(path); if (!_discardQuery && request.getQueryString()!=null) { location.append('?'); String q=request.getQueryString(); q=q.replaceAll("\r\n?&=","!"); location.append(q); } response.setHeader(HttpHeaders.LOCATION,location.toString()); if (_expires!=null) response.setHeader(HttpHeaders.EXPIRES,_expires); response.setStatus(_permanent?HttpServletResponse.SC_MOVED_PERMANENTLY:HttpServletResponse.SC_FOUND); response.setContentLength(0); baseRequest.setHandled(true); }
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (_newContextURL==null) return; String path=_newContextURL; if (!_discardPathInfo && request.getPathInfo()!=null) path=URIUtil.addPaths(path, request.getPathInfo()); StringBuilder location = URIUtil.hasScheme(path)?new StringBuilder():baseRequest.getRootURL(); location.append(path); if (!_discardQuery && request.getQueryString()!=null) { location.append('?'); String q=request.getQueryString(); q=q.replaceAll("\r\n?&=","!"); location.append(q); } response.setHeader(HttpHeader.LOCATION.asString(),location.toString()); if (_expires!=null) response.setHeader(HttpHeader.EXPIRES.asString(),_expires); response.setStatus(_permanent?HttpServletResponse.SC_MOVED_PERMANENTLY:HttpServletResponse.SC_FOUND); response.setContentLength(0); baseRequest.setHandled(true); }
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (_newContextURL==null) return; String path=_newContextURL; if (!_discardPathInfo && request.getPathInfo()!=null) path=URIUtil.addPaths(path, request.getPathInfo()); StringBuilder location = URIUtil.hasScheme(path)?new StringBuilder():baseRequest.getRootURL(); location.append(path); if (!_discardQuery && request.getQueryString()!=null) { location.append('?'); String q=request.getQueryString(); q=q.replaceAll("\r\n?&=","!"); location.append(q); } response.setHeader(HttpHeader.LOCATION.asString(),location.toString()); if (_expires!=null) response.setHeader(HttpHeader.EXPIRES.asString(),_expires); response.setStatus(_permanent?HttpServletResponse.SC_MOVED_PERMANENTLY:HttpServletResponse.SC_FOUND); response.setContentLength(0); baseRequest.setHandled(true); }
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (_newContextURL==null) return; String path=_newContextURL; if (!_discardPathInfo && request.getPathInfo()!=null) path=URIUtil.addPaths(path, request.getPathInfo()); StringBuilder location = URIUtil.hasScheme(path)?new StringBuilder():baseRequest.getRootURL(); location.append(path); if (!_discardQuery && request.getQueryString()!=null) { location.append('?'); String q=request.getQueryString(); q=q.replaceAll("\r\n?&=","!"); location.append(q); } response.setHeader(HttpHeader.LOCATION.asString(),location.toString()); if (_expires!=null) response.setHeader(HttpHeader.EXPIRES.asString(),_expires); response.setStatus(_permanent?HttpServletResponse.SC_MOVED_PERMANENTLY:HttpServletResponse.SC_FOUND); response.setContentLength(0); baseRequest.setHandled(true); }
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (_newContextURL==null) return; String path=_newContextURL; if (!_discardPathInfo && request.getPathInfo()!=null) path=URIUtil.addPaths(path, request.getPathInfo()); StringBuilder location = URIUtil.hasScheme(path)?new StringBuilder():baseRequest.getRootURL(); location.append(path); if (!_discardQuery && request.getQueryString()!=null) { location.append('?'); String q=request.getQueryString(); q=q.replaceAll("\r\n?&=","!"); location.append(q); } response.setHeader(HttpHeader.LOCATION.asString(),location.toString()); if (_expires!=null) response.setHeader(HttpHeader.EXPIRES.asString(),_expires); response.setStatus(_permanent?HttpServletResponse.SC_MOVED_PERMANENTLY:HttpServletResponse.SC_FOUND); response.setContentLength(0); baseRequest.setHandled(true); }
@Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (_newContextURL==null) return; String path=_newContextURL; if (!_discardPathInfo && request.getPathInfo()!=null) path=URIUtil.addPaths(path, request.getPathInfo()); StringBuilder location = URIUtil.hasScheme(path)?new StringBuilder():baseRequest.getRootURL(); location.append(path); if (!_discardQuery && request.getQueryString()!=null) { location.append('?'); String q=request.getQueryString(); q=q.replaceAll("\r\n?&=","!"); location.append(q); } response.setHeader(HttpHeader.LOCATION.asString(),location.toString()); if (_expires!=null) response.setHeader(HttpHeader.EXPIRES.asString(),_expires); response.setStatus(_permanent?HttpServletResponse.SC_MOVED_PERMANENTLY:HttpServletResponse.SC_FOUND); response.setContentLength(0); baseRequest.setHandled(true); }
@Override protected String filterResponseHeaderValue(String headerName, String headerValue, HttpServletRequest request) { if (_proxyPassReverse && REVERSE_PROXY_HEADERS.contains(headerName)) { HttpURI locationURI = new HttpURI(headerValue); if (isAbsoluteLocation(locationURI) && isBackendLocation(locationURI)) { Request jettyRequest = (Request)request; URI reverseUri; try { reverseUri = new URI(jettyRequest.getRootURL().append(locationURI.getCompletePath()).toString()).normalize(); return reverseUri.toURL().toString(); } catch (Exception e) { _log.warn("Not filtering header response",e); return headerValue; } } } return headerValue; }
StringBuilder buf = _connection.getRequest().getRootURL(); if (location.startsWith("/"))
StringBuilder buf = _connection.getRequest().getRootURL(); if (location.startsWith("/"))
StringBuilder buf = _connection.getRequest().getRootURL(); if (location.startsWith("/"))
StringBuilder buf = _connection.getRequest().getRootURL(); if (location.startsWith("/"))
StringBuilder buf = _channel.getRequest().getRootURL(); if (location.startsWith("/"))
StringBuilder buf = _channel.getRequest().getRootURL(); if (location.startsWith("/"))