aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Important ques: setHeader.addHeader Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Important ques: setHeader.addHeader" Watch "Important ques: setHeader.addHeader" New topic
Author

Important ques: setHeader.addHeader

amarkirt saroay
Ranch Hand

Joined: Mar 16, 2008
Posts: 167
if there exists already a header by name and value :
MyHeader: mydata
Now what will be the result of following code on it?



Ans is mydata3,mydata ...Please explain how?


SCJP-75%
SCWCD-82%
Tom Kowalski
Ranch Hand

Joined: Feb 17, 2009
Posts: 72
First of all, you should write where have you found this question.

Anyway:



when you are using setHeader you are deleting the old contents of the header, and you are puting into it a new value.
when you are using addHeader you are NOT deleting old contents, you just add a new value to this header.


SCJP, SCWCD, OCUP
amarkirt saroay
Ranch Hand

Joined: Mar 16, 2008
Posts: 167
Thanks,i took this question from HFJS mock exam.
Nicky McGrath
Greenhorn

Joined: Jun 24, 2004
Posts: 3
So the real question is:
If you have a Header with multiple values (as occurs after multiple calls to addHeader),
does setHeader replace ALL the existing values.

Good question.
Omer Haderi
Ranch Hand

Joined: Sep 27, 2006
Posts: 42
the spec is clear about setHeader "the values are cleared and replaced with the new value"

therefore all values will be cleared
 
Don't get me started about those stupid light bulbs.
 
subject: Important ques: setHeader.addHeader