private UriBuilder(URI uri) { checkNotNull(uri, "uri"); this.scheme = uri.getScheme(); this.host = uri.getHost(); this.port = uri.getPort() == -1 ? null : uri.getPort(); if (uri.getPath() != null) path(unescapeSpecialChars(uri.getPath())); if (uri.getQuery() != null) query(queryParser().apply(unescapeSpecialChars(uri.getQuery()))); }
private UriBuilder(URI uri) { checkNotNull(uri, "uri"); this.scheme = uri.getScheme(); this.host = uri.getHost(); this.port = uri.getPort() == -1 ? null : uri.getPort(); if (uri.getPath() != null) path(unescapeSpecialChars(uri.getPath())); if (uri.getQuery() != null) query(queryParser().apply(unescapeSpecialChars(uri.getQuery()))); }
private UriBuilder(URI uri) { checkNotNull(uri, "uri"); this.scheme = uri.getScheme(); this.host = uri.getHost(); this.port = uri.getPort() == -1 ? null : uri.getPort(); if (uri.getRawPath() != null) // path decodes the string, so we need to get at the raw (encoded) string path(unescapeSpecialChars(uri.getRawPath())); if (uri.getRawQuery() != null) // The query parser decodes the strings that are passed to it; we should pass raw (encoded) queries query(queryParser().apply(unescapeSpecialChars(uri.getRawQuery()))); }
return false; redirect = uriBuilder(current.getEndpoint()).path(redirect.getPath()).query(redirect.getQuery()).build();
location = "/" + location; locationUri = URI.create(location); return Uris.uriBuilder(request.getEndpoint()).path(locationUri.getPath()).query(locationUri.getQuery()).build(); } else { throw new HttpResponseException("no uri in headers or content", null, from);
@SuppressWarnings("unchecked") @Override public <R extends HttpRequest> R bindToRequest(R request, Object input) { checkArgument(input instanceof Multimap<?, ?>, "this binder is only valid for Multimaps!"); Multimap<String, String> pairs = (Multimap<String, String>) checkNotNull(input, "account group pairs"); checkArgument(pairs.size() > 0, "you must specify at least one account, group pair"); Multimap<String, String> existingParams = queryParser().apply(request.getEndpoint().getQuery()); Builder<String, String> map = ImmutableMultimap.<String, String> builder().putAll(existingParams); int i = 0; for (Entry<String, String> entry : pairs.entries()) map.put(String.format("usersecuritygrouplist[%d].account", i), entry.getKey()).put( String.format("usersecuritygrouplist[%d].group", i++), entry.getValue()); URI endpoint = uriBuilder(request.getEndpoint()).query(map.build()).build(); return (R) request.toBuilder().endpoint(endpoint).build(); } }
@SuppressWarnings("unchecked") @Override public <R extends HttpRequest> R bindToRequest(R request, Object input) { checkArgument(input instanceof Multimap<?, ?>, "this binder is only valid for Multimaps!"); Multimap<String, String> pairs = (Multimap<String, String>) checkNotNull(input, "account group pairs"); checkArgument(!pairs.isEmpty(), "you must specify at least one account, group pair"); Multimap<String, String> existingParams = queryParser().apply(request.getEndpoint().getQuery()); Builder<String, String> map = ImmutableMultimap.<String, String> builder().putAll(existingParams); int i = 0; for (Entry<String, String> entry : pairs.entries()) map.put(String.format("usersecuritygrouplist[%d].account", i), entry.getKey()).put( String.format("usersecuritygrouplist[%d].group", i++), entry.getValue()); URI endpoint = uriBuilder(request.getEndpoint()).query(map.build()).build(); return (R) request.toBuilder().endpoint(endpoint).build(); } }
@SuppressWarnings("unchecked") @Override public <R extends HttpRequest> R bindToRequest(R request, Object input) { checkArgument(input instanceof Multimap<?, ?>, "this binder is only valid for Multimaps!"); Multimap<String, String> pairs = (Multimap<String, String>) checkNotNull(input, "account group pairs"); checkArgument(pairs.size() > 0, "you must specify at least one account, group pair"); Multimap<String, String> existingParams = queryParser().apply(request.getEndpoint().getQuery()); Builder<String, String> map = ImmutableMultimap.<String, String> builder().putAll(existingParams); int i = 0; for (Entry<String, String> entry : pairs.entries()) map.put(String.format("usersecuritygrouplist[%d].account", i), entry.getKey()).put( String.format("usersecuritygrouplist[%d].group", i++), entry.getValue()); URI endpoint = uriBuilder(request.getEndpoint()).query(map.build()).build(); return (R) request.toBuilder().endpoint(endpoint).build(); } }
private UriBuilder(URI uri) { checkNotNull(uri, "uri"); this.scheme = uri.getScheme(); this.host = uri.getHost(); this.port = uri.getPort() == -1 ? null : uri.getPort(); if (uri.getRawPath() != null) // path decodes the string, so we need to get at the raw (encoded) string path(unescapeSpecialChars(uri.getRawPath())); if (uri.getRawQuery() != null) // The query parser decodes the strings that are passed to it; we should pass raw (encoded) queries query(queryParser().apply(unescapeSpecialChars(uri.getRawQuery()))); }
public UriBuilder query(@Nullable String queryLine) { if (query == null) return clearQuery(); return query(queryParser().apply(queryLine)); }
public UriBuilder query(@Nullable String queryLine) { if (query == null) return clearQuery(); return query(queryParser().apply(queryLine)); }
public HttpRequest filter(HttpRequest request) throws HttpException { checkNotNull(request, "request must be present"); Multimap<String, String> decodedParams = queryParser().apply(request.getEndpoint().getRawQuery()); addSigningParams(decodedParams); String stringToSign = createStringToSign(request, decodedParams); String signature = sign(stringToSign); addSignature(decodedParams, signature); request = request.toBuilder().endpoint(uriBuilder(request.getEndpoint()).query(decodedParams).build()).build(); utils.logRequest(signatureLog, request, "<<"); return request; }
private UriBuilder(URI uri) { checkNotNull(uri, "uri"); this.scheme = uri.getScheme(); this.host = uri.getHost(); this.port = uri.getPort() == -1 ? null : uri.getPort(); if (uri.getPath() != null) path(unescapeSpecialChars(uri.getPath())); if (uri.getQuery() != null) query(queryParser().apply(unescapeSpecialChars(uri.getQuery()))); }
public UriBuilder query(@Nullable String queryLine) { if (query == null) return clearQuery(); return query(queryParser().apply(queryLine)); }
public UriBuilder query(@Nullable String queryLine) { if (query == null) return clearQuery(); return query(queryParser().apply(queryLine)); }
public HttpRequest filter(HttpRequest request) throws HttpException { checkNotNull(request, "request must be present"); Multimap<String, String> decodedParams = queryParser().apply(request.getEndpoint().getRawQuery()); addSigningParams(decodedParams); String stringToSign = createStringToSign(request, decodedParams); String signature = sign(stringToSign); addSignature(decodedParams, signature); request = request.toBuilder().endpoint(uriBuilder(request.getEndpoint()).query(decodedParams).build()).build(); utils.logRequest(signatureLog, request, "<<"); return request; }
private UriBuilder(URI uri) { checkNotNull(uri, "uri"); this.scheme = uri.getScheme(); this.host = uri.getHost(); this.port = uri.getPort() == -1 ? null : uri.getPort(); if (uri.getRawPath() != null) // path decodes the string, so we need to get at the raw (encoded) string path(unescapeSpecialChars(uri.getRawPath())); if (uri.getRawQuery() != null) // The query parser decodes the strings that are passed to it; we should pass raw (encoded) queries query(queryParser().apply(unescapeSpecialChars(uri.getRawQuery()))); }
public UriBuilder query(@Nullable String queryLine) { if (query == null) return clearQuery(); return query(queryParser().apply(queryLine)); }
public UriBuilder query(@Nullable String queryLine) { if (query == null) return clearQuery(); return query(queryParser().apply(queryLine)); }
public HttpRequest filter(HttpRequest request) throws HttpException { checkNotNull(request, "request must be present"); Multimap<String, String> decodedParams = queryParser().apply(request.getEndpoint().getRawQuery()); addSigningParams(decodedParams); String stringToSign = createStringToSign(request, decodedParams); String signature = sign(stringToSign); addSignature(decodedParams, signature); request = request.toBuilder().endpoint(uriBuilder(request.getEndpoint()).query(decodedParams).build()).build(); utils.logRequest(signatureLog, request, "<<"); return request; }