cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Francesco Chicchiricco (JIRA)" <>
Subject [jira] Created: (COCOON-2072) JSR.168 Portlet-aware CookieModule
Date Thu, 31 May 2007 13:56:15 GMT
JSR.168 Portlet-aware CookieModule

                 Key: COCOON-2072
             Project: Cocoon
          Issue Type: Improvement
          Components: Blocks: Portal
            Reporter: Francesco Chicchiricco

A FAQ here:
says that some JSR-168 containers provide their javax.portlet.PortletRequest implementation
with cookies, even thought embedded in a string.

Looking at sources of Jakarta Pluto (org.apache.pluto.internal.impl.PortletRequestImpl) and
Sun's Open Portal - free version of Sun JES Portal Server - (com.sun.portal.portlet.impl.PortletRequestImpl),
I found that this is true for both.

So, I wrote a simple org.apache.cocoon.components.modules.input.CookieModule extension that
can handle all that above, providing cookie access to portlets:

Here's the code:

public class PortletAwareCookieModule extends CookieModule {

	final protected String COOKIE = "cookie";

	protected Map getCookieMap(Map objectModel) {
		if (!objectModel.containsKey(PortletObjectModelHelper.PORTLET_REQUEST_OBJECT))
			return super.getCookieMap(objectModel);

		PortletRequest portletRequest =
		String cookieList = portletRequest.getProperty(COOKIE);
		StringTokenizer cookieTok = new StringTokenizer(cookieList,
		String[] cookieParts = null;
		Map<String, HttpCookie> cookieMap = new HashMap<String, HttpCookie>();
		while (cookieTok.hasMoreTokens()) {
			cookieParts = cookieTok.nextToken()
					new HttpCookie(cookieParts[0],

		return cookieMap;


This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message