private String rewriteUri(UriInfo uriInfo, String uri) { return uriInfo.getAbsolutePathBuilder() .replacePath("/v1/proxy") .queryParam("uri", uri) .queryParam("hmac", hmac.hashString(uri, UTF_8)) .build() .toString(); }
private synchronized URI createNextResultsUri(String scheme, UriInfo uriInfo) { return uriInfo.getBaseUriBuilder() .scheme(scheme) .replacePath("/v1/statement") .path(queryId.toString()) .path(String.valueOf(resultId.incrementAndGet())) .replaceQuery("") .build(); }
private URI getRedirectBaseUri(URI locationURI) { if (locationURI == null) { throw new TransportException("Missing Location header in the redirect reply"); } Matcher pathMatcher = REDIRECT_PATH_REGEX.matcher(locationURI.getPath()); if (pathMatcher.matches()) { return UriBuilder.fromUri(locationURI) .host(dnsService.resolveIp(locationURI.getHost())) .replacePath(pathMatcher.group(1)) .replaceQuery(null) .build(); } logger.warn("Invalid redirect URL {}", locationURI); return null; } }
/** * Normalize the URI provided and return the normalized * copy. * @param uri The URI to normalize * @param preserveContdSlashes Shall we preserve "///" slashes * @return New normalized URI */ public static URI normalize(URI uri, boolean preserveContdSlashes) { if (!uri.getRawPath().contains("//")) { return uri.normalize(); } String np = UriHelper.removeDotSegments( uri.getRawPath(), preserveContdSlashes ); if (np.equals(uri.getRawPath())) { return uri; } return UriBuilder.fromUri(uri).replacePath(np).build(); }
rc.setRequestUri(uriInfo.getRequestUriBuilder().replacePath(path).build());
rc.setRequestUri(uriInfo.getRequestUriBuilder().replacePath(path).build());
request.setUris( request.getBaseUri(), request.getRequestUriBuilder().replacePath(path).build());
: (filterContextPath != null ? filterContextPath : ""); baseUri = absoluteUriBuilder.replacePath(request.getContextPath()).path(replacingPath).path("/").build(); requestUri = absoluteUriBuilder.replacePath(requestURI) .replaceQuery(ContainerUtils.encodeUnsafeCharacters(queryString)) .build();
final URI requestUri; try { baseUri = absoluteUriBuilder.replacePath(encodedBasePath).build(); String queryParameters = ContainerUtils.encodeUnsafeCharacters(request.getQueryString()); if (queryParameters == null) { requestUri = absoluteUriBuilder.replacePath(requestURI) .replaceQuery(queryParameters) .build();
: (filterContextPath != null ? filterContextPath : ""); baseUri = absoluteUriBuilder.replacePath(request.getContextPath()).path(replacingPath).path("/").build(); requestUri = absoluteUriBuilder.replacePath(requestURI) .replaceQuery(ContainerUtils.encodeUnsafeCharacters(queryString)) .build();
final URI requestUri; try { baseUri = absoluteUriBuilder.replacePath(encodedBasePath).build(); String queryParameters = ContainerUtils.encodeUnsafeCharacters(request.getQueryString()); if (queryParameters == null) { requestUri = absoluteUriBuilder.replacePath(requestURI) .replaceQuery(queryParameters) .build();
.replacePath( requestURIPath .substring(0, requestURIPath.lastIndexOf('/') + 1))
.replacePath( requestURIPath .substring(0, requestURIPath.lastIndexOf('/') + 1))
.replacePath( requestURIPath .substring(0, requestURIPath.lastIndexOf('/') + 1))
.replacePath("ui/query.html") .replaceQuery(queryId.toString()) .build();
public void initializeFromRequest(URI requestURI) { String r = requestURI.getRawPath(); if (r.startsWith("/")) { encodedPath = r; path = requestURI.getPath(); } else { encodedPath = "/" + r; path = "/" + requestURI.getPath(); } this.requestURI = requestURI; baseURI = UriBuilder.fromUri(requestURI).replacePath("").build(); absolutePath = UriBuilder.fromUri(requestURI).replaceQuery(null).build(); processPath(); }
protected void initialize(CharSequence absoluteUri, String queryString, String contextPath) { ResteasyUriBuilder absoluteBuilder = (ResteasyUriBuilder) ((ResteasyUriBuilder) RuntimeDelegate.getInstance() .createUriBuilder()).uriFromCharSequence((CharSequence)absoluteUri); absolutePath = absoluteBuilder.build(); requestURI = absoluteBuilder.replaceQuery(queryString).build(); encodedPath = PathHelper.getEncodedPathInfo(absolutePath.getRawPath(), contextPath); baseURI = absolutePath; if (!encodedPath.trim().equals("")) { String tmpContextPath = contextPath; if (!tmpContextPath.endsWith("/")) tmpContextPath += "/"; baseURI = absoluteBuilder.clone().replacePath(tmpContextPath).replaceQuery(null).build(); } // // make sure there is no trailing '/' // if (encodedPath.length() > 1 && encodedPath.endsWith("/")) // encodedPath = encodedPath.substring(0, encodedPath.length() - 1); // make sure path starts with '/' if (encodedPath.length() == 0 || encodedPath.charAt(0) != '/') { encodedPath = "/" + encodedPath; } path = UriBuilder.fromPath(encodedPath).build().getPath(); processPath(); }
URI newUri = requestContext.getUriInfo().getBaseUriBuilder().replacePath(rawPath).replaceQuery(uri.getRawQuery()).build(); requestContext.setRequestUri(newUri);
baseURI = UriBuilder.fromUri(absoluteURI).replacePath(tmpContextPath).replaceQuery(null).build();
.replacePath( requestURIPath .substring(0, requestURIPath.lastIndexOf('/') + 1))