Hi!
We have a web site with multiple pages each with lot of AJAX calls. All the Ajax calls go to a data proxy layer written in Spring 3 MVC application. In order to reduce the load on the server we are planning to aggregate calls on the client and send to the proxy layer.
For ex: we have two calls /controller1/action1 and /controller2/action2 in different controllers. I want to write an aggregate controller and call it from the client instead of making two calls to the individual controllers. Something like /aggregatecontroller/aggregate (and we will post the information regarding which calls are being aggregated and required parameters).
Is there any way we can call another controller/action from a controller/action and get output?
The flow will be something like this:
a. Call /aggregatecontroller/aggregate with info regd call1 and call2
b. aggregate action understands that it needs to aggregate call1 and call2
c. it calls /controller1/action1 and gets the response
d. it calls /controller2/action2 and gets the response
e. it merges both in a json response and sends it back to browser.
Please let me know if you have any suggestion regd how to do this or if you think there is a better approach to do the server side aggregation.
Thanks for your time.