• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Handling request parameters

 
Jari Timonen
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody,

Is it possible to handle request-parameters in ServletFilter before they're sent to servlet?



Since String is immutable - I can't just go and change the value.
Mayby with extending HttpServletRequestWrapper ?
[ June 25, 2008: Message edited by: Jari Timonen ]
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can use inside filter.

you need to typecast ServletRequest to HttpServletRequest

then you can do your stuff //

Thanks & Regards,
seetharaman v
 
Jari Timonen
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by seetharaman venkatasamy:
you can use inside filter.

you need to typecast ServletRequest to HttpServletRequest

then you can do your stuff //

Thanks & Regards,
seetharaman v


There's no modification methods to request parameters in HttpServletRequest.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mayby with extending HttpServletRequestWrapper ?



You're correct.
Request parameters are read-only in HttpServletRequest.

If, by 'handling', you mean altering, then yes wrapping the request and adding your own methods is typically how this is done.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic