Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

encryption servlet filter

 
peter cooke
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello;
I am writing a servlet filter that decrypts parameter=value on the way in, and encrypts things on the way out.

I can find lots of things on the internet that say this is what servlet filters are ment to do.

I can get the request parameter/values then encrypt/decrypt the name-value pair.

I am missing how to swap out the old parameter name-value pair for the new parameter name-value pair in the request. I don't want to change my parameters to attributes, because so many other classes depend on getParameter.

Any Suggestions
 
Darren Edwards
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are not allowed to set parameters directly, but you can work around this.

Write your own wrapper subclass of HttpServletRequest that overrides the getParameter/s method/s. Your subclassed version can return the encrypted values either on the fly or from a precomputed cache.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic