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

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

Introduction

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

Prototype

public static UriComponentsBuilder fromHttpUrl(String httpUrl) 

Source Link

Document

Create a URI components builder from the given HTTP URL String.

Usage

From source file:com.sojw.ahnchangho.core.util.UriUtils.java

/**
 * Of./*from w w  w.ja  v a  2  s .  c o  m*/
 *
 * @param url the url
 * @param queryParameters the query parameters
 * @return the uri
 */
public static URI of(String url, Map<String, String> queryParameters) {
    if (Strings.isNullOrEmpty(url)) {
        return null;
    }

    return UriComponentsBuilder.fromHttpUrl(url).queryParams(multiValueMap(queryParameters)).build().encode()
            .toUri();
}

From source file:io.pivotal.jira.JiraIssue.java

public static String getBrowserUrl(String baseUrl, String key) {
    return UriComponentsBuilder.fromHttpUrl(baseUrl).replacePath("/browse/").path(key).toUriString();
}

From source file:com.sojw.ahnchangho.core.util.UriUtils.java

/**
 * Of./*from w w  w  .j av a2s .c om*/
 *
 * @param url the url
 * @param pathVariables the path variables
 * @param queryParameters the query parameters
 * @return the uri
 */
public static URI of(String url, Map<String, String> pathVariables, Map<String, String> queryParameters) {
    if (Strings.isNullOrEmpty(url)) {
        return null;
    }

    return UriComponentsBuilder.fromHttpUrl(url).queryParams(multiValueMap(queryParameters))
            .buildAndExpand(pathVariables).encode().toUri();
}

From source file:com.pepaproch.gtswsdlclient.impl.AvailabilityCheckQueryBuilderImpl.java

@Override
public UriComponents buildQuery(String addrId) {
    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url);
    if (addrId != null && !addrId.isEmpty()) {
        builder.queryParam("uirAdr", addrId);
    }/*  ww  w  . j  a  v a  2 s  .c o m*/

    return builder.build();
}

From source file:com.pepaproch.gtswsdlclient.impl.AddrCheckQueryBuilderImpl.java

@Override
public UriComponents buildQuery(AddressQuery addresQuery) {
    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url);
    if (addresQuery.getCity() != null && !addresQuery.getCity().isEmpty()) {
        builder.queryParam("city", addresQuery.getCity());
    }/*  ww  w  .j a v  a  2 s .  c o m*/
    if (addresQuery.getHouseNumberReg() != null) {
        builder.queryParam("houseNumberReg", addresQuery.getHouseNumberReg());
    }
    if (addresQuery.getHouseNumberOr() != null) {
        builder.queryParam("houseNumberOr", addresQuery.getHouseNumberOr());
    }
    if (addresQuery.getStreet() != null && !addresQuery.getStreet().isEmpty()) {
        builder.queryParam("street", addresQuery.getStreet());
    }
    if (addresQuery.getZipCode() != null) {
        builder.queryParam("zipCode", addresQuery.getZipCode());
    }

    return builder.build();
}

From source file:com.pepaproch.gtswsdlclient.impl.AvailabilityCheckByPhoneQueryBuilderImpl.java

@Override
public UriComponents buildQuery(String phoneNumber) {
    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url);
    if (phoneNumber != null) {
        builder.queryParam(PHONE_FIELD_NAME, phoneNumber);
    }//from   w ww  . ja va 2s .c om

    return builder.build();
}

From source file:io.pivotal.jira.JiraUser.java

public String getBrowserUrl() {
    return UriComponentsBuilder.fromHttpUrl(self).replacePath("/secure/ViewProfile.jspa").replaceQuery("")
            .queryParam("name", key).toUriString();
}

From source file:de.blizzy.documentr.web.util.FacadeHostRequestWrapper.java

public static String buildFacadeUrl(String url, String contextPath, String documentrHost) {
    contextPath = StringUtils.defaultIfBlank(contextPath, StringUtils.EMPTY);
    if (contextPath.equals("/")) { //$NON-NLS-1$
        contextPath = StringUtils.EMPTY;
    }//from   ww w  .ja v  a 2s.  c  o m

    String newUrl;
    if (StringUtils.isNotBlank(contextPath)) {
        int pos = url.indexOf(contextPath);
        newUrl = documentrHost + url.substring(pos + contextPath.length());
    } else {
        UriComponentsBuilder builder;
        try {
            builder = UriComponentsBuilder.fromHttpUrl(url);
        } catch (IllegalArgumentException e) {
            builder = UriComponentsBuilder.fromUriString(url);
        }
        String path = StringUtils.defaultIfBlank(builder.build().getPath(), StringUtils.EMPTY);
        if (StringUtils.isNotBlank(path)) {
            int pos = StringUtils.lastIndexOf(url, path);
            newUrl = documentrHost + url.substring(pos);
        } else {
            newUrl = documentrHost;
        }
    }
    return newUrl;
}

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

@Override
public String getAppDashboardUrl(String appGuid) {
    UriComponentsBuilder urlBuilder = UriComponentsBuilder.fromHttpUrl(logServerUrl);
    urlBuilder.path(SEARCH_PATH);//from w  w w.ja  v  a  2  s  .  c o  m
    //uncomment to enable auto pause mode
    //urlBuilder.queryParam("auto_pause", "true");
    urlBuilder.queryParam("q", "search index=\"*\" source=\"tcp:12345\" appname=\"" + appGuid + "\"");
    return urlBuilder.build().encode().toUriString();
}

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

@Override
public PersonDto findById(long id) {
    UriComponentsBuilder uri = UriComponentsBuilder.fromHttpUrl("http://blue/blue/api/rest/person")
            .queryParam("id", id);
    return restTemplate.getForObject(uri.build().toUri(), PersonDto.class);
}