Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to insert a custom http header in a servlet filter?

843841Aug 9 2005 — edited Aug 11 2005
I need to insert a custom header (not an attribute) into the http request as it is processed by my servlet filter.

I've read in a few locations that you can achieve this by wrapping the request object in a class implementing HttpServletRequestWrapper and the calling:

chain.doFilter(new MyRequestWrapper((HttpServletRequest) request), response);

I have yet to find any information regarding how to insert the custom header request using the wrapper. If anyone has any idea how to achieve this it would be greatly appreciated.

H
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 8 2005
Added on Aug 9 2005
4 comments
1,325 views