RestTemplate
文章平均质量分 95
字母哥哥
百人团队技术经理。2017年度吉林省软件行业协会“最卓越程序员奖”获得者。曾就职于微软,微软MVP。华为云享专家。
展开
-
精讲RestTemplate第1篇-在Spring或非Spring环境下如何使用
一、什么是 RestTemplate?RestTemplate是执行HTTP请求的同步阻塞式的客户端,它在HTTP客户端库(例如JDK HttpURLConnection,Apache HttpComponents,okHttp等)基础封装了更加简单易用的模板方法API。也就是说RestTemplate是一个封装,底层的实现还是java应用开发中常用的一些HTTP客户端。但是相对于直接使用底层的HTTP客户端库,它的操作更加方便、快捷,能很大程度上提升我们的开发效率。RestTemplate作为spri原创 2020-07-31 07:57:43 · 1845 阅读 · 0 评论 -
精讲RestTemplate第2篇-多种底层HTTP客户端类库的切换
本文是精讲RestTemplate第2篇,前篇的blog访问地址如下:精讲RestTemplate第1篇-在Spring或非Spring环境下如何使用RestTemplate只是对其他的HTTP客户端的封装,其本身并没有实现HTTP相关的基础功能。其底层实现是可以配置切换的,我们本小节就带着大家来看一下RestTemplate底层实现,及如何实现底层基础HTTP库的切换。一、源码分析RestTemplate有一个非常重要的类叫做HttpAccessor,可以理解为用于HTTP接触访问的基础类。下原创 2020-08-03 07:22:20 · 1805 阅读 · 0 评论 -
精讲RestTemplate第3篇-GET请求使用方法详解
本文是精讲RestTemplate第3篇,前篇的blog访问地址如下:精讲RestTemplate第1篇-在Spring或非Spring环境下如何使用精讲RestTemplate第2篇-多种底层HTTP客户端类库的切换RestTemplate可以发送HTTP GET请求,经常使用到的方法有两个:getForObject()getForEntity()二者的主要区别在于,getForObject()返回值是HTTP协议的响应体。getForEntity()返回的是ResponseEntit原创 2020-08-05 07:58:36 · 12350 阅读 · 0 评论 -
精讲RestTemplate第4篇-POST请求方法使用详解
本文是精讲RestTemplate第4篇,前篇的blog访问地址如下:精讲RestTemplate第1篇-在Spring或非Spring环境下如何使用精讲RestTemplate第2篇-多种底层HTTP客户端类库的切换精讲RestTemplate第3篇-GET请求使用方法详解如果您阅读完本文章,觉得对您有帮助,请帮忙点个赞,您的支持是我不竭的创作动力在上一节为大家介绍了RestTemplate的GET请求的两个方法:getForObject()和getForEntity()。其实POST请求方原创 2020-08-09 08:56:31 · 9358 阅读 · 1 评论 -
精讲RestTemplate第5篇-DELETE、PUT等请求方法使用详解
本文是精讲RestTemplate第5篇,前篇的blog访问地址如下:精讲RestTemplate第1篇-在Spring或非Spring环境下如何使用精讲RestTemplate第2篇-多种底层HTTP客户端类库的切换精讲RestTemplate第3篇-GET请求使用方法详解精讲RestTemplate第4篇-POST请求方法使用详解为了方便后续开发测试,首先介绍一个网站给大家。JSONPlaceholder是一个提供免费的在线REST API的网站,我们在开发时可以使用它提供的url地址测原创 2020-08-10 12:15:52 · 8195 阅读 · 1 评论 -
精讲RestTemplate第6篇-文件上传下载与大文件流式下载
本文是精讲RestTemplate第6篇,前篇的blog访问地址如下:精讲RestTemplate第1篇-在Spring或非Spring环境下如何使用精讲RestTemplate第2篇-多种底层HTTP客户端类库的切换精讲RestTemplate第3篇-GET请求使用方法详解精讲RestTemplate第4篇-POST请求方法使用详解精讲RestTemplate第5篇-DELETE、PUT等请求方法使用详解RestTemplate是HTTP客户端库,所以为了使用RestTemplate进行文原创 2020-08-12 07:37:21 · 5177 阅读 · 0 评论 -
精讲RestTemplate第7篇-自定义请求失败异常处理
本文是精讲RestTemplate第7篇,前篇的blog访问地址如下:精讲RestTemplate第1篇-在Spring或非Spring环境下如何使用精讲RestTemplate第2篇-多种底层HTTP客户端类库的切换精讲RestTemplate第3篇-GET请求使用方法详解精讲RestTemplate第4篇-POST请求方法使用详解精讲RestTemplate第5篇-DELETE、PUT等请求方法使用详解精讲RestTemplate第6篇-文件上传下载与大文件流式下载一、异常现象在使用原创 2020-08-14 07:13:56 · 3351 阅读 · 0 评论 -
精讲RestTemplate第8篇-请求失败自动重试机制
本文是精讲RestTemplate第8篇,前篇的blog访问地址如下:精讲RestTemplate第1篇-在Spring或非Spring环境下如何使用精讲RestTemplate第2篇-多种底层HTTP客户端类库的切换精讲RestTemplate第3篇-GET请求使用方法详解精讲RestTemplate第4篇-POST请求方法使用详解精讲RestTemplate第5篇-DELETE、PUT等请求方法使用详解精讲RestTemplate第6篇-文件上传下载与大文件流式下载精讲RestTempl原创 2020-08-15 10:48:20 · 5566 阅读 · 1 评论 -
精讲RestTemplate第9篇-如何通过HTTP Basic Auth认证
本文是精讲RestTemplate第9篇,前篇的blog访问地址如下:精讲RestTemplate第1篇-在Spring或非Spring环境下如何使用精讲RestTemplate第2篇-多种底层HTTP客户端类库的切换精讲RestTemplate第3篇-GET请求使用方法详解精讲RestTemplate第4篇-POST请求方法使用详解精讲RestTemplate第5篇-DELETE、PUT等请求方法使用详解精讲RestTemplate第6篇-文件上传下载与大文件流式下载精讲RestTempl原创 2020-08-16 13:54:54 · 8446 阅读 · 1 评论 -
精讲RestTemplate第10篇-使用代理作为跳板发送请求
如何在使用RestTemplate发送请求的时候使用代理Proxy。原创 2020-08-18 06:30:10 · 3663 阅读 · 1 评论