• Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet Filtering - Modify Request object

 
Pearlo Muthukumaran
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a requirement as following:
1. Client sends a application/octetstream type of request to a servlet
2. Servlet must
a. save the content of request in a file and
b. esacalate only the file information and
other details of request parameters
formatted as XML String to the EJb Layer.
For meeting requirement 2.a I am planning to write a Servlet Filter so that the servlet code remains cleaner. And the saving function can be replaced later with a XML transformation + saving with just one more filter added and configured.
This obviously requires the request object to be completely changed at the Request wrapper. How to accomplish this?
Regards
Muthu
 
Phil Chuang
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't change the Request object, other than setting Attributes. I ran into this problem a while back, my solution was to make a filter that would strip out everything from the Request's parameters, put it in a HashMap (may need a wrapper depending on your functionality), then have every servlet use that HashMap to get input from.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!