File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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

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

Lee Kian Giap
Ranch Hand

Joined: Jan 23, 2008
Posts: 213

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 !!!

Ankit Garg

Joined: Aug 03, 2008
Posts: 9465

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
I agree. Here's the link:
subject: HF book pg133 ~ setHeader("content-type")
It's not a secret anymore!