jQuery in Action, 3rd edition
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Doubt 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 "Doubt" Watch "Doubt" New topic


Ranch Hand

Joined: Oct 09, 2003
Posts: 517
Question from j2eecertificate

How do you add the content-type header "video/mpeg" to the response?

The correct answer given - response.setContentType ("video/mpeg");

why this is wrong?

response.setHeader ("content-type","video/mpeg");

can anyone please explain this?


God Gave Me Nothing I Wanted<br />He Gave Me Everything I Needed<br /> - Swami Vivekananda
Bimal Patel
Ranch Hand

Joined: Aug 29, 2003
Posts: 130

I feel that both are correct but the first one is more appropriate. While second one is kind of a facility to add your own header and if the header about to be set already exist, it would override the value for that header.

Work Hard, Expect The Worst...<br /> <br />Bimal R. Patel<br />(SCJP 1.2, SCWCD 1.4)
Ranch Hand

Joined: Oct 09, 2003
Posts: 517
Thanks 4 your reply
I agree. Here's the link: http://aspose.com/file-tools
subject: Doubt
It's not a secret anymore!