Examples of postForObject()


Examples of org.springframework.web.client.RestTemplate.postForObject()

      template.setMessageConverters(messageConverters);
         //now we need to add the parameters
      String apiKey = this.searchConfigRetriever.getArbitrary("googleAPIKey");

       LinkShortenRequestGoogle postObject = new LinkShortenRequestGoogle(longUrl);
       LinkShortenReturnGoogle result = template.postForObject(url + apiKey, postObject, LinkShortenReturnGoogle.class);

       return result.getId();
    }
}
View Full Code Here

Examples of org.springframework.web.client.RestTemplate.postForObject()

        headers.setContentType(MediaType.APPLICATION_JSON);
        headers.setAccept(Lists.newArrayList(MediaType.APPLICATION_JSON));

        HttpEntity<String> entity = new HttpEntity<String>(serializedClient, headers);

        String registered = restTemplate.postForObject(serverConfig.getRegistrationEndpointUri(), entity, String.class);
        // TODO: handle HTTP errors

        RegisteredClient client = ClientDetailsEntityJsonProcessor.parseRegistered(registered);

        // save this client for later
View Full Code Here

Examples of org.springframework.web.client.RestTemplate.postForObject()

    }

    form.add("token", accessToken);

    try {
      validatedToken = restTemplate.postForObject(introspectionUrl, form, String.class);
    } catch (RestClientException rce) {
      logger.error("validateToken", rce);
    }
    if (validatedToken != null) {
      // parse the json
View Full Code Here

Examples of org.springframework.web.client.RestTemplate.postForObject()

      } else if (serverConfiguration.getUserInfoTokenMethod().equals(UserInfoTokenMethod.FORM)) {
        MultiValueMap<String, String> form = new LinkedMultiValueMap<String, String>();
        form.add("access_token", token.getAccessTokenValue());
       
        RestTemplate restTemplate = new RestTemplate(factory);
        userInfoString = restTemplate.postForObject(serverConfiguration.getUserInfoUri(), form, String.class);
      } else if (serverConfiguration.getUserInfoTokenMethod().equals(UserInfoTokenMethod.QUERY)) {
        URIBuilder builder = new URIBuilder(serverConfiguration.getUserInfoUri());
        builder.setParameter("access_token",  token.getAccessTokenValue());
       
        RestTemplate restTemplate = new RestTemplate(factory);
View Full Code Here

Examples of org.springframework.web.client.RestTemplate.postForObject()

    logger.debug("form = " + form);

    String jsonString = null;

    try {
      jsonString = restTemplate.postForObject(serverConfig.getTokenEndpointUri(), form, String.class);
    } catch (HttpClientErrorException httpClientErrorException) {

      // Handle error

      logger.error("Token Endpoint error response:  "
View Full Code Here

Examples of org.springframework.web.client.RestTemplate.postForObject()

        //对请求参数列表进行签名
        String sign = RopUtils.sign(form.toSingleValueMap(), "abcdeabcdeabcdeabcdeabcde");
        form.add("sign", sign);

        String response = restTemplate.postForObject(
                SERVER_URL, form, String.class);
        System.out.println("response:\n" + response);
//        assertTrue(response.indexOf("<logonResponse sessionId=\"mockSessionId1\"/>") > -1);
    }
View Full Code Here

Examples of org.springframework.web.client.RestTemplate.postForObject()

        //对请求参数列表进行签名
        String sign = RopUtils.sign(form.toSingleValueMap(), "abcdeabcdeabcdeabcdeabcde");
        form.add("sign", sign);

        String response = restTemplate.postForObject(
                SERVER_URL, form, String.class);
        System.out.println("response:\n" + response);
        assertTrue(response.indexOf("<createUserResponse") > -1);
    }
View Full Code Here

Examples of org.springframework.web.client.RestTemplate.postForObject()

        //对请求参数列表进行签名
        String sign = RopUtils.sign(form.toSingleValueMap(), "abcdeabcdeabcdeabcdeabcde");
        form.add("sign", sign);

        String response = restTemplate.postForObject(
                SERVER_URL, form, String.class);
        System.out.println("response:\n" + response);
        assertTrue(response.indexOf("code=\"" + MainErrorType.METHOD_OBSOLETED.value() + "\"") > -1);
    }
View Full Code Here

Examples of org.springframework.web.client.RestTemplate.postForObject()

        form.add("salary", "2,500.00");

        //对请求参数列表进行签名
        String sign = RopUtils.sign(form.toSingleValueMap(), "abcdeabcdeabcdeabcdeabcde");
        form.add("sign", sign);
        String response = restTemplate.postForObject(
                SERVER_URL, form, String.class);
        System.out.println("response:\n" + response);
        assertTrue(response.indexOf("{\"userId\":\"1\",") > -1);
    }
View Full Code Here

Examples of org.springframework.web.client.RestTemplate.postForObject()

        //对请求参数列表进行签名
        String sign = RopUtils.sign(form.toSingleValueMap(), "abcdeabcdeabcdeabcdeabcde");
        form.add("sign", sign);

        String response = restTemplate.postForObject(
                SERVER_URL, form, String.class);
        System.out.println("response:\n" + response);
        assertTrue(response.indexOf("<createUserResponse ") > -1);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.