This page has HTTP only information. For more information on servlets see the Servlets page directly.
Common HTTP 1.1 Response Headers [1]
- Cache-Control (1.1) and Pragma (1.0)
A no-cache value prevents browsers from caching page.
- Content-Disposition
Lets you request that the browser ask the user to save the response to disk in a file of the given name
Ex.:
Content-Disposition: attachment; filename=file-name
- Content-Encoding
The way document is encoded.
- Content-Length
The number of bytes in the response.
See setContentLength on previous slide.
Use ByteArrayOutputStream to buffer document before sending it, so that you can determine size.
- Content-Type
The MIME type of the document being returned.
Use setContentType to set this header.
- Expires
The time at which document should be considered out-of-date and thus should no longer be cached.
In java servlets use setDateHeader to set this header.
- Last-Modified
The time document was last changed.
Don’t set this header explicitly; provide a getLastModified method instead.
- Location
The URL to which browser should reconnect.
Use sendRedirect instead of setting this directly.
- Refresh
The number of seconds until browser should reload page.
Can also include URL to connect to.
- Set-Cookie
The cookies that browser should remember. Don’t set this header directly, use addCookie instead.
- WWW-Authenticate
The authorization type and realm needed in Authorization header.
Sem comentários:
Enviar um comentário