[jboss-jira] [JBoss JIRA] (WFLY-2550) Setting the response encoding via Filter doesn't work, is always null
David Mann (JIRA)
jira-events at lists.jboss.org
Fri Nov 22 06:45:05 EST 2013
David Mann created WFLY-2550:
--------------------------------
Summary: Setting the response encoding via Filter doesn't work, is always null
Key: WFLY-2550
URL: https://issues.jboss.org/browse/WFLY-2550
Project: WildFly
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Web (Undertow)
Affects Versions: 8.0.0.Beta1
Environment: Linux and Windows
Reporter: David Mann
Assignee: Stuart Douglas
When trying to set the character encoding of the HTTP response, the encoding stays null.
This is our filter implementation:
public void doFilter(HttpServletRequest request, HttpServletResponse response, HttpSession session,
FilterChain chain) throws ServletException, IOException
{
System.out.println("encoding is " + request.getCharacterEncoding());
if (request.getCharacterEncoding() == null) {
request.setCharacterEncoding("UTF-8");
}
if (request.getCharacterEncoding() == null) {
System.out.println("could not set encoding");
Thread.dumpStack();
}
chain.doFilter(request, response);
}
The stack trace implies that there is only undertow beneath us ;-) Some element in the chain has already touched the response.
could not set encoding
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1342)
at de.mdkgmbh.sp.MdkCharacterEncodingFilter.doFilter(MdkCharacterEncodingFilter.java:24)
at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:75)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:56)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:59)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:81)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113)
at io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:65)
at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:70)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:218)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:205)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:69)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:134)
at io.undertow.server.HttpHandlers.executeRootHandler(HttpHandlers.java:36)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:619)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
We need a solution for this, as we rely on UTF-8.
We have found no way to configure the listener either, seeing that the old JBoss Web way doesn't work anymore (WFLY-2276)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list