Forums Register Login

Setting HTTP headers.

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
This seems more like a straightforward Serlvets question than a Certification question, so I will move it appropriately.
+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
 


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.
When I was younger I felt like a man trapped inside a woman’s body. Then I was born. My twin is a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 715 times.
Similar Threads
unable to compile servlet
Doubt in reDirect and post
Code Review - ChatServlet
Servlet question -standalone
Session problem
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 10:30:06.