Hi,

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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>

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

response.setContentType("text/xml;charset=UTF-8");

If I add "<jsp:directive.page 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.

Regards

Jacek Bilski

Reply via email to