/** * Create a new URI from the arguments, handling IPv6 host encoding and default ports * @param scheme the URI scheme * @param server the URI server * @param port the URI port * @param path the URI path * @param query the URI query * @return A String URI */ public static String newURI(String scheme,String server, int port,String path,String query) { StringBuilder builder = newURIBuilder(scheme, server, port); builder.append(path); if (query!=null && query.length()>0) builder.append('?').append(query); return builder.toString(); }
/** * Create a new URI from the arguments, handling IPv6 host encoding and default ports * @param scheme * @param server * @param port * @param path * @param query * @return A String URI */ public static String newURI(String scheme,String server, int port,String path,String query) { StringBuilder builder = newURIBuilder(scheme, server, port); builder.append(path); if (query!=null && query.length()>0) builder.append('?').append(query); return builder.toString(); }
/** * Create a new URI from the arguments, handling IPv6 host encoding and default ports * @param scheme the URI scheme * @param server the URI server * @param port the URI port * @param path the URI path * @param query the URI query * @return A String URI */ public static String newURI(String scheme,String server, int port,String path,String query) { StringBuilder builder = newURIBuilder(scheme, server, port); builder.append(path); if (query!=null && query.length()>0) builder.append('?').append(query); return builder.toString(); }
@Override protected String filterServerResponseHeader(HttpServletRequest request, Response serverResponse, String headerName, String headerValue) { if (_proxyPassReverse && REVERSE_PROXY_HEADERS.contains(headerName)) { URI locationURI = URI.create(headerValue).normalize(); if (locationURI.isAbsolute() && isBackendLocation(locationURI)) { StringBuilder newURI = URIUtil.newURIBuilder(request.getScheme(), request.getServerName(), request.getServerPort()); String component = locationURI.getRawPath(); if (component != null) newURI.append(component); component = locationURI.getRawQuery(); if (component != null) newURI.append('?').append(component); component = locationURI.getRawFragment(); if (component != null) newURI.append('#').append(component); return URI.create(newURI.toString()).normalize().toString(); } } return headerValue; }