Review:
Using HTTP Request Headers
Many servlet tasks can only be
accomplished by making use of HTTP
headers coming from the browser
Use request.getHeader for arbitrary header
Cookies, authorization info, content length,
and content type have shortcut methods
Most important headers you read directly
Accept
Accept Encoding
Connection
Referer
User Agent
99
Servlets
www.corewebprogramming.com
Review:
Generating the HTTP Response
Many servlet tasks can only be
accomplished through use of HTTP status
codes and headers sent to the browser
Two parts of the response
Status line
In general, set via response.setStatus
In special cases, set via
response.sendRedirect and response.sendError
Response headers
In general, set via response.setHeader
In special cases, set via response.setContentType,
response.setContentLength, response.addCookie,
and response.sendRedirect
100
Servlets
www.corewebprogramming.com
50