• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setting http request headers

 
Suma Chandran
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have deployed a servlet using Tomcat. I access this servlet using a html page where I type in the 2 parameters - id and name. I get these parameters in my servlet using "request.getParameter()".

Instead of using a html page, I would like to set "id" and "name" as http headers, so that I can access them in the servlet using "request.getHeader()" ? How can I go about doing that?

thanks.
Suma.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65124
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why?
 
Suma Chandran
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, some requirements which I have been given. I am perturbed about how I should be working on this ? Any suggestions ?

I would also like to add that, the servlet does some processing and displays the results in a jsp page. So as of now

html => servlet => jsp

I would like the servlet to get the header info and then proceed with the rest of the processing.
[ March 23, 2006: Message edited by: Suma Chandran ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65124
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no way for an HTML file to set the request headers. Your requirements cannot be met. Why on earth do they want to pass request parameters in the header?
 
ramprasad madathil
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Why on earth do they want to pass request parameters in the header?


That sounds more probably like Suma's solution to the requirements rather than the actual requirement itself. Suma, why don't you post the requirement itself and somebody here would suggest a different approach to solve it.

cheers,
ram.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have heard occasional objections to passing parameters in the URL of a GET request. Usually, changing the request to POST (which then sends the parameters in the body of the request) is enough to convince doubters.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic