portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cdore...@apache.org
Subject svn commit: r589127 - /portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/
Date Sat, 27 Oct 2007 14:56:55 GMT
Author: cdoremus
Date: Sat Oct 27 07:56:53 2007
New Revision: 589127

URL: http://svn.apache.org/viewvc?rev=589127&view=rev
Log:
Updates pluto-container module to JSR-286 spec Rev 26 from updateToRev26_container_fixes102307.patch
 in PLUTO-404

Modified:
    portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ActionResponseImpl.java
    portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/BaseURLImpl.java
    portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletEntityImpl.java
    portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestDispatcherImpl.java
    portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestImpl.java
    portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletResponseImpl.java
    portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletSessionImpl.java
    portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletURLImpl.java
    portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletWindowImpl.java
    portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceRequestImpl.java
    portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceResponseImpl.java
    portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java

Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ActionResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ActionResponseImpl.java?rev=589127&r1=589126&r2=589127&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ActionResponseImpl.java
(original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ActionResponseImpl.java
Sat Oct 27 07:56:53 2007
@@ -17,14 +17,21 @@
 package org.apache.pluto.internal.impl;
 
 import java.io.IOException;
+import java.util.Iterator;
+import java.util.Set;
 
 import javax.portlet.ActionResponse;
+import javax.portlet.PortletModeException;
+import javax.portlet.PortletURL;
+import javax.portlet.WindowStateException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
 
 import org.apache.pluto.PortletContainer;
 import org.apache.pluto.internal.InternalActionResponse;
 import org.apache.pluto.internal.InternalPortletWindow;
+import org.apache.pluto.spi.ResourceURLProvider;
 
 public class ActionResponseImpl extends StateAwareResponseImpl
 implements ActionResponse, InternalActionResponse {
@@ -45,5 +52,67 @@
 		}
 		super.sendRedirect(location);
 	}
-	
+
+	public void sendRedirect(String location, String renderUrlParamName) throws IOException
{
+		
+        if (location != null) {
+            HttpServletResponse redirectResponse = getHttpServletResponse();
+            while (redirectResponse instanceof HttpServletResponseWrapper) {
+                redirectResponse = (HttpServletResponse)
+                    ((HttpServletResponseWrapper)redirectResponse).getResponse();
+            }
+
+            ResourceURLProvider provider = super.callback.getResourceURLProvider(
+                            getHttpServletRequest(),
+                            getInternalPortletWindow()
+            );
+
+            if (location.indexOf("://") != -1) {
+                provider.setAbsoluteURL(location);
+            } else {
+                provider.setFullPath(location);
+            }
+            location =
+            	redirectResponse.encodeRedirectURL(provider.toString());
+            //add the currently windows state, portlet mode, render parameter and current
public parameter
+            String renderURL = getCurrentRenderURL();
+            if (location.indexOf("?") != -1){
+            	//add the URL to the other Parameters
+            	location += "&" + renderUrlParamName + "=" +renderURL;
+            }
+            else{
+            	//first Query Parameter
+            	location += "?" + renderUrlParamName + "=" +renderURL;
+            }
+            
+            redirectResponse.sendRedirect(location);
+            super.redirected = true;
+        }
+	}
+	private String getCurrentRenderURL(){
+        PortletURL renderURL = createRenderURL();
+		try {
+			if (getPortletMode()!= null)
+				renderURL.setPortletMode(getPortletMode());
+			if (getWindowState() != null)
+				renderURL.setWindowState(getWindowState());
+			if (getRenderParameterMap()!= null)
+				renderURL.setParameters(getRenderParameterMap());
+			if (getPublicRenderParameter() != null){
+				Set<String> keys = getPublicRenderParameter().keySet();
+				if (keys != null){
+					for (String string : keys) {
+						renderURL.setParameter(string, getPublicRenderParameter().get(string));
+					}
+				}
+			}
+		} catch (PortletModeException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (WindowStateException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return renderURL.toString();
+	}
 }

Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/BaseURLImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/BaseURLImpl.java?rev=589127&r1=589126&r2=589127&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/BaseURLImpl.java
(original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/BaseURLImpl.java
Sat Oct 27 07:56:53 2007
@@ -39,7 +39,6 @@
 import org.apache.pluto.internal.InternalPortletWindow;
 import org.apache.pluto.spi.PortletURLListener;
 import org.apache.pluto.spi.PortletURLProvider;
-import org.apache.pluto.spi.PublicRenderParameterProvider;
 import org.apache.pluto.util.StringManager;
 import org.apache.pluto.util.StringUtils;
 
@@ -96,52 +95,42 @@
 	}
 	
 	public void setParameter(String name, String value) {
-	    if (name == null) {
+	    if (name == null || value == null) {
 	        throw new IllegalArgumentException(
 	            "name and value must not be null");
 	    }
-	    PublicRenderParameterProvider provider = container.getRequiredContainerServices().getPortalCallbackService().getPublicRenderParameterProvider();
-	    if (value == null){
-	    	if (provider.isPublicRenderParameter(internalPortletWindow.getId().getStringId(), name)){
-	    		publicRenderParameters.put(name,new String[] {null});
-		    	
-		    }
-	    	else{
-	    		throw new IllegalArgumentException(
-	            	"name and value must not be null");
-	    	}
-	    }
-	    
-	    if (provider.isPublicRenderParameter(internalPortletWindow.getId().getStringId(), name)){
-	    	publicRenderParameters.put(name,new String[] {value});
-	    }
-	    else{
+	    List<String> publicRenderParameterNames = internalPortletWindow.getPortletEntity().getPortletDefinition().getPublicRenderParameter();
+	    if (publicRenderParameterNames == null){
 	    	parameters.put(name, new String[]{value});
 	    }
+	    else{
+	    	if (publicRenderParameterNames.contains(name)){
+		    	publicRenderParameters.put(name,new String[] {value});
+		    }
+		    else{
+		    	parameters.put(name, new String[]{value});
+		    }
+		}
 	}
 
 	public void setParameter(String name, String[] values) {
-		if (name == null) {
+		if (name == null || values == null) {
 	        throw new IllegalArgumentException(
 	        	"name and values must not be null or values be an empty array");
 	    }
-	    PublicRenderParameterProvider provider = container.getRequiredContainerServices().getPortalCallbackService().getPublicRenderParameterProvider();
-	    if (values == null){
-	    	if (provider.isPublicRenderParameter(internalPortletWindow.getId().getStringId(), name)){
-	    		publicRenderParameters.put(name,new String[] {null});
-		    }
-	    	else{
-	    		throw new IllegalArgumentException(
-	    			"name and values must not be null or values be an empty array");
-	    	}
-	    }
+		List<String> publicRenderParameterNames = internalPortletWindow.getPortletEntity().getPortletDefinition().getPublicRenderParameter();
 	    
-	    if (provider.isPublicRenderParameter(internalPortletWindow.getId().getStringId(), name)){
-	    	publicRenderParameters.put(name,StringUtils.copy(values));
-	    }
-	    else{
-	    	parameters.put(name, StringUtils.copy(values));
+		if (publicRenderParameterNames == null){
+			parameters.put(name, StringUtils.copy(values));
 	    }
+		else{
+			if (publicRenderParameterNames.contains(name)){
+		    	publicRenderParameters.put(name,StringUtils.copy(values));
+		    }
+		    else{
+		    	parameters.put(name, StringUtils.copy(values));
+		    }
+		}
 	}
 
 	public void setParameters(Map<String, String[]> parameters) {

Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletEntityImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletEntityImpl.java?rev=589127&r1=589126&r2=589127&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletEntityImpl.java
(original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletEntityImpl.java
Sat Oct 27 07:56:53 2007
@@ -63,7 +63,7 @@
     private ServletContext servletContext = null;
     
     /** The portlet window. */
-    private PortletWindow portletWindow = null;
+    private String portletName = null;
 
     /** The cached PortletDD retrieved from the portlet descriptor registry. */
     private PortletDD portletDefinition = null;
@@ -74,9 +74,9 @@
     
     // Constructor -------------------------------------------------------------
     
-    PortletEntityImpl(ServletContext servletContext, PortletWindow portletWindow) {
+    PortletEntityImpl(ServletContext servletContext, String portletName) {
         this.servletContext = servletContext;
-        this.portletWindow = portletWindow;
+        this.portletName = portletName;
     }
     
     
@@ -87,7 +87,7 @@
      * @return the URI to the controller servlet that wraps this portlet.
      */
     public String getControllerServletUri() {
-        return PREFIX + portletWindow.getPortletName();
+        return PREFIX + portletName;
     }
     
     /**
@@ -172,24 +172,19 @@
      */
     private void load() {
     	
-    	// Retrieve the cross servlet context for the portlet.
-        String contextPath = portletWindow.getContextPath();
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Loading portlet definition for context: " + contextPath);
-        }
-        ServletContext crossContext = servletContext.getContext(contextPath);
+    	//Retrieve the cross servlet context for the portlet.
+        ServletContext crossContext = servletContext;
         if (LOG.isDebugEnabled()) {
             LOG.debug("Retrieved cross context: " + crossContext);
         }
-        
+
         // Load PortletAppDD and find out the portlet definition.
         try {
             PortletAppDD appDD = PortletDescriptorRegistry.getRegistry()
             		.getPortletAppDD(crossContext);
             for (Iterator it = appDD.getPortlets().iterator(); it.hasNext(); ) {
                 PortletDD portletDD = (PortletDD) it.next();
-                if (portletDD.getPortletName().equals(
-                		portletWindow.getPortletName())) {
+                if (portletDD.getPortletName().equals(portletName)) {
                 	portletDefinition = portletDD;
                 	break;
                 }

Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestDispatcherImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestDispatcherImpl.java?rev=589127&r1=589126&r2=589127&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestDispatcherImpl.java
(original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestDispatcherImpl.java
Sat Oct 27 07:56:53 2007
@@ -142,6 +142,8 @@
         	if (!namedDispatcher){
         		setAttributesForward(internalRequest);
         	}
+        	else
+        		removeAttributes(internalRequest);
         	internalResponse.setForwarded(true);
 
             requestDispatcher.forward((HttpServletRequest) internalRequest,
@@ -170,6 +172,8 @@
         	if (!namedDispatcher){
         		setAttributesInclude(internalRequest);
         	}
+        	else
+        		removeAttributes(internalRequest);
         	internalResponse.setIncluded(true);
 
             requestDispatcher.include(
@@ -188,7 +192,13 @@
         	internalResponse.setIncluded(isIncluded);
         }
     }
-
+	private void removeAttributes(InternalPortletRequest internalRequest){
+		internalRequest.removeAttribute("javax.servlet.forward.request_uri");
+		internalRequest.removeAttribute("javax.servlet.forward.context_path");
+		internalRequest.removeAttribute("javax.servlet.forward.servlet_path");
+		internalRequest.removeAttribute("javax.servlet.forward.path_info");
+		internalRequest.removeAttribute("javax.servlet.forward.query_string");
+	}
 	private void setAttributesForward(InternalPortletRequest internalRequest){
 		String context_path = internalRequest.getContextPath();
 		String request_uri = context_path + servlet_path + path_info;

Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestImpl.java?rev=589127&r1=589126&r2=589127&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestImpl.java
(original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletRequestImpl.java
Sat Oct 27 07:56:53 2007
@@ -55,7 +55,6 @@
 import org.apache.pluto.internal.InternalPortletWindow;
 import org.apache.pluto.internal.PortletEntity;
 import org.apache.pluto.spi.PortletURLProvider;
-import org.apache.pluto.spi.PublicRenderParameterProvider;
 import org.apache.pluto.util.ArgumentUtility;
 import org.apache.pluto.util.Enumerator;
 import org.apache.pluto.util.NamespaceMapper;

Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletResponseImpl.java?rev=589127&r1=589126&r2=589127&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletResponseImpl.java
(original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletResponseImpl.java
Sat Oct 27 07:56:53 2007
@@ -38,6 +38,7 @@
 import org.apache.pluto.util.NamespaceMapper;
 import org.apache.pluto.util.PrintWriterServletOutputStream;
 import org.apache.pluto.util.impl.NamespaceMapperImpl;
+import org.w3c.dom.DOMException;
 import org.w3c.dom.Element;
 
 /**
@@ -340,9 +341,14 @@
 		else
 			super.sendError(arg0, arg1);
 	}
+	
+	public Element createElement(String tagName) throws DOMException {
+		// TODO Auto-generated method stub
+		return null;
+	}
 // InternalRenderResponse Impl ---------------------------------------------
-    
-    public void setIncluded(boolean included) {
+
+	public void setIncluded(boolean included) {
         this.included = included;
     }
 

Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletSessionImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletSessionImpl.java?rev=589127&r1=589126&r2=589127&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletSessionImpl.java
(original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletSessionImpl.java
Sat Oct 27 07:56:53 2007
@@ -344,4 +344,42 @@
 	public void setIncludeOrForward(boolean isIncludeOrForward) {
 		this.isIncludeOrForward = isIncludeOrForward;
 	}
+	/** 
+	   * Returns a <code>Map</code> of the session attributes in
+	   * the portlet session scope.
+	   * <p>
+	   * The keys are of type <code>String</code> and the values in the 
+	   * returned <code>Map</code> are from type <code>Object</code>.
+	   * <p>
+	   * If no session attributes exist this method returns an empty <code>Map</code>.
+	   *
+	   * @return     an immutable <code>Map</code> containing the session attributes
in the  
+	   *             portlet session scope as keys and attribute values as map values, or an
empty <code>Map</code>
+	   *             if no session attributes exist. The keys in the
+	   *             map are of type String, the values of type
+	   *             Object.
+	   *  @since 2.0
+	   */
+	  public Map<String, Object> getAttributeMap(int scope){
+		  return null; 
+	  }
+	  /** 
+	   * Returns a <code>Map</code> of the session attributes in
+	   * the portlet session scope.
+	   * <p>
+	   * The keys are of type <code>String</code> and the values in the 
+	   * returned <code>Map</code> are from type <code>Object</code>.
+	   * <p>
+	   * If no session attributes exist this method returns an empty <code>Map</code>.
+	   *
+	   * @return     an immutable <code>Map</code> containing the session attributes
in the  
+	   *             portlet session scope as keys and attribute values as map values, or an
empty <code>Map</code>
+	   *             if no session attributes exist. The keys in the
+	   *             map are of type String, the values of type
+	   *             Object.
+	   *  @since 2.0
+	   */
+	  public Map<String, Object> getAttributeMap(){
+		  return null;
+	  }
 }

Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletURLImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletURLImpl.java?rev=589127&r1=589126&r2=589127&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletURLImpl.java
(original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletURLImpl.java
Sat Oct 27 07:56:53 2007
@@ -15,6 +15,8 @@
  */
 package org.apache.pluto.internal.impl;
 
+import java.util.List;
+
 import javax.portlet.PortletMode;
 import javax.portlet.PortletModeException;
 import javax.portlet.PortletURL;
@@ -58,5 +60,20 @@
         isPortletModeAllowed(portletMode);
         mode = portletMode;
     }
+
+	public void removePublicRenderParameter(String name) {
+		// TODO Auto-generated method stub
+		List<String> publicRenderParameterNames = internalPortletWindow.getPortletEntity().getPortletDefinition().getPublicRenderParameter();
+	    
+	    if (publicRenderParameterNames != null){
+	    	if (publicRenderParameterNames.contains(name)){
+	    		publicRenderParameters.put(name,new String[] {null});
+		    }
+	    	else{
+	    		throw new IllegalArgumentException(
+	            	"name and value must not be null");
+	    	}
+	    }
+	}
 
 }

Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletWindowImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletWindowImpl.java?rev=589127&r1=589126&r2=589127&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletWindowImpl.java
(original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/PortletWindowImpl.java
Sat Oct 27 07:56:53 2007
@@ -107,7 +107,7 @@
 
     public PortletEntity getPortletEntity() {
         if (entity == null) {
-            entity = new PortletEntityImpl(servletContext, this);
+            entity = new PortletEntityImpl(servletContext, this.getPortletName() );
         }
         return entity;
     }

Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceRequestImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceRequestImpl.java?rev=589127&r1=589126&r2=589127&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceRequestImpl.java
(original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceRequestImpl.java
Sat Oct 27 07:56:53 2007
@@ -18,6 +18,7 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.Map;
 
 import javax.portlet.PortletPreferences;
 import javax.portlet.ResourceRequest;
@@ -167,4 +168,8 @@
 	public ServletInputStream getInputStream() throws IOException {
         return (super.isIncluded() || super.isForwarded()) ? (ServletInputStream)getPortletInputStream()
: super.getInputStream();
     }
+
+	public Map<String, String[]> getPrivateRenderParameterMap() {
+		return super.getPrivateParameterMap();
+	}
 }

Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceResponseImpl.java?rev=589127&r1=589126&r2=589127&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceResponseImpl.java
(original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/ResourceResponseImpl.java
Sat Oct 27 07:56:53 2007
@@ -97,5 +97,10 @@
 	@Override
 	public String getContentType() {
         return getHttpServletResponse().getContentType();
-    }	
+    }
+
+	public String getCacheability() {
+		// TODO Auto-generated method stub
+		return null;
+	}	
 }

Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java?rev=589127&r1=589126&r2=589127&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java
(original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-container/src/main/java/org/apache/pluto/internal/impl/StateAwareResponseImpl.java
Sat Oct 27 07:56:53 2007
@@ -18,20 +18,20 @@
 
 import java.io.IOException;
 import java.io.PrintWriter;
-import java.io.Serializable; 
+import java.io.Serializable;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
-import java.util.Map; 
+import java.util.Map;
 
 import javax.portlet.PortalContext;
 import javax.portlet.PortletMode;
 import javax.portlet.PortletModeException;
 import javax.portlet.StateAwareResponse;
 import javax.portlet.WindowState;
-import javax.portlet.WindowStateException; 
+import javax.portlet.WindowStateException;
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -48,7 +48,6 @@
 import org.apache.pluto.internal.InternalPortletWindow;
 import org.apache.pluto.spi.EventProvider;
 import org.apache.pluto.spi.PortalCallbackService;
-import org.apache.pluto.spi.PublicRenderParameterProvider;
 import org.apache.pluto.spi.ResourceURLProvider;
 import org.apache.pluto.util.StringUtils;
 
@@ -64,7 +63,7 @@
     private static final Log LOG = LogFactory.getLog(StateAwareResponseImpl.class);
 
 	boolean redirectAllowed = true;
-	private boolean redirected;
+	protected boolean redirected;
 	private String redirectLocation;
     
 
@@ -73,7 +72,7 @@
     private Map<String, String[]> renderParameters = new HashMap<String, String[]>();
     private WindowState windowState = null;
     private PortletMode portletMode = null;
-	private PortalCallbackService callback;
+	protected PortalCallbackService callback;
     private PortalContext context;
     
 	public StateAwareResponseImpl(PortletContainer container,
@@ -160,7 +159,6 @@
             throw new java.lang.IllegalStateException(
                 "Can't invoke sendRedirect() after certain methods have been called");
         }
-
     }
 
     
@@ -248,24 +246,18 @@
                 "Can't invoke setRenderParameter() after sendRedirect() has been called");
         }
 
-        if ((key == null)) {
+        if ((key == null || value == null)) {
             throw new IllegalArgumentException(
                 "Render parameter key must not be null.");
         }
-        PublicRenderParameterProvider provider = getContainer().getRequiredContainerServices().getPortalCallbackService().getPublicRenderParameterProvider();
-        //only if the value is null, if it is a public parameter will deleted from list.
-        if (value == null){
-        	//test if this is a public render parameter
-        	if (provider.isPublicRenderParameter(getInternalPortletWindow().getId().getStringId(),
key)){
-        		publicRenderParameter.put(key, new String[] {null});
-        	}
-        	else{
-        		throw new IllegalArgumentException(
-                	"Render parameter value must not be null.");
-        	}
-        }
-        else if (provider.isPublicRenderParameter(getInternalPortletWindow().getId().getStringId(),
key)){
-        	publicRenderParameter.put(key, new String[] {value});
+        List<String> publicRenderParameterNames = super.getInternalPortletWindow().getPortletEntity().getPortletDefinition().getPublicRenderParameter();
+        if (publicRenderParameterNames != null){
+	    	if (publicRenderParameterNames.contains(key)){
+	        	publicRenderParameter.put(key, new String[] {value});
+	        }
+	        else{
+	        	renderParameters.put(key, new String[]{value});
+	        }
         }
         else{
         	renderParameters.put(key, new String[]{value});
@@ -279,23 +271,18 @@
                 "Can't invoke setRenderParameter() after sendRedirect() has been called");
         }        
         
-        if (key == null) {
+        if (key == null || values == null) {
 	        throw new IllegalArgumentException(
 	        	"name and values must not be null or values be an empty array");
 	    }
-	    PublicRenderParameterProvider provider = getContainer().getRequiredContainerServices().getPortalCallbackService().getPublicRenderParameterProvider();
-	    if (values == null){
-	    	if (provider.isPublicRenderParameter(getInternalPortletWindow().getId().getStringId(),
key)){
-	    		publicRenderParameter.put(key,new String[] {null});
+	    List<String> publicRenderParameterNames = super.getInternalPortletWindow().getPortletEntity().getPortletDefinition().getPublicRenderParameter();
+	    if (publicRenderParameterNames != null){
+		    if (publicRenderParameterNames.contains(key)){
+		    	publicRenderParameter.put(key,StringUtils.copy(values));
+		    }
+		    else{
+		    	renderParameters.put(key, StringUtils.copy(values));
 		    }
-	    	else{
-	    		throw new IllegalArgumentException(
-	    			"name and values must not be null or values be an empty array");
-	    	}
-	    }
-	    
-	    if (provider.isPublicRenderParameter(getInternalPortletWindow().getId().getStringId(),
key)){
-	    	publicRenderParameter.put(key,StringUtils.copy(values));
 	    }
 	    else{
 	    	renderParameters.put(key, StringUtils.copy(values));
@@ -597,4 +584,16 @@
 			return super.isCommitted();
 	}
 
+	public void removePublicRenderParameter(String name) {
+		List<String> publicRenderParameterNames = super.getInternalPortletWindow().getPortletEntity().getPortletDefinition().getPublicRenderParameter();
+		if (publicRenderParameterNames != null){
+			if (publicRenderParameterNames.contains(name)){
+	    		publicRenderParameter.put(name,new String[] {null});
+		    }
+	    	else{
+	    		throw new IllegalArgumentException(
+	    			"name and values must not be null or values be an empty array");
+	    	}
+		}
+	}
 }



Mime
View raw message