Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Content-type without JSP directives

 
Mariusz Skwarczynski
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64623
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The browsers rely on the DOCTYPE to determine how to interpret the markup. Just send text/html as the content type.
 
Mariusz Skwarczynski
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I would rather not rely on browser's choice at least if there's other option.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64623
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic