Replies: 1 comment
-
|
org.apache.dubbo.remoting.http12.message.DefaultHttpRequest#setInputStream |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Pre-check
Apache Dubbo Component
Java SDK (apache/dubbo)
Details
背景:
1.项目使用springboot+dubbo3,搭建工程,接受处理Post+json的请求,定义的controller如下:
ps:The project uses springboot+dubbo3 to build a project, accept and process Post+json requests, and the controller is defined as follows:
/**
* test
*
* @return
*/
@PostMapping("/api/test.go")
@OverRide
public Response testMethod(HttpServletRequest request) {
xxxxxxxx;
}
3.filter定义如下:
public class DubboServeFilter implements Filter {
}
需求问题:想在filter中统一打印请求的 body数据,如果通过下面stream获取,则controller中获取不到body数据,请问改如何获取数据
ps:Requirement question: I want to print the body data of the request uniformly in the filter. If I get it through the following stream, the body data cannot be obtained in the controller. How can I get the data instead?
String jsonBody = new BufferedReader(request.getReader())
.lines()
.collect(Collectors.joining());
return JSONObject.parseObject(jsonBody);
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions