本文介绍了请说明RestTemplate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我上课

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

RestTemplate的用途是什么?

What is RestTemplate used for?

推荐答案

我假设您了解spring模板的概念. (基于具有相同名称的设计专利). RestTemplate是用于进行HTTP REST调用(REST客户端)的模板.

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).

如果要进行HTTP调用,则需要创建HttpClient,传递请求和(或)表单参数,设置接受标头并执行反编组(全部由Spring Rest模板自行完成),从您那里提取所有这些详细信息.

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/

这篇关于请说明RestTemplate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 05:57