I'm trying to forward a request from one controller to another controller and set a object in request so that the forwarded controller can use it in @RequestBody.
Following is the exact scenario:
Twilio calls a controller method with data sent by client as following:
@RequestMapping(value = "/sms", method = RequestMethod.POST)
public String receiveSms(@RequestParam("Twiml") String twiml,
HttpServletRequest request,
HttpServletResponse response) {
//TODO - Create new instance of Activity and populate it with data sent from client
return "forward:/activity/new";
}
Now, I want to forward this request to ActivityController which already handles the request from web/rest clients. ActivityController.java has a method with following signature:
@RequestMapping(value = "/activity/new", method = RequestMethod.POST)
public ResponseEntity<Activity> updateLocation(
@RequestBody Activity activity) {
}
Is it possible? If yes, how?
Thanks,