jQuery in Action, 2nd edition*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HF book pg133 ~ setHeader( Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HF book pg133 ~ setHeader("content-type")" Watch "HF book pg133 ~ setHeader("content-type")" New topic
Author

HF book pg133 ~ setHeader("content-type")

Lee Kian Giap
Ranch Hand

Joined: Jan 23, 2008
Posts: 213
Hi,

In page133 , it mentioned that response.setHeader("content-type","text/html"); has no difference with response.setContentType("text/html");

As I refer to Chapter 1 , the content-type header in HTTP Response is "Content-Type", I mean it comes with Uppercase "C" and "T".

So, my question is response.setHeader("content-type","text/html"); will create a "content-type" header instead of "Content-Type" header in HTTP Response , may I know whether the HTTP Response header case sensitive when the web browser read it ?

Thank you !!!


SCJP 6, SCWCD 5, SCBCD 5
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

I don't think HTTP headers are case sensitive. So content-type is the same as Content-Type...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Milton Ochoa
Ranch Hand

Joined: Oct 23, 2007
Posts: 336

I am agree with Ankit
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: HF book pg133 ~ setHeader("content-type")