• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Question : In my interceptor how do I get the post request 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 interceptor:(below 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
rinku

 
reply
    Bookmark Topic Watch Topic
  • New Topic