Hi,
Is anyone able to help me with using the OAuth2RestTemplate with post parameters?
I found a blog post at http://lkonopski.blogspot.com.au/2012/05/using-spring-resttemplate-with.html?m=1
that shows how to do this with the RestTemplate:
However I'm unsure what form the parameters need to take in the HttpEntity constructor.Code:HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); HttpEntity req = new HttpEntity<>(urlEncodeYourParams(), headers); RestTemplate rest = new RestTemplate(); ResponseEntity result = rest.postForEntity(address, req, String.class); System.out.println( result.getBody() );
Is anyone able to offer any examples or suggestions?
Many thanks in advance,
Andrew.


Reply With Quote