cookie name is truncated in Servlet 3.0 HttpServletRequest (Glassfish V3)

Posted by idplmal on Stack Overflow See other posts from Stack Overflow or by idplmal
Published on 2010-03-04T22:45:26Z Indexed on 2010/03/11 20:39 UTC
Read the original article Hit count: 324

Filed under:
|
|

I'm porting our Web authentication/authorization middleware for use in containers implementing the new servlet 3.0 API (Glassfish V3 in this case).

The middleware pulls cookies from the HttpServletRequest filtering on cookies with names of the form "DACS:FEDERATION::JURISDICTION:username". This works fine in the version 2.5 servlet API but is broken in 3.0.

The cookie names in 3.0 are being truncated at the first ":" in the name. I understand that the servlet 3.0 implementation defaults to RFC 2109 cookies which are more restrictive about cookie names than the old Netscape spec (":" is among the characters not allowed in RFC 2109 cookie names).

Digging into the servlet 3.0 source code, it appears that the use of RFC2109 names can be disabled by setting a System property "org.glassfish.web.rfc2109.cookie_names_enforced" to false. I've tried this to no avail. But besides that, the code that uses checks cookie names is in the constructor for Cookie, and it would appear that the truncation is occurring elsewhere.

So - finally - the question. Have others bumped into such issues in the servlet 3.0 API and have you found a work around?

© Stack Overflow or respective owner

Related posts about java

Related posts about servlets