Using ContentCachingRequestWrapper causes Empty Parameters Map

前端 未结 2 602
野的像风
野的像风 2021-01-14 18:12

I have implemented a Filter, in which I want to read the content of request first for some checks and then I would like to go on.

But the problem is, that in the fol

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-14 19:05

    Please try the two proposed solutions mentioned below:
    1. HttpServletRequestWrapper servletRequest = new ContentCachingRequestWrapper(req);
    OR
    2. ContentCachingRequestWrapper servletRequest = new ContentCachingRequestWrapper(req);
    Instead of HttpServletRequest servletRequest = new ContentCachingRequestWrapper(req);
    As you can check here that ContentCachingRequestWrapper class extends HttpServletRequestWrapper which extends ServletRequestWrapper and implements HttpServletRequest.
    So here by performing upcasting, you are may be facing this issue. Please check and let me know if this is not the case, then I will debug it further.

提交回复
热议问题