Example usage for org.springframework.util LinkedMultiValueMap LinkedMultiValueMap

List of usage examples for org.springframework.util LinkedMultiValueMap LinkedMultiValueMap

Introduction

In this page you can find the example usage for org.springframework.util LinkedMultiValueMap LinkedMultiValueMap.

Prototype

public LinkedMultiValueMap() 

Source Link

Document

Create a new LinkedMultiValueMap that wraps a LinkedHashMap .

Usage

From source file:io.syndesis.credential.BaseCredentialProviderTest.java

@Test
public void shouldGenerateCallbackUrlWithParameters() {
    final MultiValueMap<String, String> some = new LinkedMultiValueMap<>();
    some.set("param1", "value1");
    some.set("param2", "value2");

    assertThat(BaseCredentialProvider.callbackUrlFor(URI.create("https://syndesis.io/api/v1/"), some))
            .as("The computed callback URL is not as expected")
            .isEqualTo("https://syndesis.io/api/v1/credentials/callback?param1=value1&param2=value2");
}

From source file:org.n52.io.request.QueryParameters.java

public static IoParameters createFromQuery(Map<String, String> query) {
    MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
    parameters.setAll(query);/*from   www.j  a v a  2s. com*/
    return createFromQuery(parameters);
}

From source file:org.jnrain.mobile.accounts.kbs.KBSLoginRequest.java

@Override
public SimpleReturnCode loadDataFromNetwork() throws Exception {
    MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
    params.set("uid", _uid);
    params.set("psw", _password);

    HttpHeaders headers = new HttpHeaders();
    headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
    HttpEntity<MultiValueMap<String, String>> req = new HttpEntity<MultiValueMap<String, String>>(params,
            headers);/*from ww  w .  j av  a2s. c  o m*/

    return getRestTemplate().postForObject(
            /* "http://rhymin.jnrain.com/api/login/", */
            "http://bbs.jnrain.com/rainstyle/apilogin.php", req, SimpleReturnCode.class);
}

From source file:com.miserablemind.api.consumer.tradeking.api.impl.BaseTemplate.java

URI buildUri(String path, String parameterName, String parameterValue) {
    MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
    parameters.set(parameterName, parameterValue);
    return this.buildUri(path, parameters);
}

From source file:org.mifos.androidclient.net.services.LoginService.java

public SessionStatus logIn(String userName, String password) {
    MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
    params.add(USERNAME_KEY, userName);//ww  w  .  j  a  v a2  s .  c  o m
    params.add(PASSWORD_KEY, password);
    params.add(SPRING_REDIRECT_KEY, STATUS_PATH);

    String url = getServerUrl() + LOGIN_PATH;

    return mRestConnector.postForObject(url, params, SessionStatus.class);
}

From source file:org.agorava.yammer.impl.SearchServiceImpl.java

public SearchResults search(String searchString, int page, int numberPerPage) {
    MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
    params.set("search", searchString);
    params.set("page", String.valueOf(page));
    params.set("number_per_page", String.valueOf(numberPerPage));
    return restTemplate.getForObject(buildUri("search.json", params), SearchResults.class);
}

From source file:org.openlmis.fulfillment.service.request.RequestParameters.java

private RequestParameters() {
    params = new LinkedMultiValueMap<>();
}

From source file:de.loercher.localpress.integration.GeoAndRatingITest.java

@Test
public void testAddArticle() {
    String nowString = "2015-10-12T08:00+02:00[Europe/Berlin]";
    ZonedDateTime now = new DateTimeConverter().fromString(nowString);

    AddArticleEntityDTO geoDTO = new AddArticleEntityDTO(nowString);
    Instant instant = now.toInstant();
    Instant fir = Instant.now();

    MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
    headers.add("UserID", "ulf");

    HttpEntity<AddArticleEntityDTO> request = new HttpEntity<>(geoDTO, headers);

    RestTemplate template = new RestTemplate();
    ResponseEntity<Map> result = template.postForEntity("http://52.29.77.191:8080/localpress/feedback", request,
            Map.class);

    Instant afterRating = Instant.now();

    GeoBaseEntity.EntityBuilder builder = new GeoBaseEntity.EntityBuilder();
    GeoBaseEntity entity = builder.author("ulf")
            .coordinates(Arrays.asList(new Coordinate[] { new Coordinate(50.1, 8.4) }))
            .timestamp(now.toEpochSecond()).content("abc.de").title("mein titel").user("ulf").build();

    HttpEntity<GeoBaseEntity> second = new HttpEntity<>(entity, headers);
    System.out.println(result.getBody().get("articleID"));

    template.put("http://euve33985.vserver.de:8080/geo/" + result.getBody().get("articleID"), second);

    Instant afterGeoPut = Instant.now();

    result = template.getForEntity("http://euve33985.vserver.de:8080/geo/" + result.getBody().get("articleID"),
            Map.class);

    Instant afterGeoGet = Instant.now();

    assertEquals("User ID has changed over time!", "ulf", result.getBody().get("user"));
    assertEquals("Content URL has changed over time!", "abc.de", result.getBody().get("content"));

    DateTimeConverter conv = new DateTimeConverter();

    Duration first = Duration.between(fir, afterRating);
    Duration sec = Duration.between(afterRating, afterGeoPut);
    Duration third = Duration.between(afterGeoPut, afterGeoGet);

    System.out.println("Begin: " + conv.toString(now));
    System.out.println("Time until POST to rating: " + new Double(first.toMillis()) / 1000);
    System.out.println("Time until PUT to geo: " + new Double(sec.toMillis()) / 1000);
    System.out.println("Time until GET to geo: " + new Double(third.toMillis()) / 1000);
}

From source file:com.folion.social.CouchbaseConnectionRepository.java

@Override
public MultiValueMap<String, Connection<?>> findAllConnections() {

    return new LinkedMultiValueMap<>();
}

From source file:io.cfp.auth.service.ReCaptchaService.java

public boolean isCaptchaValid(String response) {
    MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
    map.add("secret", recaptchaSecret);
    map.add("response", response);

    @SuppressWarnings("unchecked")
    Map<String, Object> result = restTemplate.postForObject(RECAPTCHA_VERIF_URL, map, Map.class);

    return (boolean) result.get("success");
}