Cookie值用双引号引起来 [英] Cookie value in double quotes

查看:284
本文介绍了Cookie值用双引号引起来的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在tomcat 6.0.33上部署了一个应用程序,该应用程序生成带有正斜杠(/)作为cookie值中字符之一的cookie。现在由于某些原因,tomcat在存在正斜杠时将cookie值括在双引号中。 Cookie值中出现正斜杠时,如何更改tomcat的行为以避免加双引号?

I have a application deployed on tomcat 6.0.33 that generates a cookie with forward slash(/) as one of the characters in cookie value. Now for some reason tomcat is enclosing the cookie value in double quotes whenever there is forward slash present. How can I change tomcat behavior to avoid putting double quotes whenever forward slash is present in my cookie value?

N.B。我不同意BaluC的说法,这是一个重复的问题。在发布之前,我确实检查了另一个。我在这个问题中特别询问过如何更改tomcat行为以删除引号。这与提问者想知道为什么首先引入双引号的其他问题完全不同。

N.B. I do not agree with BaluC that this is a duplicate question. I did check the other one before I posted this one. I have specifically asked in this question as to how to change tomcat behavior to remove quotes. This is totally different from the other questions where the questioner is wondering why double quotes are introduced in the first place.

推荐答案

问题出在Tomcat版本。 cookie处理器在遇到正斜杠时将cookie值括在引号中。我升级到Tomcat 7,这些引号不见了。我在Tomcat 7中放宽了cookie值规则。

I found that the issue is with the Tomcat version. The cookie processor encloses the cookie value in quotes when it encounters forward slash. I upgraded to Tomcat 7 and those quotes are gone. The rules on cookie value are relaxed in Tomcat 7.

我进一步发现,即使在Tomcat 7中,如果cookie值中有 =,Tomcat也会将值包含在双引号。通过进一步升级到Tomcat 8,然后将其Cookie处理器更改为Rfc6265CookieProcessor,我克服了这一问题。

I further discovered that even in Tomcat 7, if there is '=' in cookie value, Tomcat encloses the value in double quotes. I overcame this by further upgrading to Tomcat 8 and then changing it's cookie processor to Rfc6265CookieProcessor.

这篇关于Cookie值用双引号引起来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆