File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Add field in Http header in request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Add field in Http header in request" Watch "Add field in Http header in request" New topic

Add field in Http header in request

james goyal

Joined: Mar 11, 2008
Posts: 1
I want to add some fields in requesting header in my JSP and then want to get it in servlet.But i couldn't find any addheader method in httpServletRequest. So could any one tell me that how can fields can be added in header in request.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1506
You cannot change the headers sent with the request. What type of fields are these, and why can't you pass them via form parameters?

So much trouble in the world -- Bob Marley
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12675
You can't meddle with existing headers in a HttpServletRequest, however you can add arbitrary "attributes" which will be preserved when forwarding the request to a servlet. See the setAttribute and getAttribute methods in the ServletRequest interface.


Java Resources at
I agree. Here's the link:
subject: Add field in Http header in request
Similar Threads
Adding authorization to access webservice
HTTP object?
Adding custom Header information to the HttpServletRequest object
How to add Cookie http header in the soap request
SOAP header in SOAP request