gpt4 book ai didi

java - 当 cookie 包含变音字符时 Tomcat 7 异常

转载 作者:搜寻专家 更新时间:2023-10-31 20:29:06 25 4
gpt4 key购买 nike

我是一名开发人员,当 Cookie 包含变音字符 (ä,ö,ü) 时,我遇到以下异常,我尝试了很多解决方案和配置,但没有任何结果。

我用的是Tomcat7

有什么办法吗

Feb 21, 2013 6:29:16 AM org.apache.coyote.http11.AbstractHttp11Processor process
SEVERE: Error processing request
java.lang.IllegalArgumentException: Control character in cookie value or attribute.
at org.apache.tomcat.util.http.CookieSupport.isHttpSeparator(CookieSupport.java:193)
at org.apache.tomcat.util.http.Cookies.getTokenEndPosition(Cookies.java:488)
at org.apache.tomcat.util.http.Cookies.processCookieHeader(Cookies.java:291)
at org.apache.tomcat.util.http.Cookies.processCookies(Cookies.java:168)
at org.apache.tomcat.util.http.Cookies.getCookieCount(Cookies.java:106)
at org.apache.catalina.connector.CoyoteAdapter.parseSessionCookiesId(CoyoteAdapter.java:919)
at org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java:688)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:402)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1600)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

最佳答案

根据对另一个问题的评论,您需要升级到 tomcat 8.0.15(或更高版本)并启用 RFC 6455 cookie 处理器。此处记录:http://tomcat.apache.org/tomcat-8.0-doc/config/cookie-processor.html

通过以下方式在您的 conf/context.xml 中启用它:

<Context>
<CookieProcessor className="org.apache.tomcat.util.http.Rfc6265CookieProcessor" />
</Context>

关于java - 当 cookie 包含变音字符时 Tomcat 7 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16450807/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com