• Post Reply Bookmark Topic Watch Topic
  • New Topic

HttpServletResponseWrapper and error page  RSS feed

 
sakuja jangra
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Techies,
Problem: I want to intercept every request and response and check for some characters for their absence(to prevent cross site scripting). the problem is if I find any such character I want to throw some exception. I created a wrapper class extending HttpServletResponseWrapper class and I want to configure error pages if I find some exception in any methods that I m overriding like getParameters etc. and then I will use this class as request in Filter class. but I m unable to configure error page in such situation or even handle exceptions coz the signature of methods like getParameter() isnt handling exceptions.

Please guide with better approach or links I m missing in this implementation.
TIA
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wouldn't throw exceptions or create wrappers in this case. If you detect error conditions, set some appropriate request attributes, and let the main servlet code handle it.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66158
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"coz" is not a real word. Please be sure to use only real words when posting to the forums. Please read this for more information.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!