简体   繁体   中英

Getting corrupted cookie value from HttpServletRequest

Browser sends a cookie like fbm_123456=base_domain=.test.com; (it's a cookie that was set by Facebook Javascript SDK), it's how I see from FireBug.

But when i'm reading it on server side, my cookie.getValue() returns only base_domain as value, I mean that =.test.com part is lost. All other cookie parameters are null (that's fine).

How it's possible? Maybe I've missed something with cookies, and it's some kind of special cookie? How I can get original cookie value?

The cookie is invalid. '=' characters are not permitted in cookie names or values. If you are using Tomcat then in later versions you can use the following system property to allow the invalid cookie to be read:

-Dorg.apache.tomcat.util.http.ServerCookie.ALLOW_EQUALS_IN_VALUE=true

The correct cookie value should be:

fbm_123456="base_domain=.test.com"

(note the quotes)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM