使用 jfinal undertow 客户端连接总出现这个错误!查了cookie也没有存中文字符呀
2019-09-19 10:34:01[ERROR]-[Thread: XNIO-1 task-29]-[io.undertow.servlet.api.LoggingExceptionHandler.handleThrowable()]: UT005023: Exception handling request to /websocket.ws
java.lang.IllegalArgumentException: UT000173: An invalid control character [179] was present in the cookie value or attribute
at io.undertow.util.LegacyCookieSupport.isHttpSeparator(LegacyCookieSupport.java:149)
at io.undertow.util.Cookies.parseCookie(Cookies.java:274)
at io.undertow.util.Cookies.parseRequestCookies(Cookies.java:216)
at io.undertow.util.Cookies.parseRequestCookies(Cookies.java:206)
at io.undertow.util.Cookies.parseRequestCookies(Cookies.java:202)
at io.undertow.server.HttpServerExchange.getRequestCookies(HttpServerExchange.java:1128)
at io.undertow.server.session.SessionCookieConfig.findSessionId(SessionCookieConfig.java:84)
at io.undertow.servlet.spec.SessionCookieConfigImpl.findSessionId(SessionCookieConfigImpl.java:61)
at io.undertow.servlet.spec.ServletContextImpl$ServletContextSessionConfig.findSessionId(ServletContextImpl.java:1225)
at io.undertow.server.session.InMemorySessionManager.getSession(InMemorySessionManager.java:215)
at io.undertow.servlet.spec.ServletContextImpl.getSession(ServletContextImpl.java:858)
at io.undertow.servlet.spec.ServletContextImpl.getSession(ServletContextImpl.java:938)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:69)
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:269)
at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:78)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:133)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:130)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:249)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:78)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:99)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:376)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
https://blog.csdn.net/iteye_7245/article/details/81931128
所以你碰到了这个异常:
java.lang.IllegalArgumentException: UT000173: An invalid control character [179] was present in the cookie value or attribute
解决办法很简单,不要存放这些字符,或者存之前进行转码
不建议在 cookie 中存放不支持的字符