myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacek Bilski <>
Subject Re: Content type of generated page
Date Thu, 09 Jul 2009 09:59:23 GMT

OK, so I debugged some more, and here's what I've found.

MyFaces get content type it should prepare based on what browser sent in 
it's "Accept" HTTP header. In my case that states in first place 
"text/html". In HtmlRendererUtils class in method selectContentType 
MyFaces try to match content types sent by browser with those it 
supports. As it supports "text/html", that one is chosen.

On the other hand my every jspx file begins with those three lines:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
<html xmlns="">

When I look in .java files generated based on my .jspx files I see, that 
the first line is this:


If I add "< contentType="text/html; charset=UTF-8"/>" 
somewhere, then browser gets content type as "text/html".

So my two questions:

1. Is there a method to force MyFaces to use "text/xml" (or some other) 
content type?

2. How it is possible, in the first place, that MyFaces use one content 
type, and then whole page is sent with different content type? Whose 
error is that? Because I assume that situation should never happen, and 
I'm going to file a bug report, but I don't have idea yet who should get it.


Jacek Bilski

View raw message