@Override public BodyBuilder queryParams(MultiValueMap<String, String> params) { this.queryParamsBuilder.queryParams(params); return this; }
@Override public DefaultUriBuilder queryParams(MultiValueMap<String, String> params) { this.uriComponentsBuilder.queryParams(params); return this; }
@Override public DefaultUriBuilder queryParams(MultiValueMap<String, String> params) { this.uriComponentsBuilder.queryParams(params); return this; }
@Override public BodyBuilder queryParams(MultiValueMap<String, String> params) { this.queryParamsBuilder.queryParams(params); return this; }
private URI getUrlToUse() { MultiValueMap<String, String> params = this.queryParamsBuilder.buildAndExpand().encode().getQueryParams(); if (!params.isEmpty()) { return UriComponentsBuilder.fromUri(this.url).queryParams(params).build(true).toUri(); } return this.url; } }
private String buildAuthorizationRequestUri() { MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>(); parameters.set(OAuth2ParameterNames.RESPONSE_TYPE, this.responseType.getValue()); parameters.set(OAuth2ParameterNames.CLIENT_ID, this.clientId); if (!CollectionUtils.isEmpty(this.scopes)) { parameters.set(OAuth2ParameterNames.SCOPE, StringUtils.collectionToDelimitedString(this.scopes, " ")); } if (this.state != null) { parameters.set(OAuth2ParameterNames.STATE, this.state); } if (this.redirectUri != null) { parameters.set(OAuth2ParameterNames.REDIRECT_URI, this.redirectUri); } if (!CollectionUtils.isEmpty(this.additionalParameters)) { this.additionalParameters.entrySet().stream() .filter(e -> !e.getKey().equals(OAuth2ParameterNames.REGISTRATION_ID)) .forEach(e -> parameters.set(e.getKey(), e.getValue().toString())); } return UriComponentsBuilder.fromHttpUrl(this.authorizationUri) .queryParams(parameters) .encode(StandardCharsets.UTF_8) .build() .toUriString(); } }
private URI getUrlToUse() { MultiValueMap<String, String> params = this.queryParamsBuilder.buildAndExpand().encode().getQueryParams(); if (!params.isEmpty()) { return UriComponentsBuilder.fromUri(this.url).queryParams(params).build(true).toUri(); } return this.url; } }
builder.queryParams(queryParams);
@Override protected void copyToUriComponentsBuilder(UriComponentsBuilder builder) { if (getScheme() != null) { builder.scheme(getScheme()); } if (getUserInfo() != null) { builder.userInfo(getUserInfo()); } if (getHost() != null) { builder.host(getHost()); } // Avoid parsing the port, may have URI variable.. if (this.port != null) { builder.port(this.port); } this.path.copyToUriComponentsBuilder(builder); if (!getQueryParams().isEmpty()) { builder.queryParams(getQueryParams()); } if (getFragment() != null) { builder.fragment(getFragment()); } }
@Override protected void copyToUriComponentsBuilder(UriComponentsBuilder builder) { if (getScheme() != null) { builder.scheme(getScheme()); } if (getUserInfo() != null) { builder.userInfo(getUserInfo()); } if (getHost() != null) { builder.host(getHost()); } // Avoid parsing the port, may have URI variable.. if (this.port != null) { builder.port(this.port); } this.path.copyToUriComponentsBuilder(builder); if (!getQueryParams().isEmpty()) { builder.queryParams(getQueryParams()); } if (getFragment() != null) { builder.fragment(getFragment()); } }
@Override public DefaultUriBuilder queryParams(MultiValueMap<String, String> params) { this.uriComponentsBuilder.queryParams(params); return this; }
@Override public BodyBuilder queryParams(MultiValueMap<String, String> params) { this.queryParamsBuilder.queryParams(params); return this; }
@Bean public IntegrationFlow httpReactiveProxyFlow() { return IntegrationFlows .from(Http.inboundGateway("/service2") .requestMapping(r -> r.params("name"))) .handle(WebFlux.<MultiValueMap<String, String>>outboundGateway(m -> UriComponentsBuilder.fromUriString("http://www.springsource.org/spring-integration") .queryParams(m.getPayload()) .build() .toUri()) .httpMethod(HttpMethod.GET) .expectedResponseType(String.class)) .get(); }
/** * @param oldUri base {@link URI} * @param queryParams query parameters to be added to {@link URI} * @return {@link URI} based on oldUri with <b>queryParams</b> added. */ public static URI appendParameters(URI oldUri, Map<String, String> queryParams) { MultiValueMap<String, String> localQueryParams = new LinkedMultiValueMap<>(); queryParams.entrySet().forEach(entry -> localQueryParams.add(entry.getKey(), entry.getValue())); return fromUri(oldUri).queryParams(localQueryParams).build().toUri(); }
protected static String callbackUrlFor(final URI baseUrl, final MultiValueMap<String, String> additionalParams) { final String path = baseUrl.getPath(); final String callbackPath = path + "credentials/callback"; try { final URI base = new URI(baseUrl.getScheme(), null, baseUrl.getHost(), baseUrl.getPort(), callbackPath, null, null); return UriComponentsBuilder.fromUri(base).queryParams(additionalParams).build().toUriString(); } catch (final URISyntaxException e) { throw new IllegalStateException("Unable to generate callback URI", e); } }
protected static String callbackUrlFor(final URI baseUrl, final MultiValueMap<String, String> additionalParams) { final String path = baseUrl.getPath(); final String callbackPath = path + "credentials/callback"; try { final URI base = new URI(baseUrl.getScheme(), null, baseUrl.getHost(), baseUrl.getPort(), callbackPath, null, null); return UriComponentsBuilder.fromUri(base).queryParams(additionalParams).build().toUriString(); } catch (final URISyntaxException e) { throw new IllegalStateException("Unable to generate callback URI", e); } }
@Override public ModuleMetadataResource listDeployedModule(String containerId, String moduleId) { Assert.isTrue(StringUtils.hasText(containerId)); Assert.isTrue(StringUtils.hasText(moduleId)); String url = resources.get("runtime/modules").toString(); MultiValueMap<String, String> values = new LinkedMultiValueMap<String, String>(); values.add("containerId", containerId); values.add("moduleId", moduleId); String uriString = UriComponentsBuilder.fromUriString(url).queryParams(values).build().toUriString(); return restTemplate.getForObject(uriString, ModuleMetadataResource.class); }
protected URI buildUri(String path, MultiValueMap<String, String> parameters) { return UriComponentsBuilder .fromUriString(baseUrl) .path(path) .queryParams(parameters) .build().toUri(); } }
private URI getUrlToUse() { MultiValueMap<String, String> params = this.queryParamsBuilder.buildAndExpand().encode().getQueryParams(); if (!params.isEmpty()) { return UriComponentsBuilder.fromUri(this.url).queryParams(params).build(true).toUri(); } return this.url; } }
@SuppressWarnings({ "rawtypes", "unchecked" }) private RequestEntity<String> buildRequestEntity(String hostUrl, String path, MultiValueMap<String, String> listQueryParams, HttpMethod httpMethod) { UriComponents uriComponents = UriComponentsBuilder.newInstance() .scheme("https") .host(hostUrl) .path(path) .queryParams(listQueryParams) .build(); return new RequestEntity(setHeaders(), httpMethod, uriComponents.toUri()); }