What steps will reproduce the problem?
1. Glassfish- visit admin console (http://host:4848/ creates JSESSIONID cookie for / , visit WPS (http://host:8080/WPS creates JSESSIONID cookie for /WPS
2. Although on different ports, cookie spec doesn't care and both instances of JSESSIONID cookie are in scope to WPS, the GWT Google code sees both when it calls getCookie() and throws an exception "java.lang.IllegalArgumentException: Duplicate cookie! Cookie override attack?" and doesn't allow any requests to work.
1. Jetty- visit one of their sample servlets (i.e. http://host:8080/dump/info creates JSESSIONID cookie for / , visit WPS (http://host:8080/WPS creates JSESSIONID cookie for /WPS
2. Although different contexts, Jetty servlet sets its at root path so both are in scope to WPS, blah blah blah same exception and reason as the Glassfish example above.
There is no way to configure the GWT code to ignore the duplicate cookie check without modifying their code. It would be ideal if it just checked for and cared about the cookies defined in the /WPS application context and ignored the others or allowed a way to configure it to call com.google.gwt.user.server.Util.getCookie() passing true (allow duplicates) as the last parameter rather than hardcoding false. Admittedly this may not be possible in the former case, and not completely secure in the later case. But basing this all on the JSESSIONID in real world usage isn't working either.
The workaround when I had this same issue when I was rolling out my own XSRF protection code previously to GWT 2.3 was to use a different unique cookie name that basically just duplicated the last JSESSIONID value and set that extra cookie when that session was first created. You'd think if this new way was Google's "official" documented and mandated way to protect against XSRF, even using JSESSIONID in their example, it would "just work" out of the box. But clearly not, unless their code was never tested with Jetty or Glassfish. Very surprising.
Is there a preferred way to handle this from the GWT team that isn't documented, or is my kludge workaround the only way? Preferably a solution that works for all servlet containers, I know there are Tomcat-specific, Jetty-specific, etc settings to tweak default JSESSIONID behavior but those are not standard and even worse kludges.
Thanks for your attention to this and any advice as far as best practices,
~Josh