I want to log each request with request body to a file. So I used web filter and HttpServletRequestWrapper to achieve this task. But when I do any parameter request I'm not getting any value always. As example if I do req.getParamter("usrename") inside the servlet or even within the filter I'm not getting any value. Here are the code snippets I used in both filter and extended HttpServletRequestWrapper class. Can anyone tell me what is the wrong here. Really appreciate you help ?
These requests where you are unable to get the parameter - are they GET or POST requests?
Recall that for a POST, the parameters are in the body of the request.
Joined: Sep 09, 2013
Those are POST requests. Actually I realize that the wrapped http request object called when I invoke getParamter method. At that time I already used getInputStream method and there is no stream to return any parameter value. So now as a solution I start to overwrite all getParameter methods in side my custom HttpServletRequestWrapper class.