Setting Arbitrary Response 
Headers
public void 
setHeader
(String headerName, 
String headerValue) 
Sets an arbitrary header
public void setDateHeader(String name,      
long millisecs) 
Converts millis since 1970 to date in GMT format
public void setIntHeader(String name, 
int headerValue) 
Prevents need to convert int to String
addHeader, addDateHeader, addIntHeader 
Adds header instead of replacing 
59
Servlets
www.corewebprogramming.com
Setting Common Response 
Headers
setContentType 
Sets the Content Type header. 
Servlets almost always use this header. 
See Table 19.1 (Common MIME Types).
setContentLength 
Sets the Content Length header.
Used for persistent HTTP connections.
See Connection request header. 
addCookie
Adds a value to the Set Cookie header. 
See separate section on cookies.
sendRedirect 
Sets Location header (plus changes status code) 
60
Servlets
www.corewebprogramming.com
30




  

Home

About Services Network Support FAQ Order Contact
 

Servlet Web Hosting

Our partners:Jsp Web Hosting Unlimited Web Hosting Cheapest Web Hosting  Java Web Hosting Web Templates Best Web Templates PHP Mysql Web Hosting Interland Web Hosting Cheap Web Hosting PHP Web Hosting Tomcat Web Hosting Quality Web Hosting Best Web Hosting  Mac Web Hosting 

Lunarwebhost.net  Business web hosting division of Vision Web Hosting Inc. All rights reserved