I guess the method getInputStream is used for the developers who want to
handle the request block themselves. Maybe the server could call some
low-level methods in the implementation of the HttpServletRequest for
request parsing.
I suggest you could use the network monitor tool to log the request block.
If you really want to do it in the server itself, maybe a third pary request
parser is needed,such as commons-fileupload.
I suppose the steps below could fulfill your requirements:
1. First using your current wrapper request to log the data
2. Pass your wrapper request to the commons-fileupload. maybe use new  *
ServletFileUpload**<http://commons.apache.org/fileupload/apidocs/org/apache/commons/fileupload/servlet/ServletFileUpload.html#ServletFileUpload%28%29>
*() .parse(yourwrapperRequest)
3. For the method parse above returns a list object, you need to write
another wrapper request, and overwrite some method in it (such as
getParameter) to make your application works as usual




2008/9/12 Marco Laponder <[EMAIL PROTECTED]>

> Hi All,
>
> I am trying to create a servlet filter to monitor the requests on my web
> application.
>
> I would like to record the URI and query string and I have accomplished
> this without any problems. But when I added code to log the posted data
> this results in some problems.
>
> I read the posted data from the input stream of the request and copy
> these contents to file. So far so good. But when my web application code
> is executing it is missing all the data from the post in the parameter
> map returned by the getParameterMap() function on the request, I suspect
> because I have read all the data from the input stream of the request.
>
> I tried to solve it by calling the doFilter on the chain with a wrapper
> request with a custom getInputStream method where I return my own
> servlet inputstream containing the data I had read from the original
> inputstream, but the getInpustream is never called on my wrapper.
>
> Can anyone provide me with some insight how to accomplish such a logging
> and what I am doing wrong in the structure above ?
>
> Kind regards,
> Marco Laponder
>
>
>
>
>
>


-- 
Ivan

Reply via email to