File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes doubt on response.addHeader Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "doubt on response.addHeader" Watch "doubt on response.addHeader" New topic
Author

doubt on response.addHeader

kalle suresh
Ranch Hand

Joined: Nov 20, 2007
Posts: 48
I have one question on addHeader.
The difference between addHeader and setHeader is that, if the header already exists

setHeader overwrites the Header
addHeader adds new value to the Header.

suppose for example i have response.addHeader("NAME","XXX"). If i am going to add new value to NAME, how it will get added?
swapna rao
Ranch Hand

Joined: Feb 12, 2008
Posts: 53
If you want to add one more value to Header NAME just use response.addHeader("NAME","YYY"). You can verify the two values by using request.getHeaders("NAME").It should give XXX and YYY values.Hope this helps


SCJP-88<br />SCWCD-94
kalle suresh
Ranch Hand

Joined: Nov 20, 2007
Posts: 48
ok. I got it. The request will read all these values by the method
request.getHeaders().
Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: doubt on response.addHeader
 
Similar Threads
request headers question ...
Important ques: setHeader.addHeader
HTTP response header
Header Methods
addHeader VS setHeader