MyFaces looks at Accept HTTP header, which, in my case, states
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8. MyFaces goes through that list and picks first entry which it understands, in my case that's
text/html. It doesn't really matter, that next entry
application/xhtml+xmlis what I would really want, "text/html" was first.
But JSP mechanism, when it sees something like
it does as it is instructed to do and sets ContentType to
<jsp:directive.page contentType="application/xhtml+xml; charset=UTF-8"/>
I don't remember now which one comes first, MyFaces or JSP, but something is definetly wrong here. I would like to assume, that when one of those chooses ContentType, the other respects that or, if the other one changes it, the first one won't be stubborn and doesn't force it's choice. The second solution could be hard to implement, so the first one is the way to go. I would expect that MyFaces, before it selects ContentType, tries to get that information from a response that was given to them. And that I will probably file as a bug.