Hello,
Thank you for your answer.
Indeed, I have such a filter:
In "web.xml":
----------------------------------------------------------------------------------------
<filter>
<filter-name>EncodingFilter</filter-name>
<filter-class>com.[...].EncodingFilter</filter-class>
<init-param>
<param-name>requestEncoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>EncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
----------------------------------------------------------------------------------------
The "doFilter()" method of the "EncodingFilter" class which implements
"Filter":
----------------------------------------------------------------------------------------
public void doFilter(ServletRequest servletRequest,
ServletResponse servletResponse,
FilterChain filterChain)
throws IOException, ServletException
{
// Respect the client-specified character encoding
// (see HTTP specification section 3.4.1)
if(servletRequest.getCharacterEncoding() == null)
{
servletRequest.setCharacterEncoding(ms_encoding);
}
// Set the default response content type and encoding
servletResponse.setContentType("text/html; charset=" +
Finals.S_CHARSET);
servletResponse.setCharacterEncoding(Finals.S_CHARSET);
filterChain.doFilter(servletRequest, servletResponse);
}
----------------------------------------------------------------------------------------
Commenting the line:
servletResponse.setContentType("text/html; charset=" + Finals.S_CHARSET);
doesn't solve the problem.
I still get the error:
----------------------------------------------------------------------------------------
The stylesheet http ://localhost/fr/css/fo.css was not loaded because
itsMIME type, “text/html”, is not “text/css”.
----------------------------------------------------------------------------------------
Best regards,
--
Léa
On 15/01/2020 5:09 PM, Niall Fitzpatrick wrote:
Hi Lea,
I experienced this problem not so long ago when we upgraded our Tomcat to a
later version of 9. Basically we had a filter applied to requests which was
supposed to set the encoding of the response to be UTF-8. However, it was also
setting the content type to text/html.
Previous to the Tomcat upgrade it wasn't an issue. I found that in one of the
Tomcat updates (can't remember which one) the logic of the default servlet was
altered such that if the content type has already been set in the response it
can't be set again further down stream. So my resolution was to remove the line
that set the content type in our filter.
Something to check anyway as it took me some time to figure out what was
happening.
Niall
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org