Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Question about Content-Type Http Header

104 views
Skip to first unread message

mhewedy

unread,
May 31, 2010, 4:19:36 PM5/31/10
to
Hi firefox folks,

I don't know if this is the best place to post this question or not.

The question is, How to enforce Firefox to send the Conent-Type
request header to the server.

As I am working with tomcat server, and he expects the encoding to be
sent in the Content-Type request header, here's the code snippet from
tomcat 5.0.28 code:

// this method called by the developer to get the character encoding
of the request
public String getCharacterEncoding() {
if (charEncoding != null)
return charEncoding;

charEncoding =
ContentType.getCharsetFromContentType(getContentType());
return charEncoding;
}

// and see, this method takes the character encoding from charset sent
in Content-Type request header.
public static String getCharsetFromContentType(String type) {
if (type == null) {
return null;
}
int semi = type.indexOf(";");
if (semi == -1) {
return null;
}
int charsetLocation = type.indexOf("charset=", semi);
if (charsetLocation == -1) {
return null;
}
String afterCharset = type.substring(charsetLocation + 8);
afterCharset = afterCharset.replace('"', ' ');
String encoding = afterCharset.trim();
return encoding;
}


But, unfortunately, firefox doesn't appear to sent "Content-Type"
request header ?!!

Please help!!

Boris Zbarsky

unread,
May 31, 2010, 10:29:34 PM5/31/10
to
On 5/31/10 4:19 PM, mhewedy wrote:
> The question is, How to enforce Firefox to send the Conent-Type
> request header to the server.

For what kind of request?

-Boris

0 new messages