Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting HTTP headers.

 
Miro Mile
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have the following piece of code:

So I set the headers commented as 1 and 2. The first one - Refresh - works prefectly. The second one - Expires, doesn't get set, the req.getHeader (3) returns null.
I also tried setting it up with the setHeader method, using a String with a date format copied from the RFC - 'Thu, 01 Dec 1994 16:00:00 GMT'. Again, no result.
And there is one more thing - charset set with setContentType works perfectly. Although when I want to change the 'accept-charset' using the setHeader, nothing happens.
I am working on Tomcat 5.0.16.
Well, I'd be grateful for pointing out what is the problem. Why some headers (Refresh) get set, while the other (ex. Expires, Accept-Charset) don't.
rgds.
miro.
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This seems more like a straightforward Serlvets question than a Certification question, so I will move it appropriately.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks a lot as if you are setting headers in the response, and somehow expecting those headers to appear in the request. They are quite different things. Request headers are information sent from the browser for use by the server. Response headers are information sent from the server for use by the browser. Why would you expect them to be the same?
 
Miro Mile
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Request headers are information sent from the browser for use by the server. Response headers are information sent from the server for use by the browser. Why would you expect them to be the same?

You're right, it doesn't make much sense. And thanks for your answer - everything is clear right now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic