File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Regarding request/response header processing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Regarding request/response header processing " Watch "Regarding request/response header processing " New topic

Regarding request/response header processing

Dinesh Sarkar

Joined: Aug 25, 2009
Posts: 2

Hi, I am working in a project where I have been asked to either add some new headers in request(HttpServletRequest) or set new headers in response and then in some other resource fetch the newly set header values.
Can anybody please suggest ?

Many Thanks in advance .

Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
You cannot modify the request headers coming into you from the client (browser). However, you can modify and add headers in the response object.

So much trouble in the world -- Bob Marley
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

welcome to javaranch dinesh
Dinesh Sarkar

Joined: Aug 25, 2009
Posts: 2
Thanks Bosun. Actually my idea was like that.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
Take a look at the HttpServletRequestWrapper and Filter interfaces.

You can use a Filter to substitute a wrapped request to give the effect of modified request headers.

I agree. Here's the link:
subject: Regarding request/response header processing
It's not a secret anymore!