7

I have a class

public class Client extends RestTemplate
// org.springframework.web.client.RestTemplate

What is RestTemplate used for?

Sean Patrick Floyd
  • 292,901
  • 67
  • 465
  • 588
Some Java Guy
  • 4,992
  • 19
  • 71
  • 108
  • 5
    Did you have look at the [RestTemplate JavaDoc](http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/web/client/RestTemplate.html) already? – Andreas Dolk Jan 18 '11 at 06:58
  • You can visit bellow thread. It has full working code with description: https://stackoverflow.com/a/51805956/3073945 – Md. Sajedul Karim Aug 12 '18 at 05:36

1 Answers1

22

I assume you understand the concept of templating in spring. (its based on a design patten with the same name). RestTemplate is a template used to make HTTP Rest Calls (REST Client).

If you want to make a HTTP Call, you need to create a HttpClient, pass request and (or) form parameters, setup accept headers and perform unmarshalling of response, all by yourself, Spring Rest Templates, tries to take the pain away by abstracting all these details from you.

http://blog.springsource.com/2009/03/27/rest-in-spring-3-resttemplate/

Sean Patrick Floyd
  • 292,901
  • 67
  • 465
  • 588
uncaught_exceptions
  • 21,712
  • 4
  • 41
  • 48