MaxExplode
MaxExplode

Reputation: 2007

get the http post request body before jackson invocation in spring

i want to know is there a way to get the HttpServletRequest body before any Jackson involvement in spring. I tried it with @JsonDeserializer and spring HandlerInterceptorAdapter and also with a HttpRequestWrapper but no luck for now. if anyone knows please suggest me a way to do this thanks.

Upvotes: 0

Views: 717

Answers (1)

Darshan Mehta
Darshan Mehta

Reputation: 30839

You can add a custom Filter in the application (explained here) and override doFilter method. E.g.:

public void doFilter(
      ServletRequest request, 
      ServletResponse response,
      FilterChain chain){
       ....
}

This would give you the request object from which, you can get the payload.

Upvotes: 2

Related Questions