aspose file tools*
The moose likes JSP and the fly likes Content-type without JSP directives Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Content-type without JSP directives" Watch "Content-type without JSP directives" New topic
Author

Content-type without JSP directives

Mariusz Skwarczynski
Greenhorn

Joined: Dec 20, 2007
Posts: 3
Hi, I have this really drive-me-crazy problem with setting content-type.
I'm developing a web-site which uses XHTML DOCTYPE. The problem with XHTML is that not all browsers recognize application/xhtml+xml content-type. So I'm using a filter, that is included in web.xml and that changes response's content-type according to Accept header. The problem is that filter changes content-type but something changes it back to text/html. I mean, I know content-type is changed by filter to application/xhtml+html but
results in text/html.
Any ideas what the something can be?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

The browsers rely on the DOCTYPE to determine how to interpret the markup. Just send text/html as the content type.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mariusz Skwarczynski
Greenhorn

Joined: Dec 20, 2007
Posts: 3
Well, I would rather not rely on browser's choice at least if there's other option.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

You really don't have any choice. The browsers enter their rendering mode based upon the DOCTYPE (or lack thereof). You can muck around with the content type all you want, but it will make no difference.
[ December 20, 2007: Message edited by: Bear Bibeault ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Content-type without JSP directives