I am trying to make a rest call using spring 4.1.0 RestTemplate but i dont see HttpEntity class.
HttpHeaders requestHeaders=new HttpHeaders();
requestHeaders.set("Content-Type", "application/json");
String str = new String();
HttpEntity<String> requestEntity=new HttpEntity<String>(str,requestHeaders);
RestTemplate restTemplate=new RestTemplate();
URI location = restTemplate.postForLocation("http://example.com", entity);
So there are 2 questions:
- How can i get access to HttpEntity class as its not found?
- how can i get the body or the response from URI?
Kindly suggest
Aucun commentaire:
Enregistrer un commentaire