Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding request/response header processing

 
Dinesh Sarkar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 .


Dinesh
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot modify the request headers coming into you from the client (browser). However, you can modify and add headers in the response object.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
welcome to javaranch dinesh
 
Dinesh Sarkar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bosun. Actually my idea was like that.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic