|
Home > Archive > WebSphere Portal Server > June 2007 > Reading cookies
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
|
| Hi,
Is it possible to read a cookie set by a Theme from a JSP component in a WCM Viewer portlet? Could anyone give me some sample code?
I think it may not be possible because portal theme and portlets are considered to be different web applications. Am I right? Does anyone know it for sure?
Thank you
| |
|
| Hi,
It should be possible. Cookies are stored/managed by the client and is shareable between different web apps.
I believe the WCM Viewer uses the IBM Portlet API and is not a JSR168 portlet. As such, in the JSP, you might be able to do:
Cookie[] cookieArray = request.getCookies();
This method is not available in JSR168. While there is not an official standard yet, I found the following trick to work:
String cookieList = request.getProperty("cookie");
/* Now parse through the ; delimited cookie list for the cookie name/value you need */
Also, another alternative might be to use Javascript within your JSP to read the coookie. Hope that help!
Regards,
Bryan
IBM WebSphere Portal
ISV Technical Enablement & Support
|
|
|
|
|