سؤال

I have a class

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

What is RestTemplate used for?

هل كانت مفيدة؟

المحلول

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/

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top