Is there a way to call the getReader()
method on a HttpRequest
and then \"reset\" the request so other calls to getReader()
will not t
The simple answer is "No".
The stream is not resettable and there's no API method that will allow you to reopen it. (And for good reason. It would require the servlet infrastructure to keep a copy of the input just in case the servlet decided to reopen the stream. That would be an unwarranted overhead.)
If you want to do this kind of thing, you will need to write your code to keep its own copy of the data. If you are implementing this in a Filter (or a Tomcat Valve) then you could create a HttpServletRequestWrapper
to hide the fact that you've already read the data .... as suggested by @Vineet.