I want to dump some requests (like javax.servlet.http.HttpServletRequest ) into a file and then play them from the file so that I can test future changes in the HttpServlet . What is the best way to accomplish this?
So far, I am trying to extract data from the input stream associated with the request and save this binary data to a file. Ultimately, this may require something like storing bytes in front of each stored input stream, so I know where one request ends and another begins.
Is there an easier way to do this?
** EDIT: for clarification, these are not browser related queries. So far, none of the answers solve my specific problem, which, I believe, comes down to serializing and deserializing the HttpServletRequest. I tried just pulling bytes from the input stream returned by request.getInputStream (). Unfortunately, if I turn this into a string, it seems that the resulting bytes cannot be parsed by Message.Builder.mergeFrom (bytes).
I offer generosity to everyone who knows how to solve my problem.
java servlets
jonderry
source share