I am trying to redirect a request from one controller to another controller and set the object in the request so that the forwarded controller can use it in @RequestBody.
Below is the exact scenario:
Twilio calls the controller method with the data sent by the client, as follows:
@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 redirect this request to an ActivityController, which is already processing a request from network / leisure clients. ActivityController.java has a method with the following signature:
@RequestMapping(value = "/activity/new", method = RequestMethod.POST)
public ResponseEntity<Activity> updateLocation(
@RequestBody Activity activity) {
}
Is it possible? If so, how?
Thanks,
source
share