my dog learned polymorphism*
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


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 "Doubt" Watch "Doubt" New topic
Author

Doubt

MInu
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?

Thanks.


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
Hi,

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)
MInu
Ranch Hand

Joined: Oct 09, 2003
Posts: 517
Thanks 4 your reply
 
Don't get me started about those stupid light bulbs.
 
subject: Doubt
 
Similar Threads
A Video Player
J2eeCertificate Practice exam question
Problem of downloading and displaying a MOV file
MP3 on J2ME??
video/mpeg mapping