I need to read the request payload in one of my GenericFilterBean
.
Beacuse I cannot call getreader twice I used ContentCachingRequestWrapper
like-
HttpServletRequest httpRequest = (HttpServletRequest) request;
ContentCachingRequestWrapper cachedRequest = new ContentCachingRequestWrapper(httpRequest);
Getting the request body-
String payload = cachedRequest.getReader().lines().collect(Collectors.joining());
And chaining the request-
chain.doFilter(cachedRequest, response);
But still my controller throws-
.w.s.m.s.DefaultHandlerExceptionResolver : Resolved exception caused by handler execution: org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing: public org.springframework.http.ResponseEntity<?> com.siemens.plm.it.sf.api.controllers.OrderController.createCCOrder(com.siemens.plm.it.de.ms.provisioning.model.sap.SapQuoteCreationArgument,javax.servlet.http.HttpServletRequest) throws java.lang.Exception
Ant ideas on how to chain the request so I can read the payload in the controller as well?
Thank you.