JSP and JSTL Tutorials - Herong's Tutorial Notes
Dr. Herong Yang, Version 3.09, 2006

Controlling HTTP Response Header Lines

Part:   1  2  3  4  5  6  7 

JSP/JSTL Tutorials - Herong's Tutorial Notes © Dr. Herong Yang

Using Cookies

Using JavaBean Classes

HTTP Response Header Lines

Non ASCII Characters

JSTL and Expression Language

File Upload

Execution Context

JSP Elements

JSP Standard Tag Libraries (JSTL)

JSP Custom Tag

... Table of Contents

HTTP Response Syntax

Based on HTTP/1.1 protocol, after receiving and interpreting an HTTP request from a client, a server must responds with an HTTP response following the syntax bellow:

status-line
header-line
...
header-line

entity-body

Note that:

  • Response must have one status-line.
  • Response can have zero, one, or many header lines.
  • Response can only have zero or one entity-body.
  • There is a blank line between header lines and the entity body.
  • Status line, head line, and blank line must be ended with CRLF ("/r/n") characters.
  • Entity body is the actual data requested by the client request.
  • Header lines can be in any order.

Bellow is a simple HTTP response with two header lines:

HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 38

Hello world!

HTTP Response Header Lines

HTTP/1.1 response header lines allows the server to passes additional information about the response which cannot be placed in the status line. Header lines can be divided into three groups:

1. General header lines: Information about the transmission of the entire response message:

   Cache-Control      
   Connection         
   Date               
   Pragma             
   Trailer            
   Transfer-Encoding  
   Upgrade            
   Via                
   Warning          

2. Response header lines: Information about the response:

   Accept-Ranges     
   Age               
   ETag              
   Location          
   Proxy-Authenticate
   Retry-After       
   Server            
   Vary              
   WWW-Authenticate

3. Entity header lines: Information about the data requested by the client:

   Allow              
   Content-Encoding   
   Content-Language   
   Content-Length     
   Content-Location   
   Content-MD5        
   Content-Range      
   Content-Type       
   Expires            
   Last-Modified      

(Continued on next part...)

Part:   1  2  3  4  5  6  7 

Dr. Herong Yang, updated in 2006
JSP and JSTL Tutorials - Herong's Tutorial Notes - Controlling HTTP Response Header Lines