How can I modify a Request object before passing it to another servlet?

Alex Chaffee

2.3 Servlets, doFilter(), and Request Headers If you've ever done NSAPI, you know that it gives you full access to the web server's processing of a request. One of the neat things it lets you do is modify/insert request headers. For example, you could look for a specific cookie in the request, and if it's there, insert an authorization header into the request, and then pass this modified request on to the rest of the web-server's normal processing (most importantly for this particular example, the authentication phase).

Are there any classes out there that let you do this sort of thing? It doesn't appear to me that the standard 2.3 doFilter() chaining scenario will work, as I can only manipulate the response headers. I'm thinking of developing something myself using lwj (libwww-java: http://lwj.sourceforge.net/.). Any advice/ideas about going down this road? Thanks!


You can do something like this in Servlets 2.3 by subclassing HttpRequestWrapper. See the Servlet 2.3 spec for more details.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact