码迷,mamicode.com
首页 > 其他好文 > 详细

RestTemplate 支持服务器内302重定向

时间:2018-01-21 10:58:13      阅读:1907      评论:0      收藏:0      [点我收藏+]

标签:uil   color   rate   style   重定向   服务   create   ack   bsp   

Stack Overflow 里找到的代码,可以正常返回服务器302重定向后的响应

final RestTemplate restTemplate = new RestTemplate();
final HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory();
final HttpClient httpClient = HttpClientBuilder.create()
        .setRedirectStrategy(new LaxRedirectStrategy())
        .build();
factory.setHttpClient(httpClient);
restTemplate.setRequestFactory(factory);

 

RestTemplate 支持服务器内302重定向

标签:uil   color   rate   style   重定向   服务   create   ack   bsp   

原文地址:https://www.cnblogs.com/sweetchildomine/p/8323440.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!