I have to write a batchpost mechanism that allows our UI guys to do a single
POST to our servlet with a set of endpoints and data for it.
Imagine something like:
[
{url: /foo/a, data: {a: 1, b: 2}},
{url: /foo/b, data: {alfa: 1, test: 2}},
{url: /foo/c, data: {name: "Simon", b: 2}},
]
So what I did was the following:
Create a SlingHttpServletRequestWrapper and SlingHttpServletResponseWrapper
for each endpoint.
I've overriden the default servlet getParameter, getParameterNames, ...
methods and returned my own data for them.
The requests goes trough fine, but it uses the original request parameters
instead of the newly defined ones.
I guess I need to override the methods that return sling's
RequestParameter's as well as the request seems to be unwrapped in
RequestData.java (~420)
Now the entire mechanisme of setting request parameters is in the
implementation of the sling engine and I don't really know how to set these
in my bundle.
Is there an easier way of doing this kind of behavior or is this strongly
discouraged?
Kind regards,
Simon