aspose file tools*
The moose likes Servlets and the fly likes HttpServletRequestWrapper won't return any getParamter value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "HttpServletRequestWrapper won Watch "HttpServletRequestWrapper won New topic
Author

HttpServletRequestWrapper won't return any getParamter value

Gihan Anuruddha
Greenhorn

Joined: Sep 09, 2013
Posts: 2
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 ?

Filter


My extended HttpServletRequestWrapper class

William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
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.

Bill

Gihan Anuruddha
Greenhorn

Joined: Sep 09, 2013
Posts: 2
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HttpServletRequestWrapper won't return any getParamter value