Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
146
Chapter 7 Generating the Server Response: HTTP Response Headers
Accept Ranges
This header, which is new in HTTP 1.1, tells the client whether or not 
you accept 
Range
 request headers. You typically specify a value of 
bytes
 to indicate that you accept 
Range
 requests, and a value of 
none
to indicate that you do not.
Age
This header is used by proxies to indicate how long ago the document 
was generated by the original server. It is new in HTTP 1.1 and is rarely 
used by servlets.
Allow
The 
Allow
 header specifies the request methods (
GET
, 
POST
, etc.) that 
the server supports. It is required for 405 (
Method Not Allowed
) 
responses. The default 
service
 method of servlets automatically gener 
ates this header for 
OPTIONS
 requests.
Cache Control
This useful header tells the browser or other client the circumstances in 
which the response document can safely be cached. It has the following 
possible values:
public
: Document is cacheable, even if normal rules (e.g., for 
password protected pages) indicate that it shouldn't be.
private
: Document is for a single user and can only be stored 
in private (nonshared) caches.
no cache
: Document should never be cached (i.e., used to 
satisfy a later request). The server can also specify 
no cache="header1,header2,...,headerN"
  to indicate 
the headers that should be omitted if a cached response is later 
used. Browsers normally do not cache documents that were 
retrieved by requests that include form data. However, if a 
servlet generates different content for different requests even 
when the requests contain no form data, it is critical to tell the 
browser not to cache the response. Since older browsers use the 
Pragma
 header for this purpose, the typical servlet approach is 
to set both headers, as in the following example.
response.setHeader("Cache Control", "no cache");
response.setHeader("Pragma", "no cache");
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

jsp web hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Jsp Web Hosting Cheapest Web Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved