Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpServletRequestWrapper won't return any getParamter value

 
Gihan Anuruddha
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic