@Override public URI getAbsolutePath() { if (absolutePathUri != null) return absolutePathUri; return absolutePathUri = UriBuilder.fromUri(requestUri). replaceQuery("").fragment(""). build(); }
private void setHeaders(MultivaluedMap<String, Object> headers) { this.headers = headers; Object location = headers.getFirst(HttpHeaders.LOCATION); if (location != null) { if (location instanceof URI) { final URI locationUri = (URI)location; if (!locationUri.isAbsolute()) { final URI base = (statusType.getStatusCode() == Status.CREATED.getStatusCode()) ? request.getAbsolutePath() : request.getBaseUri(); location = UriBuilder.fromUri(base). path(locationUri.getRawPath()). replaceQuery(locationUri.getRawQuery()). fragment(locationUri.getRawFragment()). build(); } headers.putSingle(HttpHeaders.LOCATION, location); } } }
public WebApplicationContext createMatchResourceContext(URI u) { final URI base = request.getBaseUri(); if (u.isAbsolute()) { // TODO check if base is a base of u URI r = base.relativize(u); if (r == u) { throw new ContainerException("The URI " + u + " is not relative to the base URI " + base); } } else { u = UriBuilder.fromUri(base). path(u.getRawPath()). replaceQuery(u.getRawQuery()). fragment(u.getRawFragment()). build(); } final ContainerRequest _request = new ContainerRequest(app, HTTP_METHOD_MATCH_RESOURCE, base, u, new InBoundHeaders(), new ByteArrayInputStream(new byte[0])); _request.setSecurityContext(request.getSecurityContext()); // Propagate security context final ContainerResponse _response = new ContainerResponse(app, _request, null); return new WebApplicationContext(app, _request, _response); }
@Override public URI relativize(URI uri) { URI from = getRequestUri(); URI to = uri; if (uri.getScheme() == null && uri.getHost() == null) { to = getBaseUriBuilder().replaceQuery(null).path(uri.getPath()).replaceQuery(uri.getQuery()).fragment(uri.getFragment()).build(); } return ResteasyUriBuilderImpl.relativize(from, to); }
private Response sendImplicitGrantResponse(AuthorizationRequest authReq, AccessToken accessToken) { String uri = authReq.getRedirectUri(); String fragment = String.format("access_token=%s&token_type=bearer&expires_in=%s&scope=%s", accessToken.getToken(), accessToken.getExpiresIn(), StringUtils.join(authReq.getGrantedScopes(), ',')) + appendStateParameter(authReq); if (authReq.getClient().isIncludePrincipal()) { fragment += String.format("&principal=%s", authReq.getPrincipal().getDisplayName()) ; } return Response .seeOther(UriBuilder.fromUri(uri) .fragment(fragment).build()) .cacheControl(cacheControlNoStore()) .header("Pragma", "no-cache") .build(); }
/** * Updates the current URI fragment * @param name fragment name * @return updated WebClient */ public WebClient fragment(String name) { getCurrentBuilder().fragment(name); return this; }
@Override public URI getAbsolutePath() { return UriBuilder.fromUri(requestUri).replaceQuery("").fragment("").build(); }
/** * Updates the current URI fragment * @param name fragment name * @return updated WebClient */ public WebClient fragment(String name) { getCurrentBuilder().fragment(name); return this; }
@Override public URI getAbsolutePath() { return UriBuilder.fromUri(requestUri).replaceQuery("").fragment("").build(); }
@Override public URI getAbsolutePath() { if (absolutePathUri != null) return absolutePathUri; return absolutePathUri = UriBuilder.fromUri(requestUri). replaceQuery("").fragment(""). build(); }
/** * Updates the current URI fragment * @param name fragment name * @return updated WebClient */ public WebClient fragment(String name) { getCurrentBuilder().fragment(name); return this; }
@Override public URI getAbsolutePath() { if (absolutePathUri != null) return absolutePathUri; return absolutePathUri = UriBuilder.fromUri(requestUri). replaceQuery("").fragment(""). build(); }
@Override public URI getAbsolutePath() { if (absolutePath == null) { absolutePath = getRequestUriBuilder().replaceQuery(null).fragment(null).build(); } return absolutePath; }
/** * {@inheritDoc} */ public URI getAbsolutePath() { if (absolutePath != null) { return absolutePath; } return absolutePath = getRequestUriBuilder().replaceQuery(null).fragment(null).build(); }
public void addCacheFile(String hdfs_path, String label) { super.addCacheFile(UriBuilder.fromPath(hdfs_path).fragment(label).build()); } }
@Override public URI relativize(URI uri) { URI from = getRequestUri(); URI to = uri; if (uri.getScheme() == null && uri.getHost() == null) { to = getBaseUriBuilder().replaceQuery(null).path(uri.getPath()).replaceQuery(uri.getQuery()).fragment(uri.getFragment()).build(); } return ResteasyUriBuilderImpl.relativize(from, to); }
@Override public URI relativize(URI uri) { URI from = this.getRequestUri(); URI to = uri; if (uri.getScheme() == null && uri.getHost() == null) { to = this.getBaseUriBuilder().replaceQuery(null).path(uri.getPath()).replaceQuery(uri.getQuery()).fragment(uri.getFragment()).build(new Object[0]); } return ResteasyUriBuilder.relativize(from, to); }
@Override public URI relativize(URI uri) { URI from = getRequestUri(); URI to = uri; if (uri.getScheme() == null && uri.getHost() == null) { to = getBaseUriBuilder().replaceQuery(null).path(uri.getPath()).replaceQuery(uri.getQuery()).fragment(uri.getFragment()).build(); } return ResteasyUriBuilder.relativize(from, to); }
public ResponseBuilder location(URI loc) { if (!loc.isAbsolute()) { Message currentMessage = PhaseInterceptorChain.getCurrentMessage(); if (currentMessage != null) { UriInfo ui = new UriInfoImpl(currentMessage.getExchange().getInMessage(), null); loc = ui.getBaseUriBuilder() .path(loc.getRawPath()) .replaceQuery(loc.getRawQuery()) .fragment(loc.getRawFragment()).buildFromEncoded(); } } return setHeader(HttpHeaders.LOCATION, loc); }
public ResponseBuilder location(URI loc) { if (!loc.isAbsolute()) { Message currentMessage = PhaseInterceptorChain.getCurrentMessage(); if (currentMessage != null) { UriInfo ui = new UriInfoImpl(currentMessage.getExchange().getInMessage(), null); loc = ui.getBaseUriBuilder() .path(loc.getRawPath()) .replaceQuery(loc.getRawQuery()) .fragment(loc.getRawFragment()).buildFromEncoded(); } } return setHeader(HttpHeaders.LOCATION, loc); }