I'm using PrimeFaces 3.4 with MyFaces 2.0.7 on WebSphere 7. I'm using filter to set the response encoding to UTF-8:
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
<filter-mapping>
<filter-name>CharsetEncodingFilter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
In logs I see the filter is called on each JSF resource set, including resoures such as:
http://localhost:9080/myapp/javax.faces.resource/myscript.js.xhtml?ln=mylib
However, when I see the response headers, charset is not set, only the Contet-Type
is set to application/x-javascript
. My filter is declared as first in web.xml, the only other I'm using is org.primefaces.webapp.filter.FileUploadFilter
which does nothing with character encoding.
The JavaScript files are treated as UTF-8 as default because messages are displayed correctly, but nevertheless I would like the character set to be set correctly.
How should I do that? The filter was always working for me, why not in JSF/PrimeFaces? Am I missing something with this approach?