Results 1 to 1 of 1

Thread: For a POST request how to get the @Requestbody details in the interceptor.

  1. #1
    Join Date
    Oct 2012
    Posts
    1

    Question For a POST request how to get the @Requestbody details in the interceptor.

    Hi,

    Question : In my interceptor how do I get the post request details (payload details) that is annotated with @Requestbody, so that I can perform some operation on the data of the request body that is passed.

    Below is the code my code sample.

    I have an interceptorbelow code)

    public class TestInterceptor extends HandlerInterceptorAdapter {

    @Override
    public boolean preHandle(HttpServletRequest request,
    HttpServletResponse response, Object handler) throws Exception {

    logger.info("Before handling the request");
    return super.preHandle(request, response, handler);
    }


    I have a contoller class as below

    @Controller
    public class TestController{

    @RequestMapping(method = RequestMethod.POST, value = "/Test")
    @ResponseBody
    public ResponseEntity<Source> getTestSearch(
    @RequestParam(required = false, value = "resultSetSize") Integer resultSetSize,
    @RequestBody Source request) {

    {
    //code
    }
    }


    Please provide a solution for this.

    Thanks
    Soumya
    Last edited by soumya.das; Oct 12th, 2012 at 02:35 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •