portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msnickl...@apache.org
Subject [11/22] portals-pluto git commit: Worked on URL processing
Date Mon, 16 Feb 2015 15:54:53 GMT
Worked on URL processing


Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/14800b56
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/14800b56
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/14800b56

Branch: refs/heads/V3Prototype
Commit: 14800b564ef916529f6645e5afda4eb4f6951bde
Parents: b28c3d6
Author: Scott Nicklous <msnicklous@apache.org>
Authored: Tue Feb 10 18:32:00 2015 +0100
Committer: Scott Nicklous <msnicklous@apache.org>
Committed: Tue Feb 10 18:32:00 2015 +0100

----------------------------------------------------------------------
 .../PortletStateAwareResponseContext.java       |   59 +-
 .../pluto/container/PortletURLProvider.java     |   60 +
 .../container/impl/PortletContainerImpl.java    |    2 +-
 .../container/impl/PortletRequestImpl.java      | 1429 +++++++++---------
 .../container/impl/StateAwareResponseImpl.java  |   80 +-
 .../PortletStateAwareResponseContextImpl.java   |  130 +-
 .../container/PortletURLProviderImpl.java       |  467 +++---
 .../driver/url/impl/RelativePortalURLImpl.java  |   53 +-
 .../driver/url/PortletParameterFactory.java     |    5 +
 9 files changed, 1305 insertions(+), 980 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/14800b56/pluto-container-api/src/main/java/org/apache/pluto/container/PortletStateAwareResponseContext.java
----------------------------------------------------------------------
diff --git a/pluto-container-api/src/main/java/org/apache/pluto/container/PortletStateAwareResponseContext.java b/pluto-container-api/src/main/java/org/apache/pluto/container/PortletStateAwareResponseContext.java
index e68b53d..c89354c 100644
--- a/pluto-container-api/src/main/java/org/apache/pluto/container/PortletStateAwareResponseContext.java
+++ b/pluto-container-api/src/main/java/org/apache/pluto/container/PortletStateAwareResponseContext.java
@@ -18,6 +18,7 @@ package org.apache.pluto.container;
 
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import javax.portlet.Event;
 import javax.portlet.PortletMode;
@@ -57,8 +58,62 @@ public interface PortletStateAwareResponseContext extends PortletResponseContext
     void removePublicRenderParameter(QName qn, String identifier);
     
     /**
-     * Clears public render parameters except those that are marked for removal.
+     * Add a public render parameter for given window ID and parameter name
+     *  
+     * @param qn           QName
+     * @param identifier   Identifier for PRP
+     * @param values       values array
+     */
+    void addPublicRenderParameter(String windowId, String name, String[] values);
+    
+    /**
+     * Remove the PRP for the given window ID and parameter name
+     * 
+     * @param windowId
+     * @param name
+     */
+    void removePublicRenderParameter(String windowId, String name);
+    
+    /**
+     * Returns <code>true</code> if the given name representa a public render
+     * parameter for the given window.
+     * 
+     * @param windowId
+     * @param name
+     * @return
+     */
+    boolean isPublicRenderParameter(String windowId, String name);
+    
+    /**
+     * Retrieves the available private parameter names for the given window ID
+     * @param windowId
+     * @return
+     */
+    Set<String> getParameterNames(String windowId);
+    
+    /**
+     * Gets the values array for the given window ID and private parameter name
+     * @param windowId
+     * @param name
+     * @return
+     */
+    String[] getParameterValues(String windowId, String name);
+
+    /**
+     * Adds the specified private parameter if not already present, or updates the
+     * values for the parameter if it is already present.
+     * @param windowId
+     * @param name
+     * @param values
+     */
+    void setParameter(String windowId, String name, String[] values);
+    
+    /** 
+     * Removes the private parameter for the given window and name. Does nothing if the
+     * given parameter is not present.
+     * @param windowId
+     * @param name
      */
-    void clearPublicRenderParameters();
+    void removeParameter(String windowId, String name);
 
 }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/14800b56/pluto-container-api/src/main/java/org/apache/pluto/container/PortletURLProvider.java
----------------------------------------------------------------------
diff --git a/pluto-container-api/src/main/java/org/apache/pluto/container/PortletURLProvider.java b/pluto-container-api/src/main/java/org/apache/pluto/container/PortletURLProvider.java
index 17bfbad..11b0bb6 100644
--- a/pluto-container-api/src/main/java/org/apache/pluto/container/PortletURLProvider.java
+++ b/pluto-container-api/src/main/java/org/apache/pluto/container/PortletURLProvider.java
@@ -20,6 +20,7 @@ import java.io.IOException;
 import java.io.Writer;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import javax.portlet.PortletMode;
 import javax.portlet.PortletSecurityException;
@@ -81,10 +82,69 @@ public interface PortletURLProvider {
     void removePublicRenderParameter(QName qn, String identifier);
     
     /**
+     * Add a public render parameter for given window ID and parameter name
+     *  
+     * @param qn           QName
+     * @param identifier   Identifier for PRP
+     * @param values       values array
+     */
+    void addPublicRenderParameter(String windowId, String name, String[] values);
+    
+    /**
+     * Remove the PRP for the given window ID and parameter name
+     * 
+     * @param windowId
+     * @param name
+     */
+    void removePublicRenderParameter(String windowId, String name);
+    
+    /**
+     * Returns <code>true</code> if the given name representa a public render
+     * parameter for the given window.
+     * 
+     * @param windowId
+     * @param name
+     * @return
+     */
+    boolean isPublicRenderParameter(String windowId, String name);
+   
+    /**
      * Clears public render parameters except those that are marked for removal.
      */
     void clearPublicRenderParameters();
     
+    /**
+     * Retrieves the available private parameter names for the given window ID
+     * @param windowId
+     * @return
+     */
+    Set<String> getParameterNames(String windowId);
+    
+    /**
+     * Gets the values array for the given window ID and private parameter name
+     * @param windowId
+     * @param name
+     * @return
+     */
+    String[] getParameterValues(String windowId, String name);
+
+    /**
+     * Adds the specified private parameter if not already present, or updates the
+     * values for the parameter if it is already present.
+     * @param windowId
+     * @param name
+     * @param values
+     */
+    void setParameter(String windowId, String name, String[] values);
+    
+    /** 
+     * Removes the private parameter for the given window and name. Does nothing if the
+     * given parameter is not present.
+     * @param windowId
+     * @param name
+     */
+    void removeParameter(String windowId, String name);
+    
     String getCacheability();
     void setCacheability(String cacheLevel);
     

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/14800b56/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletContainerImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletContainerImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletContainerImpl.java
index 5c8128a..69b7c3f 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletContainerImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletContainerImpl.java
@@ -251,7 +251,7 @@ public class PortletContainerImpl implements PortletContainer
 
         String location = null;
         String logtxt = "Portlet action";
-        if (isRedirect) {
+        if (!isRedirect) {
            logtxt = "Portlet Ajax or Partial action";
         }
 

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/14800b56/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestImpl.java
index 87ff0c0..ae30689 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestImpl.java
@@ -1,711 +1,718 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pluto.container.impl;
-
-import java.security.Principal;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.ccpp.Profile;
-import javax.portlet.CacheControl;
-import javax.portlet.MimeResponse;
-import javax.portlet.PortalContext;
-import javax.portlet.PortletContext;
-import javax.portlet.PortletMode;
-import javax.portlet.PortletPreferences;
-import javax.portlet.PortletRequest;
-import javax.portlet.PortletSession;
-import javax.portlet.WindowState;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-import org.apache.pluto.container.ContainerServices;
-import org.apache.pluto.container.PortletContainer;
-import org.apache.pluto.container.PortletEnvironmentService;
-import org.apache.pluto.container.PortletInvokerService;
-import org.apache.pluto.container.PortletRequestContext;
-import org.apache.pluto.container.PortletResponseContext;
-import org.apache.pluto.container.PortletWindow;
-import org.apache.pluto.container.om.portlet.CustomPortletMode;
-import org.apache.pluto.container.om.portlet.PortletDefinition;
-import org.apache.pluto.container.om.portlet.SecurityRoleRef;
-import org.apache.pluto.container.om.portlet.Supports;
-import org.apache.pluto.container.util.ArgumentUtility;
-import org.apache.pluto.container.util.StringManager;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * Abstract <code>javax.portlet.PortletRequest</code> implementation.
- * This class also implements InternalPortletRequest.
- *
- */
-public abstract class PortletRequestImpl implements PortletRequest
-{
-    public static final String ACCEPT_LANGUAGE = "Accept-Language";
-
-    private static final Logger LOG = LoggerFactory.getLogger(PortletRequestImpl.class);
-
-    private static final StringManager EXCEPTIONS =
-        StringManager.getManager(PortletRequestImpl.class.getPackage().getName());
-
-    private static final List<String> EMPTY_STRING_LIST = Collections.unmodifiableList(new ArrayList<String>(0));
-
-    // Private Member Variables ------------------------------------------------
-
-    /** The PortalContext within which this request is occuring. */
-    private final PortalContext portalContext;
-
-    private final PortletRequestContext requestContext;
-    private final PortletResponseContext responseContext;
-
-    /** The portlet session. */
-    private PortletSession portletSession;
-
-    /** Response content types. */
-    private ArrayList<String> contentTypes;
-
-    private PortletPreferences portletPreferences;
-
-    private Map<String, String[]> parameters;
-
-    private Map<String, String[]> requestProperties;
-    private List<String> requestPropertyNames;
-
-    private Cookie[] requestCookies;
-
-    private Map<String, String> userInfo;
-
-    private Profile ccppProfile;
-
-    private String contextPath;
-
-    private final String lifecyclePhase;
-
-    public PortletRequestImpl(PortletRequestContext requestContext, PortletResponseContext responseContext, String lifecyclePhase)
-    {
-        this.requestContext = requestContext;
-        this.responseContext = responseContext;
-        this.lifecyclePhase = lifecyclePhase;
-        this.portalContext = getPortletContainer().getContainerServices().getPortalContext();
-    }
-
-    private void retrieveRequestProperties()
-    {
-        Map<String, String[]> properties = requestContext.getProperties();
-        requestPropertyNames = new ArrayList<String>(properties.size());
-        requestProperties = new HashMap<String, String[]>(properties.size());
-        for (Map.Entry<String, String[]> entry : properties.entrySet())
-        {
-            requestPropertyNames.add(entry.getKey());
-            requestProperties.put(entry.getKey().toLowerCase(), entry.getValue());
-        }
-    }
-
-    private void checkInitParameterMap()
-    {
-        if (parameters == null)
-        {
-            parameters = initParameterMap();
-        }
-    }
-
-    protected static Map<String, String[]> cloneParameterMap(Map<String, String[]> map)
-    {
-        if (!map.isEmpty())
-        {
-            Map<String, String[]> result = new HashMap<String, String[]>(map.size());
-            for (Map.Entry<String,String[]> entry : map.entrySet())
-            {
-                if (entry.getValue() != null)
-                {
-                    result.put(entry.getKey(), entry.getValue().clone());
-                }
-            }
-            return Collections.unmodifiableMap(result);
-        }
-        return Collections.emptyMap();
-    }
-
-    protected Map<String, String[]> initParameterMap()
-    {
-        String[] values  = null;
-        Map<String, String[]> parameters = requestContext.getPrivateParameterMap();
-        Map<String, String[]> publicParameters = requestContext.getPublicParameterMap();
-        if (!publicParameters.isEmpty())
-        {
-            parameters = new HashMap<String, String[]>(parameters);
-            for (Map.Entry<String,String[]> entry : publicParameters.entrySet())
-            {
-                values = parameters.get(entry.getKey());
-                if (values == null)
-                {
-                    parameters.put(entry.getKey(), entry.getValue().clone());
-                }
-                else
-                {
-                    String[] copy = new String[values.length+entry.getValue().length];
-                    System.arraycopy(values, 0, copy, 0, values.length);
-                    System.arraycopy(entry.getValue(), 0, copy, values.length, entry.getValue().length);
-                    parameters.put(entry.getKey(), copy);
-                }
-            }
-        }
-        return parameters;
-    }
-
-    protected PortletRequestContext getRequestContext()
-    {
-        return requestContext;
-    }
-
-    protected PortletContext getPortletContext()
-    {
-        return requestContext.getPortletConfig().getPortletContext();
-    }
-
-    protected PortletWindow getPortletWindow()
-    {
-        return requestContext.getPortletWindow();
-    }
-
-    protected PortletContainer getPortletContainer()
-    {
-        return requestContext.getContainer();
-    }
-
-    protected HttpServletRequest getServletRequest()
-    {
-        return requestContext.getServletRequest();
-    }
-
-    protected String getMimeRequestProperty(String name, CacheControl cacheControl)
-    {
-        if (MimeResponse.ETAG.equals(name))
-        {
-            return cacheControl.getETag();
-        }
-        else if (MimeResponse.CACHE_SCOPE.equals(name))
-        {
-            return cacheControl.isPublicScope() ? MimeResponse.PUBLIC_SCOPE : MimeResponse.PRIVATE_SCOPE;
-        }
-        else if (MimeResponse.USE_CACHED_CONTENT.equals(name))
-        {
-            return cacheControl.useCachedContent() ? "true" : null;
-        }
-        else if (MimeResponse.EXPIRATION_CACHE.equals(name))
-        {
-            return Integer.toString(cacheControl.getExpirationTime());
-        }
-        return null;
-    }
-
-    // PortletRequest Impl -----------------------------------------------------
-
-    public Object getAttribute(String name)
-    {
-        ArgumentUtility.validateNotNull("attributeName", name);
-        if (name.equals(PortletRequest.LIFECYCLE_PHASE))
-        {
-            return lifecyclePhase;
-        }
-        else if (name.equals(PortletRequest.USER_INFO))
-        {
-            if (userInfo == null)
-            {
-                try
-                {
-                    userInfo = getPortletContainer().getContainerServices().getUserInfoService().getUserInfo(this, getPortletWindow());
-                }
-                catch (Exception e)
-                {
-                    userInfo = Collections.emptyMap();
-                }
-            }
-            return userInfo;
-        }
-        else if (name.equals(PortletInvokerService.REQUEST_CONTEXT))
-        {
-            return requestContext;
-        }
-        else if (name.equals(PortletInvokerService.RESPONSE_CONTEXT))
-        {
-            return responseContext;
-        }
-        else if (name.equals(PortletRequest.CCPP_PROFILE))
-        {
-            if (ccppProfile == null)
-            {
-                ccppProfile = getPortletContainer().getContainerServices().getCCPPProfileService().getCCPPProfile(getServletRequest());
-            }
-            return ccppProfile;
-        }
-        return requestContext.getAttribute(name);
-    }
-
-    public Enumeration<String> getAttributeNames()
-    {
-        return requestContext.getAttributeNames();
-    }
-
-    public String getAuthType()
-    {
-        return getServletRequest().getAuthType();
-    }
-
-    public String getContextPath()
-    {
-        if (contextPath == null)
-        {
-            contextPath = requestContext.getPortletWindow().getPortletDefinition().getApplication().getContextPath();
-        }
-
-        return contextPath;
-    }
-
-    public Cookie[] getCookies()
-    {
-        if (requestCookies == null)
-        {
-            requestCookies = requestContext.getCookies();
-            if (requestCookies == null)
-            {
-                requestCookies = new Cookie[0];
-            }
-        }
-        return requestCookies.length > 0 ? requestCookies.clone() : null;
-    }
-
-    public Locale getLocale()
-    {
-        return requestContext.getPreferredLocale();
-    }
-
-    @SuppressWarnings("unchecked")
-    public Enumeration<Locale> getLocales()
-    {
-        Locale preferredLocale = getLocale();
-        ArrayList<Locale> locales = new ArrayList<Locale>();
-        locales.add(preferredLocale);
-        for (Enumeration e = getServletRequest().getLocales(); e.hasMoreElements(); )
-        {
-            Locale locale = (Locale)e.nextElement();
-            if (!locale.equals(preferredLocale))
-            {
-                locales.add(locale);
-            }
-        }
-        return Collections.enumeration(locales);
-    }
-
-    public String getParameter(String name)
-    {
-        ArgumentUtility.validateNotNull("parameterName", name);
-        checkInitParameterMap();
-        String[] values = parameters.get(name);
-        return values != null && values.length > 0 ? values[0] : null;
-    }
-
-    public Map<String, String[]> getParameterMap()
-    {
-        checkInitParameterMap();
-        return cloneParameterMap(parameters);
-    }
-
-    public Enumeration<String> getParameterNames()
-    {
-        checkInitParameterMap();
-        return Collections.enumeration(parameters.keySet());
-    }
-
-    public String[] getParameterValues(String name)
-    {
-        ArgumentUtility.validateNotNull("parameterName", name);
-        checkInitParameterMap();
-        String[] values =  parameters.get(name);
-        return values != null ? values.clone() : null;
-    }
-
-    public PortalContext getPortalContext()
-    {
-        return portalContext;
-    }
-
-    public PortletMode getPortletMode()
-    {
-        return getPortletWindow().getPortletMode();
-    }
-
-    public PortletSession getPortletSession()
-    {
-        return getPortletSession(true);
-    }
-
-    /**
-     * Returns the portlet session.
-     * <p>
-     * Note that since portlet request instance is created everytime the portlet
-     * container receives an incoming request, the portlet session instance held
-     * by the request instance is also re-created for each incoming request.
-     * </p>
-     */
-    public PortletSession getPortletSession(boolean create)
-    {
-        if (LOG.isDebugEnabled())
-        {
-            LOG.debug("Retreiving portlet session (create=" + create + ")");
-        }
-        //
-        // It is critical that we don't retrieve the portlet session until the
-        //   cross context dispatch has been completed.  If we do then we risk
-        //   having a cached version which is invalid for the context within
-        //   which it exists.
-        //
-        if (getPortletContext() == null)
-        {
-            throw new IllegalStateException(
-                    EXCEPTIONS.getString("error.session.illegalState"));
-        }
-        //
-        // We must make sure that if the session has been invalidated (perhaps
-        //   through setMaxIntervalTimeout()) and the underlying request
-        //   returns null that we no longer use the cached version.
-        // We have to check (ourselves) if the session has exceeded its max
-        //   inactive interval. If so, we should invalidate the underlying
-        //   HttpSession and recreate a new one (if the create flag is set to
-        //   true) -- We just cannot depend on the implementation of
-        //   javax.servlet.http.HttpSession!
-        //
-        HttpSession httpSession = getServletRequest().getSession(create);
-        if (httpSession != null)
-        {
-            // HttpSession is not null does NOT mean that it is valid.
-            int maxInactiveInterval = httpSession.getMaxInactiveInterval();
-            long lastAccesstime = httpSession.getLastAccessedTime();//lastAccesstime checks added for PLUTO-436
-            if (maxInactiveInterval >= 0 && lastAccesstime > 0)
-            {    // < 0 => Never expires.
-                long maxInactiveTime = httpSession.getMaxInactiveInterval() * 1000L;
-                long currentInactiveTime = System.currentTimeMillis() - lastAccesstime;
-                if (currentInactiveTime > maxInactiveTime)
-                {
-                    if (LOG.isDebugEnabled())
-                    {
-                        LOG.debug("The underlying HttpSession is expired and "
-                                + "should be invalidated.");
-                    }
-                    httpSession.invalidate();
-                    httpSession = getServletRequest().getSession(create);
-                    //Added for PLUTO-436
-                    // a cached portletSession is no longer useable.
-                    // a new one will be created below.
-                    portletSession = null;
-                }
-            }
-        }
-        if (httpSession == null)
-        {
-            if (LOG.isDebugEnabled())
-            {
-                LOG.debug("The underlying HttpSession is not available: "
-                        + "no session will be returned.");
-            }
-            return null;
-        }
-        //
-        // If we reach here, we are sure that the underlying HttpSession is
-        //   available. If we haven't created and cached a portlet session
-        //   instance, we will create and cache one now.
-        //
-        if (portletSession == null)
-        {
-            if (LOG.isDebugEnabled())
-            {
-                LOG.debug("Creating new portlet session...");
-            }
-            final ContainerServices containerServices = getPortletContainer().getContainerServices();
-            final PortletEnvironmentService portletEnvironmentService = containerServices.getPortletEnvironmentService();
-
-            portletSession = portletEnvironmentService.createPortletSession(getPortletContext(), getPortletWindow(), httpSession);
-        }
-        return portletSession;
-    }
-
-    public PortletPreferences getPreferences()
-    {
-        if (portletPreferences == null)
-        {
-            portletPreferences = new PortletPreferencesImpl(
-                    getPortletContainer(),getPortletWindow(),
-                    this);
-        }
-        return portletPreferences;
-    }
-
-    public Map<String, String[]> getPrivateParameterMap()
-    {
-        return cloneParameterMap(requestContext.getPrivateParameterMap());
-    }
-
-    @SuppressWarnings("unchecked")
-    public Enumeration<String> getProperties(String name)
-    {
-        ArgumentUtility.validateNotNull("propertyName", name);
-
-        if(ACCEPT_LANGUAGE.equalsIgnoreCase(name))
-        {
-            Locale preferredLocale = getLocale();
-            ArrayList<String> locales = new ArrayList<String>();
-            locales.add(preferredLocale.toString());
-            for (Enumeration e = getServletRequest().getLocales(); e.hasMoreElements(); )
-            {
-                Locale locale = (Locale)e.nextElement();
-                if (!locale.equals(preferredLocale))
-                {
-                    locales.add(locale.toString());
-                }
-            }
-            return Collections.enumeration(locales);
-        }
-
-        if (requestProperties == null)
-        {
-            retrieveRequestProperties();
-        }
-        String[] properties = requestProperties.get(name.toLowerCase());
-        if (properties == null)
-        {
-            return Collections.enumeration(EMPTY_STRING_LIST);
-        }
-        return Collections.enumeration(Arrays.asList(properties));
-    }
-
-    public String getProperty(String name)
-    {
-        ArgumentUtility.validateNotNull("name", name);
-
-        if(ACCEPT_LANGUAGE.equalsIgnoreCase(name))
-        {
-            return getLocale().toString();
-        }
-
-        if (requestProperties == null)
-        {
-            retrieveRequestProperties();
-        }
-        String property = null;
-        String[] properties = requestProperties.get(name.toLowerCase());
-        if (properties != null && properties.length > 0)
-        {
-            property = properties[0];
-        }
-        return property;
-    }
-
-    public Enumeration<String> getPropertyNames()
-    {
-        if (requestProperties == null)
-        {
-            retrieveRequestProperties();
-        }
-        return Collections.enumeration(requestPropertyNames);
-    }
-
-    public Map<String, String[]> getPublicParameterMap()
-    {
-        return cloneParameterMap(requestContext.getPublicParameterMap());
-    }
-
-    public String getRemoteUser()
-    {
-        return getServletRequest().getRemoteUser();
-    }
-
-    public String getRequestedSessionId()
-    {
-        return getServletRequest().getRequestedSessionId();
-    }
-
-    public String getResponseContentType()
-    {
-        return getResponseContentTypes().nextElement();
-    }
-
-    public Enumeration<String> getResponseContentTypes()
-    {
-        if (contentTypes == null)
-        {
-            contentTypes = new ArrayList<String>();
-            PortletDefinition dd = getPortletWindow().getPortletDefinition();
-            for (Supports sup : dd.getSupports())
-            {
-                contentTypes.add(sup.getMimeType());
-            }
-            if (contentTypes.isEmpty())
-            {
-                contentTypes.add("text/html");
-            }
-        }
-        return Collections.enumeration(contentTypes);
-    }
-
-    public String getScheme()
-    {
-        return getServletRequest().getScheme();
-    }
-
-    public String getServerName()
-    {
-        return getServletRequest().getServerName();
-    }
-
-    public int getServerPort()
-    {
-        return getServletRequest().getServerPort();
-    }
-
-    public Principal getUserPrincipal()
-    {
-        return getServletRequest().getUserPrincipal();
-    }
-
-    public String getWindowID()
-    {
-        return getPortletWindow().getId().getStringId();
-    }
-
-    public WindowState getWindowState()
-    {
-        return getPortletWindow().getWindowState();
-    }
-
-    public boolean isPortletModeAllowed(PortletMode mode)
-    {
-        if(PortletMode.VIEW.equals(mode))
-        {
-            return true;
-        }
-
-        String modeName = mode.toString();
-
-        PortletDefinition dd = getPortletWindow().getPortletDefinition();
-
-        for (Supports sup : dd.getSupports())
-        {
-            for (String m : sup.getPortletModes())
-            {
-                if (m.equalsIgnoreCase(modeName))
-                {
-                    // check if a portlet managed mode which is always allowed.
-                    CustomPortletMode cpm = dd.getApplication().getCustomPortletMode(modeName);
-                    if (cpm != null && !cpm.isPortalManaged())
-                    {
-                        return true;
-                    }
-                    Enumeration<PortletMode> supportedModes = portalContext.getSupportedPortletModes();
-                    while (supportedModes.hasMoreElements())
-                    {
-                        if (supportedModes.nextElement().equals(mode))
-                        {
-                            return true;
-                        }
-                    }
-                    return false;
-                }
-            }
-        }
-        return false;
-    }
-
-    public boolean isRequestedSessionIdValid()
-    {
-        return getServletRequest().isRequestedSessionIdValid();
-    }
-
-    public boolean isSecure()
-    {
-        return getServletRequest().isSecure();
-    }
-
-    /**
-     * Determines whether a user is mapped to the specified role.  As specified
-     * in PLT-20-3, we must reference the &lt;security-role-ref&gt; mappings
-     * within the deployment descriptor. If no mapping is available, then, and
-     * only then, do we check use the actual role name specified against the web
-     * application deployment descriptor.
-     *
-     * @param roleName the name of the role
-     * @return true if it is determined the user has the given role.
-     */
-    public boolean isUserInRole(String roleName)
-    {
-        PortletDefinition def = getPortletWindow().getPortletDefinition();
-        String link = roleName;
-
-        for (SecurityRoleRef r : def.getSecurityRoleRefs())
-        {
-            if (r.getRoleName().equals(roleName))
-            {
-                if (r.getRoleLink() != null)
-                {
-                    link = r.getRoleLink();
-                }
-                break;
-            }
-        }
-        return getServletRequest().isUserInRole(link);
-    }
-
-    /**
-     * Determine whether or not the specified WindowState is allowed for this
-     * portlet.
-     *
-     * @param state the state in question
-     * @return true if the state is allowed.
-     */
-    public boolean isWindowStateAllowed(WindowState state)
-    {
-        for (Enumeration<WindowState> en = portalContext.getSupportedWindowStates();
-        en.hasMoreElements(); )
-        {
-            if (en.nextElement().toString().equalsIgnoreCase(state.toString()))
-            {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public void setAttribute(String name, Object value)
-    {
-        ArgumentUtility.validateNotEmpty("name", name);
-        requestContext.setAttribute(name, value);
-    }
-
-    public void removeAttribute(String name)
-    {
-        ArgumentUtility.validateNotEmpty("name", name);
-        requestContext.setAttribute(name, null);
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.container.impl;
+
+import java.security.Principal;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.ccpp.Profile;
+import javax.portlet.CacheControl;
+import javax.portlet.MimeResponse;
+import javax.portlet.PortalContext;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletPreferences;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletSession;
+import javax.portlet.WindowState;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.apache.pluto.container.ContainerServices;
+import org.apache.pluto.container.PortletContainer;
+import org.apache.pluto.container.PortletEnvironmentService;
+import org.apache.pluto.container.PortletInvokerService;
+import org.apache.pluto.container.PortletRequestContext;
+import org.apache.pluto.container.PortletResponseContext;
+import org.apache.pluto.container.PortletWindow;
+import org.apache.pluto.container.om.portlet.CustomPortletMode;
+import org.apache.pluto.container.om.portlet.PortletDefinition;
+import org.apache.pluto.container.om.portlet.SecurityRoleRef;
+import org.apache.pluto.container.om.portlet.Supports;
+import org.apache.pluto.container.util.ArgumentUtility;
+import org.apache.pluto.container.util.StringManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Abstract <code>javax.portlet.PortletRequest</code> implementation.
+ * This class also implements InternalPortletRequest.
+ *
+ */
+public abstract class PortletRequestImpl implements PortletRequest
+{
+    public static final String ACCEPT_LANGUAGE = "Accept-Language";
+
+    private static final Logger LOG = LoggerFactory.getLogger(PortletRequestImpl.class);
+    private static boolean isDebug = LOG.isDebugEnabled();
+
+    private static final StringManager EXCEPTIONS =
+        StringManager.getManager(PortletRequestImpl.class.getPackage().getName());
+
+    private static final List<String> EMPTY_STRING_LIST = Collections.unmodifiableList(new ArrayList<String>(0));
+
+    // Private Member Variables ------------------------------------------------
+
+    /** The PortalContext within which this request is occuring. */
+    private final PortalContext portalContext;
+
+    private final PortletRequestContext requestContext;
+    private final PortletResponseContext responseContext;
+
+    /** The portlet session. */
+    private PortletSession portletSession;
+
+    /** Response content types. */
+    private ArrayList<String> contentTypes;
+
+    private PortletPreferences portletPreferences;
+
+    private Map<String, String[]> parameters;
+
+    private Map<String, String[]> requestProperties;
+    private List<String> requestPropertyNames;
+
+    private Cookie[] requestCookies;
+
+    private Map<String, String> userInfo;
+
+    private Profile ccppProfile;
+
+    private String contextPath;
+
+    private final String lifecyclePhase;
+
+    public PortletRequestImpl(PortletRequestContext requestContext, PortletResponseContext responseContext, String lifecyclePhase)
+    {
+        this.requestContext = requestContext;
+        this.responseContext = responseContext;
+        this.lifecyclePhase = lifecyclePhase;
+        this.portalContext = getPortletContainer().getContainerServices().getPortalContext();
+    }
+
+    private void retrieveRequestProperties()
+    {
+        Map<String, String[]> properties = requestContext.getProperties();
+        requestPropertyNames = new ArrayList<String>(properties.size());
+        requestProperties = new HashMap<String, String[]>(properties.size());
+        for (Map.Entry<String, String[]> entry : properties.entrySet())
+        {
+            requestPropertyNames.add(entry.getKey());
+            requestProperties.put(entry.getKey().toLowerCase(), entry.getValue());
+        }
+    }
+
+    private void checkInitParameterMap()
+    {
+        if (parameters == null)
+        {
+            parameters = initParameterMap();
+        }
+    }
+
+    protected static Map<String, String[]> cloneParameterMap(Map<String, String[]> map)
+    {
+        if (!map.isEmpty())
+        {
+            Map<String, String[]> result = new HashMap<String, String[]>(map.size());
+            for (Map.Entry<String,String[]> entry : map.entrySet())
+            {
+                if (entry.getValue() != null)
+                {
+                    result.put(entry.getKey(), entry.getValue().clone());
+                }
+            }
+            return Collections.unmodifiableMap(result);
+        }
+        return Collections.emptyMap();
+    }
+
+    protected Map<String, String[]> initParameterMap()
+    {
+        String[] values  = null;
+        Map<String, String[]> parameters = requestContext.getPrivateParameterMap();
+        Map<String, String[]> publicParameters = requestContext.getPublicParameterMap();
+        if (!publicParameters.isEmpty())
+        {
+            parameters = new HashMap<String, String[]>(parameters);
+            for (Map.Entry<String,String[]> entry : publicParameters.entrySet())
+            {
+                values = parameters.get(entry.getKey());
+                if (values == null)
+                {
+                    parameters.put(entry.getKey(), entry.getValue().clone());
+                }
+                else
+                {
+                    String[] copy = new String[values.length+entry.getValue().length];
+                    System.arraycopy(values, 0, copy, 0, values.length);
+                    System.arraycopy(entry.getValue(), 0, copy, values.length, entry.getValue().length);
+                    parameters.put(entry.getKey(), copy);
+                }
+            }
+        }
+        if (isDebug) {
+           StringBuilder txt = new StringBuilder("initParameterMap Returning ");
+           txt.append(publicParameters.size()).append(" public and ")
+              .append(parameters.size()).append(" total parameters.");
+           LOG.debug(txt.toString());
+        }
+        return parameters;
+    }
+
+    protected PortletRequestContext getRequestContext()
+    {
+        return requestContext;
+    }
+
+    protected PortletContext getPortletContext()
+    {
+        return requestContext.getPortletConfig().getPortletContext();
+    }
+
+    protected PortletWindow getPortletWindow()
+    {
+        return requestContext.getPortletWindow();
+    }
+
+    protected PortletContainer getPortletContainer()
+    {
+        return requestContext.getContainer();
+    }
+
+    protected HttpServletRequest getServletRequest()
+    {
+        return requestContext.getServletRequest();
+    }
+
+    protected String getMimeRequestProperty(String name, CacheControl cacheControl)
+    {
+        if (MimeResponse.ETAG.equals(name))
+        {
+            return cacheControl.getETag();
+        }
+        else if (MimeResponse.CACHE_SCOPE.equals(name))
+        {
+            return cacheControl.isPublicScope() ? MimeResponse.PUBLIC_SCOPE : MimeResponse.PRIVATE_SCOPE;
+        }
+        else if (MimeResponse.USE_CACHED_CONTENT.equals(name))
+        {
+            return cacheControl.useCachedContent() ? "true" : null;
+        }
+        else if (MimeResponse.EXPIRATION_CACHE.equals(name))
+        {
+            return Integer.toString(cacheControl.getExpirationTime());
+        }
+        return null;
+    }
+
+    // PortletRequest Impl -----------------------------------------------------
+
+    public Object getAttribute(String name)
+    {
+        ArgumentUtility.validateNotNull("attributeName", name);
+        if (name.equals(PortletRequest.LIFECYCLE_PHASE))
+        {
+            return lifecyclePhase;
+        }
+        else if (name.equals(PortletRequest.USER_INFO))
+        {
+            if (userInfo == null)
+            {
+                try
+                {
+                    userInfo = getPortletContainer().getContainerServices().getUserInfoService().getUserInfo(this, getPortletWindow());
+                }
+                catch (Exception e)
+                {
+                    userInfo = Collections.emptyMap();
+                }
+            }
+            return userInfo;
+        }
+        else if (name.equals(PortletInvokerService.REQUEST_CONTEXT))
+        {
+            return requestContext;
+        }
+        else if (name.equals(PortletInvokerService.RESPONSE_CONTEXT))
+        {
+            return responseContext;
+        }
+        else if (name.equals(PortletRequest.CCPP_PROFILE))
+        {
+            if (ccppProfile == null)
+            {
+                ccppProfile = getPortletContainer().getContainerServices().getCCPPProfileService().getCCPPProfile(getServletRequest());
+            }
+            return ccppProfile;
+        }
+        return requestContext.getAttribute(name);
+    }
+
+    public Enumeration<String> getAttributeNames()
+    {
+        return requestContext.getAttributeNames();
+    }
+
+    public String getAuthType()
+    {
+        return getServletRequest().getAuthType();
+    }
+
+    public String getContextPath()
+    {
+        if (contextPath == null)
+        {
+            contextPath = requestContext.getPortletWindow().getPortletDefinition().getApplication().getContextPath();
+        }
+
+        return contextPath;
+    }
+
+    public Cookie[] getCookies()
+    {
+        if (requestCookies == null)
+        {
+            requestCookies = requestContext.getCookies();
+            if (requestCookies == null)
+            {
+                requestCookies = new Cookie[0];
+            }
+        }
+        return requestCookies.length > 0 ? requestCookies.clone() : null;
+    }
+
+    public Locale getLocale()
+    {
+        return requestContext.getPreferredLocale();
+    }
+
+    @SuppressWarnings("unchecked")
+    public Enumeration<Locale> getLocales()
+    {
+        Locale preferredLocale = getLocale();
+        ArrayList<Locale> locales = new ArrayList<Locale>();
+        locales.add(preferredLocale);
+        for (Enumeration e = getServletRequest().getLocales(); e.hasMoreElements(); )
+        {
+            Locale locale = (Locale)e.nextElement();
+            if (!locale.equals(preferredLocale))
+            {
+                locales.add(locale);
+            }
+        }
+        return Collections.enumeration(locales);
+    }
+
+    public String getParameter(String name)
+    {
+        ArgumentUtility.validateNotNull("parameterName", name);
+        checkInitParameterMap();
+        String[] values = parameters.get(name);
+        return values != null && values.length > 0 ? values[0] : null;
+    }
+
+    public Map<String, String[]> getParameterMap()
+    {
+        checkInitParameterMap();
+        return cloneParameterMap(parameters);
+    }
+
+    public Enumeration<String> getParameterNames()
+    {
+        checkInitParameterMap();
+        return Collections.enumeration(parameters.keySet());
+    }
+
+    public String[] getParameterValues(String name)
+    {
+        ArgumentUtility.validateNotNull("parameterName", name);
+        checkInitParameterMap();
+        String[] values =  parameters.get(name);
+        return values != null ? values.clone() : null;
+    }
+
+    public PortalContext getPortalContext()
+    {
+        return portalContext;
+    }
+
+    public PortletMode getPortletMode()
+    {
+        return getPortletWindow().getPortletMode();
+    }
+
+    public PortletSession getPortletSession()
+    {
+        return getPortletSession(true);
+    }
+
+    /**
+     * Returns the portlet session.
+     * <p>
+     * Note that since portlet request instance is created everytime the portlet
+     * container receives an incoming request, the portlet session instance held
+     * by the request instance is also re-created for each incoming request.
+     * </p>
+     */
+    public PortletSession getPortletSession(boolean create)
+    {
+        if (LOG.isDebugEnabled())
+        {
+            LOG.debug("Retreiving portlet session (create=" + create + ")");
+        }
+        //
+        // It is critical that we don't retrieve the portlet session until the
+        //   cross context dispatch has been completed.  If we do then we risk
+        //   having a cached version which is invalid for the context within
+        //   which it exists.
+        //
+        if (getPortletContext() == null)
+        {
+            throw new IllegalStateException(
+                    EXCEPTIONS.getString("error.session.illegalState"));
+        }
+        //
+        // We must make sure that if the session has been invalidated (perhaps
+        //   through setMaxIntervalTimeout()) and the underlying request
+        //   returns null that we no longer use the cached version.
+        // We have to check (ourselves) if the session has exceeded its max
+        //   inactive interval. If so, we should invalidate the underlying
+        //   HttpSession and recreate a new one (if the create flag is set to
+        //   true) -- We just cannot depend on the implementation of
+        //   javax.servlet.http.HttpSession!
+        //
+        HttpSession httpSession = getServletRequest().getSession(create);
+        if (httpSession != null)
+        {
+            // HttpSession is not null does NOT mean that it is valid.
+            int maxInactiveInterval = httpSession.getMaxInactiveInterval();
+            long lastAccesstime = httpSession.getLastAccessedTime();//lastAccesstime checks added for PLUTO-436
+            if (maxInactiveInterval >= 0 && lastAccesstime > 0)
+            {    // < 0 => Never expires.
+                long maxInactiveTime = httpSession.getMaxInactiveInterval() * 1000L;
+                long currentInactiveTime = System.currentTimeMillis() - lastAccesstime;
+                if (currentInactiveTime > maxInactiveTime)
+                {
+                    if (LOG.isDebugEnabled())
+                    {
+                        LOG.debug("The underlying HttpSession is expired and "
+                                + "should be invalidated.");
+                    }
+                    httpSession.invalidate();
+                    httpSession = getServletRequest().getSession(create);
+                    //Added for PLUTO-436
+                    // a cached portletSession is no longer useable.
+                    // a new one will be created below.
+                    portletSession = null;
+                }
+            }
+        }
+        if (httpSession == null)
+        {
+            if (LOG.isDebugEnabled())
+            {
+                LOG.debug("The underlying HttpSession is not available: "
+                        + "no session will be returned.");
+            }
+            return null;
+        }
+        //
+        // If we reach here, we are sure that the underlying HttpSession is
+        //   available. If we haven't created and cached a portlet session
+        //   instance, we will create and cache one now.
+        //
+        if (portletSession == null)
+        {
+            if (LOG.isDebugEnabled())
+            {
+                LOG.debug("Creating new portlet session...");
+            }
+            final ContainerServices containerServices = getPortletContainer().getContainerServices();
+            final PortletEnvironmentService portletEnvironmentService = containerServices.getPortletEnvironmentService();
+
+            portletSession = portletEnvironmentService.createPortletSession(getPortletContext(), getPortletWindow(), httpSession);
+        }
+        return portletSession;
+    }
+
+    public PortletPreferences getPreferences()
+    {
+        if (portletPreferences == null)
+        {
+            portletPreferences = new PortletPreferencesImpl(
+                    getPortletContainer(),getPortletWindow(),
+                    this);
+        }
+        return portletPreferences;
+    }
+
+    public Map<String, String[]> getPrivateParameterMap()
+    {
+        return cloneParameterMap(requestContext.getPrivateParameterMap());
+    }
+
+    @SuppressWarnings("unchecked")
+    public Enumeration<String> getProperties(String name)
+    {
+        ArgumentUtility.validateNotNull("propertyName", name);
+
+        if(ACCEPT_LANGUAGE.equalsIgnoreCase(name))
+        {
+            Locale preferredLocale = getLocale();
+            ArrayList<String> locales = new ArrayList<String>();
+            locales.add(preferredLocale.toString());
+            for (Enumeration e = getServletRequest().getLocales(); e.hasMoreElements(); )
+            {
+                Locale locale = (Locale)e.nextElement();
+                if (!locale.equals(preferredLocale))
+                {
+                    locales.add(locale.toString());
+                }
+            }
+            return Collections.enumeration(locales);
+        }
+
+        if (requestProperties == null)
+        {
+            retrieveRequestProperties();
+        }
+        String[] properties = requestProperties.get(name.toLowerCase());
+        if (properties == null)
+        {
+            return Collections.enumeration(EMPTY_STRING_LIST);
+        }
+        return Collections.enumeration(Arrays.asList(properties));
+    }
+
+    public String getProperty(String name)
+    {
+        ArgumentUtility.validateNotNull("name", name);
+
+        if(ACCEPT_LANGUAGE.equalsIgnoreCase(name))
+        {
+            return getLocale().toString();
+        }
+
+        if (requestProperties == null)
+        {
+            retrieveRequestProperties();
+        }
+        String property = null;
+        String[] properties = requestProperties.get(name.toLowerCase());
+        if (properties != null && properties.length > 0)
+        {
+            property = properties[0];
+        }
+        return property;
+    }
+
+    public Enumeration<String> getPropertyNames()
+    {
+        if (requestProperties == null)
+        {
+            retrieveRequestProperties();
+        }
+        return Collections.enumeration(requestPropertyNames);
+    }
+
+    public Map<String, String[]> getPublicParameterMap()
+    {
+        return cloneParameterMap(requestContext.getPublicParameterMap());
+    }
+
+    public String getRemoteUser()
+    {
+        return getServletRequest().getRemoteUser();
+    }
+
+    public String getRequestedSessionId()
+    {
+        return getServletRequest().getRequestedSessionId();
+    }
+
+    public String getResponseContentType()
+    {
+        return getResponseContentTypes().nextElement();
+    }
+
+    public Enumeration<String> getResponseContentTypes()
+    {
+        if (contentTypes == null)
+        {
+            contentTypes = new ArrayList<String>();
+            PortletDefinition dd = getPortletWindow().getPortletDefinition();
+            for (Supports sup : dd.getSupports())
+            {
+                contentTypes.add(sup.getMimeType());
+            }
+            if (contentTypes.isEmpty())
+            {
+                contentTypes.add("text/html");
+            }
+        }
+        return Collections.enumeration(contentTypes);
+    }
+
+    public String getScheme()
+    {
+        return getServletRequest().getScheme();
+    }
+
+    public String getServerName()
+    {
+        return getServletRequest().getServerName();
+    }
+
+    public int getServerPort()
+    {
+        return getServletRequest().getServerPort();
+    }
+
+    public Principal getUserPrincipal()
+    {
+        return getServletRequest().getUserPrincipal();
+    }
+
+    public String getWindowID()
+    {
+        return getPortletWindow().getId().getStringId();
+    }
+
+    public WindowState getWindowState()
+    {
+        return getPortletWindow().getWindowState();
+    }
+
+    public boolean isPortletModeAllowed(PortletMode mode)
+    {
+        if(PortletMode.VIEW.equals(mode))
+        {
+            return true;
+        }
+
+        String modeName = mode.toString();
+
+        PortletDefinition dd = getPortletWindow().getPortletDefinition();
+
+        for (Supports sup : dd.getSupports())
+        {
+            for (String m : sup.getPortletModes())
+            {
+                if (m.equalsIgnoreCase(modeName))
+                {
+                    // check if a portlet managed mode which is always allowed.
+                    CustomPortletMode cpm = dd.getApplication().getCustomPortletMode(modeName);
+                    if (cpm != null && !cpm.isPortalManaged())
+                    {
+                        return true;
+                    }
+                    Enumeration<PortletMode> supportedModes = portalContext.getSupportedPortletModes();
+                    while (supportedModes.hasMoreElements())
+                    {
+                        if (supportedModes.nextElement().equals(mode))
+                        {
+                            return true;
+                        }
+                    }
+                    return false;
+                }
+            }
+        }
+        return false;
+    }
+
+    public boolean isRequestedSessionIdValid()
+    {
+        return getServletRequest().isRequestedSessionIdValid();
+    }
+
+    public boolean isSecure()
+    {
+        return getServletRequest().isSecure();
+    }
+
+    /**
+     * Determines whether a user is mapped to the specified role.  As specified
+     * in PLT-20-3, we must reference the &lt;security-role-ref&gt; mappings
+     * within the deployment descriptor. If no mapping is available, then, and
+     * only then, do we check use the actual role name specified against the web
+     * application deployment descriptor.
+     *
+     * @param roleName the name of the role
+     * @return true if it is determined the user has the given role.
+     */
+    public boolean isUserInRole(String roleName)
+    {
+        PortletDefinition def = getPortletWindow().getPortletDefinition();
+        String link = roleName;
+
+        for (SecurityRoleRef r : def.getSecurityRoleRefs())
+        {
+            if (r.getRoleName().equals(roleName))
+            {
+                if (r.getRoleLink() != null)
+                {
+                    link = r.getRoleLink();
+                }
+                break;
+            }
+        }
+        return getServletRequest().isUserInRole(link);
+    }
+
+    /**
+     * Determine whether or not the specified WindowState is allowed for this
+     * portlet.
+     *
+     * @param state the state in question
+     * @return true if the state is allowed.
+     */
+    public boolean isWindowStateAllowed(WindowState state)
+    {
+        for (Enumeration<WindowState> en = portalContext.getSupportedWindowStates();
+        en.hasMoreElements(); )
+        {
+            if (en.nextElement().toString().equalsIgnoreCase(state.toString()))
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public void setAttribute(String name, Object value)
+    {
+        ArgumentUtility.validateNotEmpty("name", name);
+        requestContext.setAttribute(name, value);
+    }
+
+    public void removeAttribute(String name)
+    {
+        ArgumentUtility.validateNotEmpty("name", name);
+        requestContext.setAttribute(name, null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/14800b56/pluto-container/src/main/java/org/apache/pluto/container/impl/StateAwareResponseImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/impl/StateAwareResponseImpl.java b/pluto-container/src/main/java/org/apache/pluto/container/impl/StateAwareResponseImpl.java
index bf7e885..a6ead55 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/impl/StateAwareResponseImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/impl/StateAwareResponseImpl.java
@@ -48,43 +48,46 @@ import org.apache.pluto.container.util.ArgumentUtility;
 public abstract class StateAwareResponseImpl extends PortletResponseImpl implements StateAwareResponse
 {
    private final Logger LOGGER = LoggerFactory.getLogger(StateAwareResponseImpl.class);
+   private final boolean isDebug = LOGGER.isDebugEnabled();
    
     private PortletStateAwareResponseContext responseContext;
+    private final String windowId;
     
 	public StateAwareResponseImpl(PortletStateAwareResponseContext responseContext)
 	{
 		super(responseContext);
 		this.responseContext = responseContext;
+		this.windowId = responseContext.getPortletWindow().getId().getStringId();
 	}
 	
-    private boolean isPublicRenderParameter(String name)
-    {
-        List<String> publicRenderParameterNames = responseContext.getPortletWindow().getPortletDefinition().getSupportedPublicRenderParameters();
-        return publicRenderParameterNames.isEmpty() ? false : publicRenderParameterNames.contains(name);
-    }
-    
-   private QName getQNameForPRPName(String name) {
-      QName qn = null;
-      PortletDefinition pd = responseContext.getPortletWindow().getPortletDefinition();
-      PortletApplicationDefinition pad = pd.getApplication();
-      List<? extends PublicRenderParameter> prps = pad.getPublicRenderParameters();
-      for (PublicRenderParameter prp : prps) {
-         if (name.equals(prp.getIdentifier())) {
-            qn = prp.getQName();
-            if (qn == null) {
-               String ns = pad.getDefaultNamespace();
-               String lp = prp.getName();
-               if (lp != null) {
-                  qn = new QName(ns, lp);
-               } else {
-                  LOGGER.error("Error in descriptor for " + responseContext.getPortletWindow()
-                        + " - neither QName nor Name is defined");
-               }
-            }
-         }
-      }
-      return qn;
-   }
+//     private boolean isPublicRenderParameter(String name)
+//     {
+//         List<String> publicRenderParameterNames = responseContext.getPortletWindow().getPortletDefinition().getSupportedPublicRenderParameters();
+//         return publicRenderParameterNames.isEmpty() ? false : publicRenderParameterNames.contains(name);
+//     }
+//     
+//    private QName getQNameForPRPName(String name) {
+//       QName qn = null;
+//       PortletDefinition pd = responseContext.getPortletWindow().getPortletDefinition();
+//       PortletApplicationDefinition pad = pd.getApplication();
+//       List<? extends PublicRenderParameter> prps = pad.getPublicRenderParameters();
+//       for (PublicRenderParameter prp : prps) {
+//          if (name.equals(prp.getIdentifier())) {
+//             qn = prp.getQName();
+//             if (qn == null) {
+//                String ns = pad.getDefaultNamespace();
+//                String lp = prp.getName();
+//                if (lp != null) {
+//                   qn = new QName(ns, lp);
+//                } else {
+//                   LOGGER.error("Error in descriptor for " + responseContext.getPortletWindow()
+//                         + " - neither QName nor Name is defined");
+//                }
+//             }
+//          }
+//       }
+//       return qn;
+//    }
         
 	private static String[] cloneParameterValues(String[] values)
 	{
@@ -157,12 +160,11 @@ public abstract class StateAwareResponseImpl extends PortletResponseImpl impleme
     {
         ArgumentUtility.validateNotEmpty("name", name);
         checkSetStateChanged();
-        if (isPublicRenderParameter(name))
+        if (responseContext.isPublicRenderParameter(windowId, name))
         {
             responseContext.getRenderParameters().remove(name);
             
-            QName qn = getQNameForPRPName(name);
-            responseContext.removePublicRenderParameter(qn, name);
+            responseContext.removePublicRenderParameter(windowId, name);
         }
     }
 
@@ -250,16 +252,14 @@ public abstract class StateAwareResponseImpl extends PortletResponseImpl impleme
         checkSetStateChanged();
         
         responseContext.getRenderParameters().clear();
-        responseContext.clearPublicRenderParameters();
         for (Map.Entry<String,String[]> entry : parameters.entrySet())
         {
             String[] values = cloneParameterValues(entry.getValue());
             String key = entry.getKey();
             responseContext.getRenderParameters().put(key, values);
-            if (isPublicRenderParameter(key))
+            if (responseContext.isPublicRenderParameter(windowId, key))
             {
-                QName qn = getQNameForPRPName(key);
-                responseContext.addPublicRenderParameter(qn, key, values);
+                responseContext.addPublicRenderParameter(windowId, key, values);
             }
         }
     }
@@ -271,10 +271,9 @@ public abstract class StateAwareResponseImpl extends PortletResponseImpl impleme
         checkSetStateChanged();
         String[] values = new String[]{value};
         responseContext.getRenderParameters().put(key, values);
-        if (isPublicRenderParameter(key))
+        if (responseContext.isPublicRenderParameter(windowId, key))
         {
-            QName qn = getQNameForPRPName(key);
-            responseContext.addPublicRenderParameter(qn, key, values);
+            responseContext.addPublicRenderParameter(windowId, key, values);
         }
     }
     
@@ -289,10 +288,9 @@ public abstract class StateAwareResponseImpl extends PortletResponseImpl impleme
         }
         checkSetStateChanged();
         responseContext.getRenderParameters().put(key, values);
-        if (isPublicRenderParameter(key))
+        if (responseContext.isPublicRenderParameter(windowId, key))
         {
-            QName qn = getQNameForPRPName(key);
-            responseContext.addPublicRenderParameter(qn, key, values);
+            responseContext.addPublicRenderParameter(windowId, key, values);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/14800b56/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletStateAwareResponseContextImpl.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletStateAwareResponseContextImpl.java b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletStateAwareResponseContextImpl.java
index 560ddac..a9c75bf 100644
--- a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletStateAwareResponseContextImpl.java
+++ b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletStateAwareResponseContextImpl.java
@@ -18,8 +18,10 @@ package org.apache.pluto.driver.services.container;
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -59,7 +61,17 @@ public abstract class PortletStateAwareResponseContextImpl extends PortletRespon
                                                 HttpServletResponse containerResponse, PortletWindow window)
     {
         super(container, containerRequest, containerResponse, window);
+        if (isDebug) {
+           LOGGER.debug("Creating PortletURLProviderImpl.");
+        }
+        
         this.portletURLProvider = new PortletURLProviderImpl(getPortalURL(), PortletURLProvider.TYPE.RENDER, window);
+        
+        if (isDebug) {
+           LOGGER.debug("Done! created PortletURLProviderImpl.");
+           String txt = portletURLProvider.logSomething();
+           LOGGER.debug("URL Provider said: " + txt);
+        }
     }
     
     protected PortletURLProvider getPortletURLProvider()
@@ -73,10 +85,22 @@ public abstract class PortletStateAwareResponseContextImpl extends PortletRespon
         if (!isClosed())
         {
             super.close();
+            if (isDebug) {
+               LOGGER.debug("Filtering the URL.");
+            }
             new PortletURLImpl(this, portletURLProvider).filterURL();
-            PortalURL url = portletURLProvider.apply();
-            PortalRequestContext.getContext(getServletRequest()).mergePortalURL(url, getPortletWindow().getId().getStringId());
-        }
+            if (isDebug) {
+               LOGGER.debug("Applying the changes.");
+            }
+           PortalURL url = portletURLProvider.apply();
+           if (isDebug) {
+              LOGGER.debug("Merging.");
+           }
+           PortalRequestContext.getContext(getServletRequest()).mergePortalURL(url, getPortletWindow().getId().getStringId());
+           if (isDebug) {
+              LOGGER.debug("exiting.");
+           }
+       }
     }
     
     @Override
@@ -147,7 +171,9 @@ public abstract class PortletStateAwareResponseContextImpl extends PortletRespon
              .append(", values = ").append(Arrays.toString(values));
           LOGGER.debug(txt.toString());
        }
-       portletURLProvider.addPublicRenderParameter(qn, identifier, values);
+       if (!isClosed()) {
+          portletURLProvider.addPublicRenderParameter(qn, identifier, values);
+       }
     }
 
     /* (non-Javadoc)
@@ -157,14 +183,102 @@ public abstract class PortletStateAwareResponseContextImpl extends PortletRespon
        if (isDebug) {
           LOGGER.debug("Remove PRP. QName = " + qn.toString());
        }
-       portletURLProvider.removePublicRenderParameter(qn, id);
+       if (!isClosed()) {
+          portletURLProvider.removePublicRenderParameter(qn, id);
+       }
+    }
+    
+    /**
+     * Add a public render parameter for given window ID and parameter name
+     *  
+     * @param qn           QName
+     * @param identifier   Identifier for PRP
+     * @param values       values array
+     */
+    public void addPublicRenderParameter(String windowId, String name, String[] values) {
+       if (!isClosed()) {
+          portletURLProvider.addPublicRenderParameter(windowId, name, values);
+       }
+    }
+    
+    /**
+     * Remove the PRP for the given window ID and parameter name
+     * 
+     * @param windowId
+     * @param name
+     */
+    public void removePublicRenderParameter(String windowId, String name) {
+       if (!isClosed()) {
+          portletURLProvider.removeParameter(windowId, name);
+       }
+    }
+    
+    /**
+     * Returns <code>true</code> if the given name representa a public render
+     * parameter for the given window.
+     * 
+     * @param windowId
+     * @param name
+     * @return
+     */
+    public boolean isPublicRenderParameter(String windowId, String name) {
+       boolean ret = false;
+       if (!isClosed()) {
+          ret = portletURLProvider.isPublicRenderParameter(windowId, name);
+       }
+       return ret;
+    }
+    
+    /**
+     * Retrieves the available private parameter names for the given window ID
+     * @param windowId
+     * @return
+     */
+    public Set<String> getParameterNames(String windowId) {
+       Set<String> pns = new HashSet<String>();
+       if (!isClosed()) {
+          pns = portletURLProvider.getParameterNames(windowId);
+       }
+       return pns;
+    }
+    
+    /**
+     * Gets the values array for the given window ID and private parameter name
+     * @param windowId
+     * @param name
+     * @return
+     */
+    public String[] getParameterValues(String windowId, String name) {
+       String[] vals = new String[0];
+       if (!isClosed()) {
+          vals = portletURLProvider.getParameterValues(windowId, name);
+       }
+       return vals;
     }
 
     /**
-     * Clear public render parameters except those marked for removal 
+     * Adds the specified private parameter if not already present, or updates the
+     * values for the parameter if it is already present.
+     * @param windowId
+     * @param name
+     * @param values
      */
-    public void clearPublicRenderParameters() {
-       portletURLProvider.clearPublicRenderParameters();
+    public void setParameter(String windowId, String name, String[] values) {
+       if (!isClosed()) {
+          portletURLProvider.setParameter(windowId, name, values);
+       }
+    }
+    
+    /** 
+     * Removes the private parameter for the given window and name. Does nothing if the
+     * given parameter is not present.
+     * @param windowId
+     * @param name
+     */
+    public void removeParameter(String windowId, String name) {
+       if (!isClosed()) {
+          portletURLProvider.removeParameter(windowId, name);
+       }
     }
 
 }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/14800b56/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletURLProviderImpl.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletURLProviderImpl.java b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletURLProviderImpl.java
index e6aad68..8328e20 100644
--- a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletURLProviderImpl.java
+++ b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletURLProviderImpl.java
@@ -36,226 +36,285 @@ import javax.xml.namespace.QName;
 
 import org.apache.pluto.container.PortletURLProvider;
 import org.apache.pluto.container.PortletWindow;
+import org.apache.pluto.driver.services.portal.PublicRenderParameterMapper;
 import org.apache.pluto.driver.url.PortalURL;
 import org.apache.pluto.driver.url.PortalURL.URLType;
 import org.apache.pluto.driver.url.PortalURLParameter;
 import org.apache.pluto.driver.url.PortalURLPublicParameter;
+import org.apache.pluto.driver.url.PortletParameterFactory;
 
 /**
  *
  */
-public class PortletURLProviderImpl implements PortletURLProvider
-{
-    private final Logger LOGGER = LoggerFactory.getLogger(PortletURLProviderImpl.class);
-    private final boolean isDebug = LOGGER.isDebugEnabled();
-
-    private final PortalURL url;
-    private final TYPE type;
-    private final String window;
-    private PortletMode portletMode;
-    private WindowState windowState;
-    private String cacheLevel = ResourceURL.PAGE;     // default
-    private String resourceID;
-    private Map<String, String[]> renderParameters;
-    private Map<String, List<String>> properties;
-    
-    private final Set<PortalURLPublicParameter> prpSet = new HashSet<PortalURLPublicParameter>();
-    
-    /**
-     * Returns <code>true</code> if given parameter name is a public render parameter
-     * 
-     * @param name
-     */
-    private boolean isPRP(String name) {
-       boolean found = false;
-       for (PortalURLPublicParameter prp : prpSet) {
-          if (name.equals(prp.getName())) {
-             found = true;
-             break;
-          }
-       }
-       return found;
-    }
-
-    public PortletURLProviderImpl(PortalURL url, TYPE type, PortletWindow portletWindow)
-    {
-        this.url = url.clone();
-        this.type = type;
-        this.window = portletWindow.getId().getStringId();
-    }
-    
-    public PortalURL apply()
-    {
-        if (PortletURLProvider.TYPE.ACTION == type)
-        {
-           url.setTargetWindow(window);
-           url.setType(URLType.Action);
-        }
-        else if (PortletURLProvider.TYPE.RESOURCE == type)
-        {
-           url.setTargetWindow(window);
-           url.setType(URLType.Resource);
-           url.clearResourceParameters(window);
-        }
-        else
-        {
-            url.setTargetWindow(window);
-            url.setType(URLType.Render);
-            url.clearParameters(window);
-        }
-        if (portletMode != null)
-        {
-            url.setPortletMode(window, portletMode);
-        }
-        if (windowState != null)
-        {
-            url.setWindowState(window, windowState);
-        }
-        if (renderParameters != null)
-        {
-            for (Map.Entry<String,String[]> entry : renderParameters.entrySet())
-            {
-                if (!isPRP(entry.getKey()))
-                {
-                    url.addParameter(new PortalURLParameter(window, entry.getKey(), entry.getValue()));
-                }
+public class PortletURLProviderImpl implements PortletURLProvider {
+   private final Logger   LOGGER     = LoggerFactory.getLogger(PortletURLProviderImpl.class);
+   private final boolean  isDebug    = LOGGER.isDebugEnabled();
+
+   private final PortalURL                     url;
+   private final PublicRenderParameterMapper   prpMapper;
+   private final PortletParameterFactory       parmFactory;
+
+   private final TYPE                          type;
+   private final String                        window;
+   private PortletMode                         portletMode;
+   private WindowState                         windowState;
+   private String                              cacheLevel = ResourceURL.PAGE;                            // default
+   private String                              resourceID;
+   private Map<String, String[]>               renderParameters;
+   private Map<String, List<String>>           properties;
+
+   private final Set<PortalURLPublicParameter> prpSet     = new HashSet<PortalURLPublicParameter>();
+
+   public PortletURLProviderImpl(PortalURL url, TYPE type,
+         PortletWindow portletWindow) {
+      this.url = url.clone();
+      this.type = type;
+      this.window = portletWindow.getId().getStringId();
+
+      parmFactory = url.getPortletParameterFactory();
+      prpMapper = url.getPublicRenderParameterMapper();
+
+      if (isDebug) {
+         StringBuilder txt = new StringBuilder("Constructed PortalURLProviderImpl. ");
+         txt.append("type=").append(type);
+         txt.append(", URL type=").append(url.getType());
+         txt.append(", target=").append(url.getTargetWindow());
+         LOGGER.debug(txt.toString());
+      }
+   }
+   
+   public String logSomething() {
+      LOGGER.debug("Here is a debug message from " + this.getClass().getCanonicalName());
+      LOGGER.warn("Here is a message from " + this.getClass().getCanonicalName());
+      LOGGER.error("Here is a 'debug' !string, how is that?");
+      StringBuilder txt = new StringBuilder();
+      txt.append("Info about logger. isDebug=").append(isDebug);
+      txt.append(", Name=").append(LOGGER.getName());
+      txt.append(", Root Logger Name=").append(LOGGER.ROOT_LOGGER_NAME);
+      return txt.toString();
+   }
+
+   /**
+    * Returns <code>true</code> if given parameter name is a public render
+    * parameter
+    * 
+    * @param name
+    */
+   private boolean isPRP(String name) {
+      boolean found = false;
+      for (PortalURLPublicParameter prp : prpSet) {
+         if (name.equals(prp.getName())) {
+            found = true;
+            break;
+         }
+      }
+      return found;
+   }
+
+   public PortalURL apply() {
+
+      url.setTargetWindow(window);
+      switch (type) {
+      case ACTION:
+         url.setType(URLType.Action);
+         break;
+      case RESOURCE:
+         url.setType(URLType.Resource);
+         url.clearResourceParameters(window);
+         url.setCacheability(ResourceURL.PAGE);
+         break;
+      default:
+         url.setType(URLType.Render);
+         url.clearParameters(window);
+      }
+
+      if (isDebug) {
+         StringBuilder txt = new StringBuilder("apply URL values: ");
+         txt.append("type=").append(type);
+         txt.append(", URL type=").append(url.getType());
+         txt.append(", target=").append(url.getTargetWindow());
+         LOGGER.debug(txt.toString());
+      }
+      if (renderParameters != null) {
+         for (Map.Entry<String, String[]> entry : renderParameters.entrySet()) {
+            if (!isPRP(entry.getKey())) {
+               url.addParameter(new PortalURLParameter(window, entry.getKey(),
+                     entry.getValue()));
             }
-        }
-        for (PortalURLPublicParameter prp : prpSet) {
-           url.addPublicRenderParameter(prp);
-        }
-        url.setResourceID(resourceID);
-        url.setCacheability(cacheLevel);
-        return url;
-    }
-    
-    public TYPE getType()
-    {
-        return type;
-    }
-    
-    public void setPortletMode(PortletMode mode)
-    {
-        this.portletMode = mode;
-    }
-    
-    public PortletMode getPortletMode()
-    {
-        return portletMode;
-    }
-
-    public void setWindowState(WindowState state)
-    {
-        this.windowState = state;
-    }
-
-    public WindowState getWindowState()
-    {
-        return windowState;
-    }
-
-    public void setSecure(boolean secure) throws PortletSecurityException {
-        // ignore: not supported
-    }
-    
-    public boolean isSecure()
-    {
-        return false;
-    }
-    
-    public Map<String,String[]> getRenderParameters()
-    {
-        if (renderParameters == null)
-        {
-            renderParameters = new HashMap<String,String[]>();
-        }
-        return renderParameters;
-    }
-    
-    public String getCacheability()
-    {
-        return cacheLevel;
-    }
-
-    public void setCacheability(String cacheLevel)
-    {
-        this.cacheLevel = cacheLevel;
-    }
-
-    public String getResourceID()
-    {
-        return resourceID;
-    }
-
-    public void setResourceID(String resourceID)
-    {
-        this.resourceID = resourceID;
-    }
-    
-    public String toURL()
-    {
-        return toURL(false);
-    }
-
-    public String toURL(boolean absolute)
-    {
-        return apply().toURL(absolute);
-    }
-
-    public void write(Writer out, boolean escapeXML) throws IOException
-    {
-        String result = apply().toURL(false);
-        if (escapeXML)
-        {
-            result = result.replaceAll("&", "&amp;");
-            result = result.replaceAll("<", "&lt;");
-            result = result.replaceAll(">", "&gt;");
-            result = result.replaceAll("\'", "&#039;");
-            result = result.replaceAll("\"", "&#034;");
-        }
-        out.write(result);
-    }
-
-    public Map<String, List<String>> getProperties()
-    {
-        if (properties == null)
-        {
-            properties = new HashMap<String, List<String>>();
-        }
-        return properties;
-    }
-
-   /* (non-Javadoc)
-    * @see org.apache.pluto.container.PortletURLProvider#addPublicRenderParameter(javax.xml.namespace.QName, java.lang.String, java.lang.String[])
+         }
+      }
+      for (PortalURLPublicParameter prp : prpSet) {
+         url.addPublicRenderParameter(prp);
+      }
+      return url;
+   }
+
+   public TYPE getType() {
+      return type;
+   }
+
+   public void setPortletMode(PortletMode mode) {
+      url.setPortletMode(window, mode);
+   }
+
+   public PortletMode getPortletMode() {
+      return url.getPortletMode(window);
+   }
+
+   public void setWindowState(WindowState state) {
+      url.setWindowState(window, state);
+   }
+
+   public WindowState getWindowState() {
+      return url.getWindowState(window);
+   }
+
+   public void setSecure(boolean secure) throws PortletSecurityException {
+      // ignore: not supported
+   }
+
+   public boolean isSecure() {
+      return false;
+   }
+
+   public Map<String, String[]> getRenderParameters() {
+      if (renderParameters == null) {
+         renderParameters = new HashMap<String, String[]>();
+      }
+      return renderParameters;
+   }
+
+   public String getCacheability() {
+      return url.getCacheability();
+   }
+
+   public void setCacheability(String cacheLevel) {
+      url.setCacheability(cacheLevel);
+   }
+
+   public String getResourceID() {
+      return url.getResourceID();
+   }
+
+   public void setResourceID(String resourceID) {
+      url.setCacheability(resourceID);
+   }
+
+   public String toURL() {
+      return toURL(false);
+   }
+
+   public String toURL(boolean absolute) {
+      return apply().toURL(absolute);
+   }
+
+   public void write(Writer out, boolean escapeXML) throws IOException {
+      String result = apply().toURL(false);
+      if (escapeXML) {
+         result = result.replaceAll("&", "&amp;");
+         result = result.replaceAll("<", "&lt;");
+         result = result.replaceAll(">", "&gt;");
+         result = result.replaceAll("\'", "&#039;");
+         result = result.replaceAll("\"", "&#034;");
+      }
+      out.write(result);
+   }
+
+   public Map<String, List<String>> getProperties() {
+      if (properties == null) {
+         properties = new HashMap<String, List<String>>();
+      }
+      return properties;
+   }
+
+   /*
+    * (non-Javadoc)
+    * 
+    * @see
+    * org.apache.pluto.container.PortletURLProvider#addPublicRenderParameter
+    * (javax.xml.namespace.QName, java.lang.String, java.lang.String[])
     */
-   public void addPublicRenderParameter(QName qn, String identifier, String[] values) 
-   {
+   public void addPublicRenderParameter(QName qn, String identifier,
+         String[] values) {
       if (isDebug) {
          StringBuilder txt = new StringBuilder("Add PRP. QName = ");
-         txt.append(qn.toString())
-         .append(", ID = ").append(identifier)
-         .append(", values = ").append(Arrays.toString(values));
+         txt.append(qn.toString()).append(", ID = ").append(identifier)
+               .append(", values = ").append(Arrays.toString(values));
          LOGGER.debug(txt.toString());
       }
-      PortalURLPublicParameter pupp = new PortalURLPublicParameter(window, identifier, qn, values);
+      PortalURLPublicParameter pupp = new PortalURLPublicParameter(window,
+            identifier, qn, values);
       prpSet.add(pupp);
    }
 
-   /* (non-Javadoc)
-    * @see org.apache.pluto.container.PortletURLProvider#removePublicRenderParameter(javax.xml.namespace.QName)
+   /*
+    * (non-Javadoc)
+    * 
+    * @see
+    * org.apache.pluto.container.PortletURLProvider#removePublicRenderParameter
+    * (javax.xml.namespace.QName)
     */
-   public void removePublicRenderParameter(QName qn, String identifier) 
-   {
+   public void removePublicRenderParameter(QName qn, String identifier) {
       if (isDebug) {
          LOGGER.debug("Remove PRP. QName = " + qn.toString());
       }
-      PortalURLPublicParameter pupp = new PortalURLPublicParameter(window, identifier, qn);
+      PortalURLPublicParameter pupp = new PortalURLPublicParameter(window,
+            identifier, qn);
       pupp.setRemoved(true);
       prpSet.add(pupp);
    }
 
+   public void addPublicRenderParameter(String windowId, String name,
+         String[] values) {
+      if (isDebug) {
+         StringBuilder txt = new StringBuilder("Add PRP. Window: ");
+         txt.append(windowId).append(", name: ").append(name)
+               .append(", values = ").append(Arrays.toString(values));
+         LOGGER.debug(txt.toString());
+      }
+      int index = prpMapper.getIndex(windowId, name);
+      if (index >= 0) {
+         prpMapper.setValues(index, values);
+      } else {
+         StringBuilder txt = new StringBuilder(
+               "Public render parameter for window: ");
+         txt.append(windowId).append(", name: ").append(name)
+               .append(" not found in mapper");
+         LOGGER.warn(txt.toString());
+      }
+   }
+
+   public void removePublicRenderParameter(String windowId, String name) {
+      if (isDebug) {
+         StringBuilder txt = new StringBuilder("Remove PRP. Window: ");
+         txt.append(windowId).append(", name: ").append(name);
+         LOGGER.debug(txt.toString());
+      }
+      int index = prpMapper.getIndex(windowId, name);
+      if (index >= 0) {
+         prpMapper.setRemoved(index, true);
+      } else {
+         StringBuilder txt = new StringBuilder(
+               "Public render parameter for window: ");
+         txt.append(windowId).append(", name: ").append(name)
+               .append(" not found in mapper");
+         LOGGER.warn(txt.toString());
+      }
+   }
+
+   public boolean isPublicRenderParameter(String windowId, String name) {
+      if (isDebug) {
+         StringBuilder txt = new StringBuilder(
+               "isPublicRenderParameter Window: ");
+         txt.append(windowId).append(", name: ").append(name);
+         LOGGER.debug(txt.toString());
+      }
+      int index = prpMapper.getIndex(windowId, name);
+      return (index >= 0);
+   }
+
    /**
-    * Clear public render parameters except those marked for removal 
+    * Clear public render parameters except those marked for removal
     */
    public void clearPublicRenderParameters() {
       for (PortalURLPublicParameter prp : prpSet) {
@@ -264,4 +323,24 @@ public class PortletURLProviderImpl implements PortletURLProvider
          }
       }
    }
+
+   public Set<String> getParameterNames(String windowId) {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   public String[] getParameterValues(String windowId, String name) {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   public void setParameter(String windowId, String name, String[] values) {
+      // TODO Auto-generated method stub
+
+   }
+
+   public void removeParameter(String windowId, String name) {
+      // TODO Auto-generated method stub
+
+   }
 }


Mime
View raw message