wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes setHeader() and addHeader() practical example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "setHeader() and addHeader() practical example" Watch "setHeader() and addHeader() practical example" New topic
Author

setHeader() and addHeader() practical example

Abhay Agarwal
Ranch Hand

Joined: Feb 29, 2008
Posts: 1075
    
    1

Hi

I am looking for a pratical example of using setHeader() and addHeader() which can clearly mention the difference between these two.
Please provide me such example.

Thanks in advance


Oracle Java Web Service Developer (1z0-897), Oracle certified Java 7 Programmer, SCJA 1.0, SCJP 5.0, SCWCD 5.0, Oracle SQL Fundamentals I
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

setHeader sets a named response header and replaces any existing headers with that name. addHeader on the other hand doesn't replace any existing headers with the same name. You can inspect response headers in Firefox using Web Developer Toolbar and using ieHttpHeaders for Internet Explorer...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
jQuery in Action, 2nd edition
 
subject: setHeader() and addHeader() practical example
 
Similar Threads
addheader and addcookie
Headers
request headers question ...
Response Headers
doubt on response.addHeader