Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
148
Chapter 7 Generating the Server Response: HTTP Response Headers
details (you can access RFCs on line at one of the archive sites listed at 
http://www.rfc editor.org/
).
Content Length
This header indicates the number of bytes in the response. This infor 
mation is needed only if the browser is using a persistent (keep alive) 
HTTP connection. See the 
Connection
 header for determining when 
the browser supports persistent connections. If you want your servlet to 
take advantage of persistent connections when the browser supports it, 
your servlet should write the document into a 
ByteArrayOutput 
Stream
, look up its size when done, put that into the 
Content Length
field with 
response.setContentLength
, then send the content via 
byteArrayStream.writeTo(response.getOutputStream())
. For 
an example of this approach, see Section 7.4.
Content Location
This header supplies an alternative address for the requested docu 
ment. 
Content Location
 is informational; responses that include this 
header also include the requested document, unlike the case with the 
Location
 header. This header is new to HTTP 1.1.
Content MD5
The 
Content MD5
 response header provides an MD5 digest for the 
subsequent document. This digest provides a message integrity check 
for clients that want to confirm they received the complete, unaltered 
document. See RFC 1864 for details on MD5. This header is new in 
HTTP 1.1.
Content Range
This new HTTP 1.1 header is sent with partial document responses and 
specifies how much of the total document was sent. For example, a value 
of  
bytes 500 999/2345
  means that the current response includes 
bytes 500 through 999 of a document that contains 2345 bytes in total.
Content Type
The 
Content Type
 header gives the MIME (Multipurpose Internet 
Mail Extension) type of the response document. Setting this header is 
so common that there is a special method in 
HttpServletResponse
 for 
it: 
setContentType
. MIME types are of the form 
maintype/subtype
for officially registered types, and of the form 
maintype/x subtype
 for 
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