如何将HttpServletResponse赋值给feign中的 Response
时间: 2023-10-16 10:03:08 浏览: 172
在使用Feign进行远程调用时,如果需要将HttpServletResponse的值赋给Feign中的Response,可以通过以下步骤实现:
1. 在主线程中获取当前的HttpServletResponse对象,并保存为一个变量。可以使用RequestContextHolder.getRequestAttributes()方法获取RequestAttributes对象,再通过RequestAttributes的getAttribute()方法获取HttpServletResponse对象的引用。<em>1</em><em>2</em><em>3</em>
#### 引用[.reference_title]
- *1* *2* [订单服务篇-Feign远程调用丢失请求头和异步编排下丢失上下文](https://blog.csdn.net/Simon_09010817/article/details/118182422)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item]
- *3* [使用wireshark抓包,验证feign http请求的数据透传结果](https://blog.csdn.net/zhuganlai168/article/details/131673732)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item]
[ .reference_list ]
阅读全文