• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

setting http request headers

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why?
 
Suma Chandran
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 489
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic