I am new to Servlets. I am a little confused about headers. This will be a basic question. Also, please let me know if my understanding is correct.
Here the players are: User, Browser, Servlet, Web server
Requests in HTTP are from Browser to webserver. Right? Responses in HTTP are from webserver to browser.Right?
Servlets residing on the webserver have access to both HTTP requests and responses.
HttpServletRequest wrap the HTTP requests, while HttpServletResponse wraps the HTTP response.
Hopefully things are correct till here.
Now I need to know about headers. 1.What is the difference between Request headers and response headers?
2. Who sets the request headers and how are they used? If I am right, request headers are set by the user or the browser, so that the servlet knows about the user preference and the browser preference and accordignly respond.
3. Who sets the response headers and how are they used? This is set by the servlet/webserver, so that the browser can behave accordingly. Can you give me some typical examples for both request and response?
Thanks and regards Vasim
And any good short tutorial, which explains the header part. Response headers are set by the
Hi Vasim, Your understanding is correct. I too had some questions about request & response headers when I was learning Servlets, but there are some examples or tutorials on the net. I am sorry that I dont remember the links. You can easily find them on google.