Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Please explain RestTemplate [closed]

I have a class

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

What is RestTemplate used for?

like image 889
Some Java Guy Avatar asked Jan 18 '11 06:01

Some Java Guy


1 Answers

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/

like image 128
uncaught_exceptions Avatar answered Sep 18 '22 14:09

uncaught_exceptions