I am developing a HttpServlet
that handles a POST request from an application that includes parameters on the query string, and a JSON object in the body. It is not a form post, the entire body is the JSON object. I understand that I need to use HttpServletRequest.getReader()
to read the body. But I also need to use HttpServletRequest.getParameter()
to get the query parameters. And I understand that both can not be used.
I think the intended solution is to create a HttpServletRequestWrapper
and override getReader()
in such a way as to allow it to be called more than once. But I can't figure out how to do that. Or maybe this is not the intended approach. All the examples of HttpServletRequestWrapper
that I can find seem to be related to creating filters and modifying the contents of the request.
Any help is greatly appreciated.
BTW, this is hosted on Google App Engine, but I don't think that will affect the solution.