Example usage for org.springframework.web.util UriComponentsBuilder build

List of usage examples for org.springframework.web.util UriComponentsBuilder build

Introduction

In this page you can find the example usage for org.springframework.web.util UriComponentsBuilder build.

Prototype

public UriComponents build() 

Source Link

Document

Build a UriComponents instance from the various components contained in this builder.

Usage

From source file:org.kamranzafar.spring.wpapi.client.BaseService.java

protected URI buildUri(String uri, Map<String, String> params) {
    UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromUriString(uri);

    params.forEach((k, v) -> uriComponentsBuilder.queryParam(k, v));

    return uriComponentsBuilder.build().toUri();
}

From source file:ph.com.fsoft.temp.service.red.service.PersonServiceImpl.java

@Override
public HashSet<PersonDto> findByLastName(String firstName) {
    UriComponentsBuilder uri = UriComponentsBuilder.fromHttpUrl("http://blue/blue/api/rest/person")
            .queryParam("firstName", firstName);
    return restTemplate.getForObject(uri.build().toUri(), HashSet.class);
}

From source file:com.orange.clara.cloud.cf.servicebroker.log.infrastructure.SplunkDashboardUrlFactory.java

@Override
public String getAllAppsDashboardUrl() {
    UriComponentsBuilder urlBuilder = UriComponentsBuilder.fromHttpUrl(logServerUrl);
    urlBuilder.path(SEARCH_PATH);//from  w  ww.  j  a  va 2s . co  m
    urlBuilder.queryParam("q", "search index=\"*\" source=\"tcp:12345\"");
    return urlBuilder.build().encode().toUriString();
}

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   w  w w . j  av a2s  .c o  m*/
}

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  w ww .  ja  v a  2s .c  o m
}

From source file:io.bosh.client.internal.AbstractSpringOperations.java

protected final <T> Observable<T> post(Class<T> responseType, Object request,
        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.postForObject(uri, request, responseType);
    });/*from  www  . j  a  v a2  s  .c  om*/
}

From source file:io.bosh.client.internal.AbstractSpringOperations.java

protected final <T> Observable<ResponseEntity<T>> postForEntity(Class<T> responseType, Object request,
        Consumer<UriComponentsBuilder> builderCallback) {
    return createObservable(() -> {
        UriComponentsBuilder builder = UriComponentsBuilder.fromUri(this.root);
        builderCallback.accept(builder);
        URI uri = builder.build().toUri();

        this.logger.debug("POST {}", uri);
        return this.restOperations.postForEntity(uri, request, responseType);
    });/*from   ww  w.  ja  va  2s  . com*/
}

From source file:io.bosh.client.internal.AbstractSpringOperations.java

protected final <T, R> Observable<ResponseEntity<R>> exchangeForEntity(T request, Class<R> responseType,
        HttpHeaders headers, HttpMethod method, Consumer<UriComponentsBuilder> builderCallback) {
    return createObservable(() -> {
        UriComponentsBuilder builder = UriComponentsBuilder.fromUri(this.root);
        builderCallback.accept(builder);
        URI uri = builder.build().toUri();

        RequestEntity<T> requestEntity = new RequestEntity<T>(request, headers, HttpMethod.PUT, uri);
        this.logger.debug("{} {}", method, uri);
        return this.restOperations.exchange(requestEntity, responseType);
    });/*from   ww  w.j  a  va2  s . c o m*/
}

From source file:svc.data.citations.datasources.tyler.TylerCitationDataSource.java

@Override
public List<Citation> getByNameAndMunicipalitiesAndDOB(String lastName, List<Long> municipalities,
        LocalDate dob) {/*w w w .  j a v  a 2  s  .  co m*/
    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(tylerConfiguration.rootUrl)
            .queryParam("lastName", lastName).queryParam("dob", dob.format(dobFormatter));

    return performRestTemplateCall(builder.build().encode().toUri());
}

From source file:ca.qhrtech.services.implementations.BGGServiceImpl.java

private URI buildUriForLink(long bggId) {
    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(BASE_BGG_URL + END_POINT_LINK);
    builder.queryParam("id", bggId);
    builder.queryParam("type", "boardgame");
    return builder.build().encode().toUri();
}