Igor Artamonov
Igor Artamonov

Reputation: 35936

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?

Upvotes: 0

Views: 757

Answers (1)

Mark Thomas
Mark Thomas

Reputation: 16660

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)

Upvotes: 1

Related Questions