Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
Chapter
response from a Web server normally consists of a status line, one or
more response headers, a blank line, and the document. To get the
A
most out of your servlets, you need to know how to use the status line
and response headers effectively, not just how to generate the document.
Setting the HTTP response headers often goes hand in hand with setting
the status codes in the status line, as discussed in the previous chapter. For
example, all the  document moved  status codes (300 through 307) have an
accompanying 
Location
 header, and a 401 (
Unauthorized
) code always
includes an accompanying 
WWW Authenticate
 header. However, specifying
headers can also play a useful role even when no unusual status code is set.
Response headers can be used to specify cookies, to supply the page modifi 
cation date (for client side caching), to instruct the browser to reload the
page after a designated interval, to give the file size so that persistent HTTP
connections can be used, to designate the type of document being generated,
and to perform many other tasks. 
7.1 Setting Response Headers 
from Servlets
The most general way to specify headers is to use the 
setHeader
 method of
HttpServletResponse
. This method takes two strings: the header name and
143






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