List of usage examples for org.springframework.web.util UriComponentsBuilder fromUri
public static UriComponentsBuilder fromUri(URI uri)
From source file:io.syndesis.credential.BaseCredentialProvider.java
protected static String callbackUrlFor(final URI baseUrl, final MultiValueMap<String, String> additionalParams) { final String path = baseUrl.getPath(); final String callbackPath = path + "credentials/callback"; try {// w w w. j av a 2s.c om 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); } }
From source file:it.reply.orchestrator.service.utils.MyLinkBuilder.java
public static MyLinkBuilder getNewBuilder(URI uri) { UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromUri(uri); return new MyLinkBuilder(uriComponentsBuilder); }
From source file:com.expedia.seiso.web.hateoas.link.RepoSearchLinks.java
public Link repoSearchListLink(@NonNull String rel, @NonNull Class<?> itemClass) { // @formatter:off val href = UriComponentsBuilder.fromUri(versionUri).pathSegment(repoPath(itemClass), BASE_SEARCH_PATH) .build().toString();// w w w .j av a2s . co m // @formatter:on return new Link(rel, href); }
From source file:net.paslavsky.springrest.UriBuilder.java
private UriComponentsBuilder newBuilder(RestMethodMetadata metadata) { UriComponentsBuilder builder = null; if (baseUrl != null) { builder = UriComponentsBuilder.fromUri(baseUrl); }//w w w . j av a 2s. c o m builder = createOrAdd(builder, metadata.getCommonPath()); builder = createOrAdd(builder, metadata.getAdditionalPath()); return builder; }
From source file:com.expedia.seiso.web.hateoas.link.PaginationLinkBuilderTests.java
@Before public void setUp() throws Exception { val uri = new URI("https://seiso.example.com/v2/cars/find-by-name"); this.uriComponents = UriComponentsBuilder.fromUri(uri).build(); this.params = new LinkedMultiValueMap<String, String>(); params.set("name", "honda"); this.builder = paginationLinkBuilder(3, 20, 204); }
From source file:io.bosh.client.internal.AbstractSpringOperations.java
protected final <T> Observable<T> get(Class<T> responseType, Consumer<UriComponentsBuilder> builderCallback) { return createObservable(() -> { UriComponentsBuilder builder = UriComponentsBuilder.fromUri(this.root); builderCallback.accept(builder); URI uri = builder.build().toUri(); this.logger.debug("GET {}", uri); return this.restOperations.getForObject(uri, responseType); });//from ww w. ja va2 s. co m }
From source file:cz.cvut.zuul.samples.client.portlet.RemoteServiceImpl.java
private URI buildURI(String path, Object... uriVariables) { return UriComponentsBuilder.fromUri(baseUri).path(path).buildAndExpand(uriVariables).toUri(); }
From source file:io.bosh.client.internal.AbstractSpringOperations.java
protected final <T> Observable<ResponseEntity<T>> getEntity(Class<T> responseType, Consumer<UriComponentsBuilder> builderCallback) { return createObservable(() -> { UriComponentsBuilder builder = UriComponentsBuilder.fromUri(this.root); builderCallback.accept(builder); URI uri = builder.build().toUri(); this.logger.debug("GET {}", uri); return this.restOperations.getForEntity(uri, responseType); });/*from ww w. j a va2s. c o m*/ }
From source file:com.github.cric.common.service.cripapi.CricApiConfiguration.java
/** * This interceptor adds cric-api-key to all outgoing request. *///from www . j a v a 2 s. co m private ClientHttpRequestInterceptor outgoingCricApiRequestInterceptor() { return (request, body, execution) -> { HttpRequest modified = new HttpRequestWrapper(request) { @Override public URI getURI() { return UriComponentsBuilder.fromUri(super.getURI()) .queryParam(API_KEY, System.getProperty(API_KEY_PROP)).build().toUri(); } }; return execution.execute(modified, body); }; }
From source file:de.codecentric.boot.admin.discovery.DefaultServiceInstanceConverter.java
protected URI getHealthUrl(ServiceInstance instance) { String healthPath = defaultIfEmpty(instance.getMetadata().get(KEY_HEALTH_PATH), healthEndpointPath); healthPath = stripStart(healthPath, "/"); return UriComponentsBuilder.fromUri(getManagementUrl(instance)).pathSegment(healthPath).build().toUri(); }