• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with Headers

 
anil kumar
Ranch Hand
Posts: 447
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

------------------------------------------------------------------------
Servlet programmers are responsible for ensuring that the Content-Type
header is appropriately set in the response object for the content the servlet is generating. The HTTP 1.1 specification does not require that this header be set inan HTTP response. Servlet containers must not set a default content type when theservlet programmer does not set the type.
-------------------------------------------------------------------------

These are statements from specification .I tried with one program.I have used Tomcat 5.5.17

I did test one program by sending pdf file.And did not set the content-type header.So the default content type is text/html.So i thought i should get run time exception.But i did not get the exception.And the program is running sucessfully.

So my question is .Is it necessary or required to set the content-type header if i send other than text/html or not?


Thanks

Anil Kumar

[ June 29, 2007: Message edited by: anil kumar ]
[ June 29, 2007: Message edited by: anil kumar ]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So my question is .Is it necessary or required to set the content-type header if i send other than text/html or not?

Yes, you'd better do it, otherwise you may have unpredictable results depending on the browser you are using.
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I think this is something browser specific, recognizing the content type.


Thanks,
 
anil kumar
Ranch Hand
Posts: 447
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Thanks to Satou and chandra


Thanks

Anil Kumar
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic