I have a J2EE/JSF-based web-app.
It consists of an form-input, a text display and a visualization rendered through Google Visualization API with a custom servlet datasource.
The page is rendered in an <iframe/> in a page that I can control partially at best.
On Chrome, Firefox, the application works well. They accept the JSF-generated session cookie and return the session id to the server with each request.
On IE, we had to fiddle a bit, but all in all it works as well.
On Safari (5.1.2/Windows XP) however, the session id is sent as a non-standard URL-parameter (;jsessionid=...). As a consequence, the Query to the servlet datasource does not include the session id, and a new session is created for every request to the datasource.
This leads to the visualization being stuck at the initial state.
I suspect the cause in the browsers’ different JavaScript engines, but that suspicion is of little use.
Can I somehow get Safari to add the session ID to all requests? Even better, can I get it to use the cookie for all requests somehow?
Update: I have tried to append the session id to the call executed by Google’s “Query” object, but failed.
When called like this
new google.visualization.Query('chartdata?randomBitToBypassCaching='+random+";jsessionid="+jsessionid);
the URL requested is that
http://localhost:8083/myapp/chartdata?randomBitToBypassCaching=1327312516149;jsessionid=9fdb20a75d30f000c063317997b5&tqx=reqId%3A0
Note that Query appends a tqx-parameter to the URL, which renders my attempt to transfer the ID moot.
Update 2: The recommended way to transfer a jsessionid in the URL is to add it before the parameters.
In the end, I transferred the session id as a URL parameter and implemented a Servlet Filter that redirected the request using the standard notation
;jsessionid=...?...Unfortunately, just appending the session id to the query string – before any other parameter – did not work: