portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msnickl...@apache.org
Subject [30/38] portals-pluto git commit: Implemented ActionResponse#getRedirectURL() method. Added redirect portlet to the PortletV3Demo for demo and test.
Date Fri, 27 Nov 2015 12:38:11 GMT
Implemented ActionResponse#getRedirectURL() method. Added redirect portlet
to the PortletV3Demo for demo and test.


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

Branch: refs/heads/V3Prototype
Commit: 29448a1ff3213be5fcdad5756be95cc0dabe878e
Parents: 7fb0624
Author: Scott Nicklous <msnicklous@apache.org>
Authored: Thu Nov 19 15:24:41 2015 +0100
Committer: Scott Nicklous <msnicklous@apache.org>
Committed: Thu Nov 19 15:24:41 2015 +0100

----------------------------------------------------------------------
 PortletV3Demo/pom.xml                           |  12 +-
 .../src/main/java/basic/portlet/Constants.java  |   1 +
 .../java/basic/portlet/RedirectPortlet.java     | 108 ++++++
 .../src/main/webapp/WEB-INF/jsp/view-rdp.jsp    |  64 ++++
 .../src/main/webapp/WEB-INF/portlet.xml         |  18 +
 .../pluto/container/PortletResponseContext.java | 126 +++----
 .../container/impl/ActionResponseImpl.java      | 131 ++++---
 .../pluto/container/impl/BaseURLImpl.java       |   3 +-
 .../pluto/container/impl/PortletURLImpl.java    |   8 +-
 .../pluto/container/impl/RenderURLImpl.java     |   4 +-
 .../container/impl/StateAwareResponseImpl.java  |   3 +-
 .../PortletMimeResponseContextImpl.java         |   7 -
 .../container/PortletResponseContextImpl.java   | 351 ++++++++++---------
 13 files changed, 507 insertions(+), 329 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/29448a1f/PortletV3Demo/pom.xml
----------------------------------------------------------------------
diff --git a/PortletV3Demo/pom.xml b/PortletV3Demo/pom.xml
index 3ff5884..a957244 100644
--- a/PortletV3Demo/pom.xml
+++ b/PortletV3Demo/pom.xml
@@ -18,6 +18,12 @@
         <scope>provided</scope>
       </dependency>
       <dependency>
+         <groupId>org.apache.portals.pluto</groupId>
+         <artifactId>pluto-taglib</artifactId>
+         <version>${project.version}</version>
+         <scope>provided</scope>
+      </dependency>
+      <dependency>
          <groupId>org.apache.tomcat</groupId>
          <artifactId>tomcat-servlet-api</artifactId>
          <scope>provided</scope>
@@ -45,12 +51,6 @@
           <artifactId>taglibs-standard-jstlel</artifactId>
           <scope>provided</scope>
       </dependency>
-      <dependency>
-         <groupId>org.apache.portals.pluto</groupId>
-         <artifactId>pluto-taglib</artifactId>
-         <version>2.1.0-M3</version>
-         <scope>provided</scope>
-      </dependency>
    </dependencies>
 
    <build>

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/29448a1f/PortletV3Demo/src/main/java/basic/portlet/Constants.java
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/java/basic/portlet/Constants.java b/PortletV3Demo/src/main/java/basic/portlet/Constants.java
index 32c3b10..25bfec2 100644
--- a/PortletV3Demo/src/main/java/basic/portlet/Constants.java
+++ b/PortletV3Demo/src/main/java/basic/portlet/Constants.java
@@ -40,6 +40,7 @@ public class Constants {
    public final static String PARAM_FG_GREEN = "green";
    public final static String PARAM_FG_BLUE = "blue";
    public final static String PARAM_MSG_INPUT = "imsg";
+   public final static String PARAM_URL_INPUT = "url";
    
    public final static String PARAM_NUM_ACTIONS = "numActions";
 

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/29448a1f/PortletV3Demo/src/main/java/basic/portlet/RedirectPortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/java/basic/portlet/RedirectPortlet.java b/PortletV3Demo/src/main/java/basic/portlet/RedirectPortlet.java
new file mode 100644
index 0000000..a983a6e
--- /dev/null
+++ b/PortletV3Demo/src/main/java/basic/portlet/RedirectPortlet.java
@@ -0,0 +1,108 @@
+/*  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 basic.portlet;
+
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.portlet.ActionParameters;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.ActionURL;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.RenderParameters;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.RenderURL;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+
+import static javax.portlet.MimeResponse.Copy.*;
+import static basic.portlet.Constants.*;
+
+/**
+ * Portlet for testing the redirect funtionality, including the new getRedirectURL API.
+ */
+public class RedirectPortlet extends GenericPortlet {
+
+   private static final Logger  LOGGER  = Logger.getLogger(RedirectPortlet.class.getName());
+   private static final boolean isDebug = LOGGER.isLoggable(Level.FINE);
+
+   protected void doView(RenderRequest req, RenderResponse resp) throws PortletException,
IOException {
+
+      resp.setContentType("text/html");
+      
+      // provide an action URL to the JSP as a workaround, since the tag library is still
JSR 286
+      ActionURL aurl = resp.createActionURL(ALL);
+      req.setAttribute(ATTRIB_ACTURL, aurl.toString());
+
+      PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/view-rdp.jsp");
+      rd.include(req, resp);
+
+   }
+
+   /*
+    * (non-Javadoc)
+    * 
+    * @see javax.portlet.GenericPortlet#serveResource(javax.portlet.ResourceRequest, javax.portlet.ResourceResponse)
+    */
+   @Override
+   public void serveResource(ResourceRequest req, ResourceResponse resp) throws PortletException,
IOException {
+   }
+
+   public void processAction(ActionRequest req, ActionResponse resp) throws PortletException,
IOException {
+
+      ActionParameters ap = req.getActionParameters();
+      RenderParameters rp = req.getRenderParameters();
+
+      StringBuilder txt = new StringBuilder(128);
+      if (isDebug) {
+         txt.append("Action parms: ").append(ap.getNames());
+         txt.append(", Render parms: ").append(rp.getNames());
+         txt.append(", Color: ").append(rp.getValue(PARAM_COLOR));
+      }
+
+      String color = ap.getValue(PARAM_COLOR);
+      if (color != null && color.length() > 0) {
+         if (!color.matches("^#(?:[A-Fa-f0-9]{3}){1,2}$")) {
+            color = "FDD";
+         }
+      }
+      
+      String url = ap.getValue(PARAM_URL_INPUT);
+      if (url == null || url.length() <= 0) {
+         RenderURL rurl = resp.getRedirectURL(ALL);
+         rurl.getRenderParameters().setValue(PARAM_COLOR, color);
+         url = rurl.toString();
+         if (isDebug) {
+            txt.append(", redirecting to redirect URL with new color=").append(color);
+         }
+      }
+      resp.sendRedirect(url);
+      
+      if (isDebug) {
+         LOGGER.fine(txt.toString());
+      }
+
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/29448a1f/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-rdp.jsp
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-rdp.jsp b/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-rdp.jsp
new file mode 100644
index 0000000..7e8d59b
--- /dev/null
+++ b/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-rdp.jsp
@@ -0,0 +1,64 @@
+<%--
+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.
+--%>
+<%@ page session="false" %>
+<%@ taglib uri="http://xmlns.jcp.org/portlet_3_0"  prefix="portlet" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ page import="static basic.portlet.Constants.*" %>
+
+<portlet:defineObjects />
+
+<% 
+   String clr = renderRequest.getRenderParameters().getValue(PARAM_COLOR);
+   if (clr == null) {
+      clr = "#FFF";
+   }
+%>
+
+<div style='background-color:<%=clr %>; padding:8px;'>
+<h3>V3 Redirect Portlet</h3><hr/>
+<p>
+Portlet to demo the V3 action response redirect functionality. You can enter a redirect that
the
+processAction method will redirect to along with a color value. If a redirect URL is entered,
the portlet
+will redirect to that URL.
+</p><p> 
+If no URL is entered, the portlet will obtain a redirect URL, which is 
+basically a render URL to itself, and redirect to that URL to refresh the page. If a color

+value is entered, it will be set as a render parameter on the redirect URL.
+The color will be set as background color for the portlet, so you can see the effect of the
+redirect.
+</p>
+<!-- Note that the action URL is provided to the JSP by the render method as a workaround,

+     since the tag lib is still at JSR 286 level. -->
+<form method='POST'  enctype='application/x-www-form-urlencoded' action="<%=renderRequest.getAttribute(ATTRIB_ACTURL)
%>">
+  <table><tr>
+     <td align='left'>Enter background color :</td>
+     <td>
+        <input id='<portlet:namespace/>-color' name='<%=PARAM_COLOR%>' type='text'
value='' size='10' maxlength='10'>
+     </td>
+     <td>
+     <div id='<portlet:namespace/>-putMsgHere'></div>
+   </td></tr><tr><td>
+   Enter URL:
+   </td><td colspan=3>
+   <input id='<portlet:namespace/>-msg' name='<%=PARAM_URL_INPUT%>' type='text'
value='' size='50' maxlength='50'>
+   </td></tr><tr><td>
+   <INPUT id ='<portlet:namespace/>-send' VALUE='redirect' TYPE='submit'>
+   </td></tr></table>
+</FORM>
+</div>

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/29448a1f/PortletV3Demo/src/main/webapp/WEB-INF/portlet.xml
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/webapp/WEB-INF/portlet.xml b/PortletV3Demo/src/main/webapp/WEB-INF/portlet.xml
index 48462f6..d1217a2 100644
--- a/PortletV3Demo/src/main/webapp/WEB-INF/portlet.xml
+++ b/PortletV3Demo/src/main/webapp/WEB-INF/portlet.xml
@@ -94,6 +94,24 @@
    </portlet>
 
    <portlet>
+      <portlet-name>V3RedirectPortlet</portlet-name>
+      <display-name>Redirect Test Portlet</display-name>
+      
+      <portlet-class>basic.portlet.RedirectPortlet</portlet-class>
+
+      <supports>
+         <mime-type>text/html</mime-type>
+         <portlet-mode>VIEW</portlet-mode>
+      </supports>
+
+      <supported-locale>en</supported-locale>        
+
+      <portlet-info>
+         <title>Redirect Test Portlet</title>
+      </portlet-info>
+   </portlet>
+
+   <portlet>
       <portlet-name>PortletConfigPortlet1</portlet-name>
       <display-name>Portlet Config Portlet #1</display-name>
       

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/29448a1f/pluto-container-api/src/main/java/org/apache/pluto/container/PortletResponseContext.java
----------------------------------------------------------------------
diff --git a/pluto-container-api/src/main/java/org/apache/pluto/container/PortletResponseContext.java
b/pluto-container-api/src/main/java/org/apache/pluto/container/PortletResponseContext.java
index c3718e1..8d48f14 100644
--- a/pluto-container-api/src/main/java/org/apache/pluto/container/PortletResponseContext.java
+++ b/pluto-container-api/src/main/java/org/apache/pluto/container/PortletResponseContext.java
@@ -1,62 +1,64 @@
-/*
- * 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;
-
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Element;
-
-/**
- * @author <a href="mailto:ate@douma.nu">Ate Douma</a>
- * @version $Id$
- */
-public interface PortletResponseContext
-{
-    void init(HttpServletRequest servletRequest, HttpServletResponse servletResponse);
-    PortletContainer getContainer();
-    HttpServletRequest getContainerRequest();
-    HttpServletResponse getContainerResponse();
-    HttpServletRequest getServletRequest();
-    HttpServletResponse getServletResponse();
-    PortletWindow getPortletWindow();
-    
-    ResourceURLProvider getResourceURLProvider();
-    void addProperty(Cookie cookie);
-    void addProperty(String key, Element element);
-    void addProperty(String key, String value);
-    void setProperty(String key, String value);
-    Element createElement(String tagName) throws DOMException;
-
-    /**
-     * Closing the response context means processing has been completed and
-     * internal storage can be flushed and written out to the Portal.
-     * It is not required for the Portal to do internal buffering, except for
-     * the PortletEventResponseContext as the portlet spec explicitely states that
-     * any changes during a processEvent should be ignored if an exception occurs,
-     * in which case the portlet container should only call release() and not close().
-     */
-    void close();
-    
-    /**
-     * Releasing the response context means its internal storage can be released as well.
-     * If any outstanding changes have not been processed yet, those will be lost.
-     */
-    void release();
-}
+/*
+ * 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;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.pluto.container.PortletURLProvider.TYPE;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Element;
+
+/**
+ * @author <a href="mailto:ate@douma.nu">Ate Douma</a>
+ * @version $Id$
+ */
+public interface PortletResponseContext
+{
+    void init(HttpServletRequest servletRequest, HttpServletResponse servletResponse);
+    PortletContainer getContainer();
+    HttpServletRequest getContainerRequest();
+    HttpServletResponse getContainerResponse();
+    HttpServletRequest getServletRequest();
+    HttpServletResponse getServletResponse();
+    PortletWindow getPortletWindow();
+    
+    ResourceURLProvider getResourceURLProvider();
+    PortletURLProvider getPortletURLProvider(TYPE type);
+    void addProperty(Cookie cookie);
+    void addProperty(String key, Element element);
+    void addProperty(String key, String value);
+    void setProperty(String key, String value);
+    Element createElement(String tagName) throws DOMException;
+
+    /**
+     * Closing the response context means processing has been completed and
+     * internal storage can be flushed and written out to the Portal.
+     * It is not required for the Portal to do internal buffering, except for
+     * the PortletEventResponseContext as the portlet spec explicitely states that
+     * any changes during a processEvent should be ignored if an exception occurs,
+     * in which case the portlet container should only call release() and not close().
+     */
+    void close();
+    
+    /**
+     * Releasing the response context means its internal storage can be released as well.
+     * If any outstanding changes have not been processed yet, those will be lost.
+     */
+    void release();
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/29448a1f/pluto-container/src/main/java/org/apache/pluto/container/impl/ActionResponseImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/impl/ActionResponseImpl.java
b/pluto-container/src/main/java/org/apache/pluto/container/impl/ActionResponseImpl.java
index a43e309..364cc6b 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/impl/ActionResponseImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/impl/ActionResponseImpl.java
@@ -26,82 +26,69 @@ import org.apache.pluto.container.PortletActionResponseContext;
 import org.apache.pluto.container.ResourceURLProvider;
 import org.apache.pluto.container.util.ArgumentUtility;
 
-public class ActionResponseImpl extends StateAwareResponseImpl implements ActionResponse
-{
-    private boolean stateChanged;
-    protected boolean redirected;
-    
-    public ActionResponseImpl(PortletActionResponseContext responseContext)
-    {
-        super(responseContext);
-    }
+public class ActionResponseImpl extends StateAwareResponseImpl implements ActionResponse
{
+   private boolean   stateChanged;
+   protected boolean redirected;
 
-    protected void checkSetRedirected()
-    {
-        if (stateChanged)
-        {
-            throw new IllegalStateException("sendRedirect no longer allowed after navigational
state changes");
-        }
-        if (redirected)
-        {
-            throw new IllegalStateException("sendRedirect already called");
-        }
-        redirected = true;
-    }
-    
-    protected void checkSetStateChanged()
-    {
-        if (redirected)
-        {
-            throw new IllegalStateException("State change no longer allowed after a sendRedirect");
-        }
-        stateChanged = true;
-    }
-    
-    protected String getRedirectLocation(String location)
-    {
-        ArgumentUtility.validateNotEmpty("location", location);
-        ResourceURLProvider provider = getResponseContext().getResourceURLProvider();
+   public ActionResponseImpl(PortletActionResponseContext responseContext) {
+      super(responseContext);
+   }
+
+   protected void checkSetRedirected() {
+      if (stateChanged) {
+         throw new IllegalStateException("sendRedirect no longer allowed after navigational
state changes");
+      }
+      if (redirected) {
+         throw new IllegalStateException("sendRedirect already called");
+      }
+      redirected = true;
+   }
+
+   protected void checkSetStateChanged() {
+      if (redirected) {
+         throw new IllegalStateException("State change no longer allowed after a sendRedirect");
+      }
+      stateChanged = true;
+   }
+
+   protected String getRedirectLocation(String location) {
+      ArgumentUtility.validateNotEmpty("location", location);
+      ResourceURLProvider provider = getResponseContext().getResourceURLProvider();
 
-        if (location.indexOf("://") != -1)
-        {
-            provider.setAbsoluteURL(location);
-        } 
-        else 
-        {
-            provider.setFullPath(location);
-        }
-        location = getServletResponse().encodeRedirectURL(provider.toString());
-        if (location.indexOf("/") == -1)
-        {
-            throw new IllegalArgumentException("There is a relative path given, an IllegalArgumentException
must be thrown.");
-        }
-        return location;
-    }
-    
-    public void sendRedirect(String location) throws IOException
-    {
-        location = getRedirectLocation(location);
-        checkSetRedirected();
-        ((PortletActionResponseContext)getResponseContext()).setRedirect(location);
-    }
-    
-	public void sendRedirect(String location, String renderUrlParamName) throws IOException

-	{
-        ArgumentUtility.validateNotEmpty("renderUrlParamName", renderUrlParamName);
-        location = getRedirectLocation(location);
-        if (!redirected)
-        {
-            stateChanged = false;
-        }
-        checkSetRedirected();
-        ((PortletActionResponseContext)getResponseContext()).setRedirect(location, renderUrlParamName);
-	}
+      if (location.indexOf("://") != -1) {
+         provider.setAbsoluteURL(location);
+      } else {
+         provider.setFullPath(location);
+      }
+      location = getServletResponse().encodeRedirectURL(provider.toString());
+      if (location.indexOf("/") == -1) {
+         throw new IllegalArgumentException(
+               "There is a relative path given, an IllegalArgumentException must be thrown.");
+      }
+      return location;
+   }
+
+   public void sendRedirect(String location) throws IOException {
+      location = getRedirectLocation(location);
+      checkSetRedirected();
+      ((PortletActionResponseContext) getResponseContext()).setRedirect(location);
+   }
+
+   public void sendRedirect(String location, String renderUrlParamName) throws IOException
{
+      ArgumentUtility.validateNotEmpty("renderUrlParamName", renderUrlParamName);
+      location = getRedirectLocation(location);
+      if (!redirected) {
+         stateChanged = false;
+      }
+      checkSetRedirected();
+      ((PortletActionResponseContext) getResponseContext()).setRedirect(location, renderUrlParamName);
+   }
 
    @Override
    public RenderURL getRedirectURL(Copy option) throws IllegalStateException {
-      // TODO: implement
-      //return new RenderURLImpl(responseContext, option);
-      return null;
+      if (stateChanged) {
+         throw new IllegalStateException("sendRedirect no longer allowed after navigational
state changes");
+      }
+      return new RenderURLImpl(responseContext, option);
    }
 }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/29448a1f/pluto-container/src/main/java/org/apache/pluto/container/impl/BaseURLImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/impl/BaseURLImpl.java
b/pluto-container/src/main/java/org/apache/pluto/container/impl/BaseURLImpl.java
index b1e2b89..65dbf00 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/impl/BaseURLImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/impl/BaseURLImpl.java
@@ -39,7 +39,6 @@ import javax.portlet.RenderURL;
 import javax.portlet.ResourceURL;
 import javax.portlet.WindowState;
 
-import org.apache.pluto.container.PortletMimeResponseContext;
 import org.apache.pluto.container.PortletResponseContext;
 import org.apache.pluto.container.PortletURLListenerService;
 import org.apache.pluto.container.PortletURLProvider;
@@ -82,7 +81,7 @@ public abstract class BaseURLImpl implements BaseURL {
       }
    }
 
-   public BaseURLImpl(PortletMimeResponseContext responseContext,
+   public BaseURLImpl(PortletResponseContext responseContext,
          PortletURLProvider portletURLProvider, Copy copy) {
       this(responseContext, portletURLProvider);
       

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/29448a1f/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletURLImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletURLImpl.java
b/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletURLImpl.java
index ed76761..8beff45 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletURLImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/impl/PortletURLImpl.java
@@ -18,9 +18,6 @@ package org.apache.pluto.container.impl;
 
 import java.util.Enumeration;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import javax.portlet.MimeResponse.Copy;
 import javax.portlet.MutableRenderParameters;
 import javax.portlet.PortletMode;
@@ -30,13 +27,14 @@ import javax.portlet.WindowState;
 import javax.portlet.WindowStateException;
 import javax.portlet.annotations.PortletSerializable;
 
-import org.apache.pluto.container.PortletMimeResponseContext;
 import org.apache.pluto.container.PortletResponseContext;
 import org.apache.pluto.container.PortletURLProvider;
 import org.apache.pluto.container.om.portlet.CustomPortletMode;
 import org.apache.pluto.container.om.portlet.PortletDefinition;
 import org.apache.pluto.container.om.portlet.Supports;
 import org.apache.pluto.container.util.ArgumentUtility;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -62,7 +60,7 @@ public abstract class PortletURLImpl extends BaseURLImpl implements PortletURL
{
       super(responseContext, urlProvider);
    }
 
-   public PortletURLImpl(PortletMimeResponseContext responseContext,
+   public PortletURLImpl(PortletResponseContext responseContext,
          PortletURLProvider portletURLProvider, Copy copy) {
       super(responseContext, portletURLProvider, copy);
    }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/29448a1f/pluto-container/src/main/java/org/apache/pluto/container/impl/RenderURLImpl.java
----------------------------------------------------------------------
diff --git a/pluto-container/src/main/java/org/apache/pluto/container/impl/RenderURLImpl.java
b/pluto-container/src/main/java/org/apache/pluto/container/impl/RenderURLImpl.java
index 6f99cec..879a512 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/impl/RenderURLImpl.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/impl/RenderURLImpl.java
@@ -22,7 +22,7 @@ package org.apache.pluto.container.impl;
 import javax.portlet.MimeResponse.Copy;
 import javax.portlet.RenderURL;
 
-import org.apache.pluto.container.PortletMimeResponseContext;
+import org.apache.pluto.container.PortletResponseContext;
 import org.apache.pluto.container.PortletURLProvider;
 import org.apache.pluto.container.util.ArgumentUtility;
 
@@ -37,7 +37,7 @@ public class RenderURLImpl extends PortletURLImpl implements RenderURL {
     * @param copy 
     * @param urlProvider
     */
-   public RenderURLImpl(PortletMimeResponseContext responseContext, Copy copy) {
+   public RenderURLImpl(PortletResponseContext responseContext, Copy copy) {
       super(responseContext,
             responseContext.getPortletURLProvider(PortletURLProvider.TYPE.RENDER), copy);
    }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/29448a1f/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 78b55c9..e09fb6e 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
@@ -49,7 +49,7 @@ public abstract class StateAwareResponseImpl extends PortletResponseImpl
    @SuppressWarnings("unused")
    private final boolean isDebug = LOGGER.isDebugEnabled();
 
-   private PortletStateAwareResponseContext responseContext;
+   protected PortletStateAwareResponseContext responseContext;
    private final String                     windowId;
 
    public StateAwareResponseImpl(PortletStateAwareResponseContext responseContext) {
@@ -186,6 +186,7 @@ public abstract class StateAwareResponseImpl extends PortletResponseImpl
    }
 
    public MutableRenderParameters getRenderParameters() {
+      checkSetStateChanged();
       return responseContext.getRenderParameters(windowId);
    }
 }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/29448a1f/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletMimeResponseContextImpl.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletMimeResponseContextImpl.java
b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletMimeResponseContextImpl.java
index a418988..2c458bc 100644
--- a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletMimeResponseContextImpl.java
+++ b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletMimeResponseContextImpl.java
@@ -27,9 +27,7 @@ import javax.servlet.http.HttpServletResponse;
 
 import org.apache.pluto.container.PortletContainer;
 import org.apache.pluto.container.PortletMimeResponseContext;
-import org.apache.pluto.container.PortletURLProvider;
 import org.apache.pluto.container.PortletWindow;
-import org.apache.pluto.container.PortletURLProvider.TYPE;
 import org.apache.pluto.container.util.PrintWriterServletOutputStream;
 
 /**
@@ -208,9 +206,4 @@ public abstract class PortletMimeResponseContextImpl extends PortletResponseCont
             getServletResponse().setContentType(contentType);
         }
     }
-
-    public PortletURLProvider getPortletURLProvider(TYPE type)
-    {
-        return isClosed() ? null : new PortletURLProviderImpl(getPortalURL(), type, getPortletWindow());
-    }
 }

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/29448a1f/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletResponseContextImpl.java
----------------------------------------------------------------------
diff --git a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletResponseContextImpl.java
b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletResponseContextImpl.java
index 00a02db..7093bcf 100644
--- a/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletResponseContextImpl.java
+++ b/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/container/PortletResponseContextImpl.java
@@ -1,172 +1,179 @@
-/*
- * 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.driver.services.container;
-
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.pluto.container.PortletContainer;
-import org.apache.pluto.container.PortletResponseContext;
-import org.apache.pluto.container.PortletWindow;
-import org.apache.pluto.container.ResourceURLProvider;
-import org.apache.pluto.driver.core.PortalRequestContext;
-import org.apache.pluto.driver.url.PortalURL;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * @version $Id$
- *
- */
-public abstract class PortletResponseContextImpl implements PortletResponseContext
-{
-    private PortletContainer container;
-    private HttpServletRequest containerRequest;
-    private HttpServletResponse containerResponse;
-    private HttpServletRequest servletRequest;
-    private HttpServletResponse servletResponse;
-    private PortletWindow window;
-    private PortalURL portalURL;
-    private boolean closed;
-    private boolean released;
-    
-    public PortletResponseContextImpl(PortletContainer container, HttpServletRequest containerRequest,
-                                      HttpServletResponse containerResponse, PortletWindow
window)
-    {
-        this.container = container;
-        this.containerRequest = containerRequest;
-        this.containerResponse = containerResponse;
-        this.window = window;
-        this.portalURL = PortalRequestContext.getContext(containerRequest).createPortalURL();
-    }
-    
-    protected PortalURL getPortalURL()
-    {
-        return portalURL;
-    }
-
-    protected boolean isClosed()
-    {
-        return closed;
-    }
-    
-    protected boolean isReleased()
-    {
-        return released;
-    }
-
-    public void init(HttpServletRequest servletRequest, HttpServletResponse servletResponse)
-    {
-        this.servletRequest = servletRequest;
-        this.servletResponse = servletResponse;
-    }
-    
-    public void addProperty(Cookie cookie)
-    {
-        if (!isClosed())
-        {
-            servletResponse.addCookie(cookie);
-        }
-    }
-
-    public void addProperty(String key, Element element)
-    {
-        // not supported 
-    }
-
-    public void addProperty(String key, String value)
-    {
-        // not supported
-    }
-    
-    public Element createElement(String tagName) throws DOMException
-    {
-        DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
-        DocumentBuilder docBuilder;
-        
-        try
-        {
-            docBuilder = dbfac.newDocumentBuilder();
-            Document doc = docBuilder.newDocument();
-            return doc.createElement(tagName);
-        }
-        catch (ParserConfigurationException e)
-        {
-            throw new DOMException((short) 0, "Initialization failure");
-        }
-    }
-
-    public void close()
-    {
-        closed = true;
-    }
-
-    public PortletContainer getContainer()
-    {
-        return container;
-    }
-
-    public PortletWindow getPortletWindow()
-    {
-        return window;
-    }
-
-    public HttpServletRequest getContainerRequest()
-    {
-        return containerRequest;
-    }
-
-    public HttpServletResponse getContainerResponse()
-    {
-        return containerResponse;
-    }
-
-    public HttpServletRequest getServletRequest()
-    {
-        return servletRequest;
-    }
-
-    public HttpServletResponse getServletResponse()
-    {
-        return servletResponse;
-    }
-
-    public void release()
-    {
-        closed = true;
-        released = true;
-        container = null;
-        servletRequest = null;
-        servletResponse = null;
-        window = null;
-    }
-
-    public void setProperty(String key, String value)
-    {
-        // not supported
-    }
-
-    public ResourceURLProvider getResourceURLProvider()
-    {
-        return isReleased() ? null : new ResourceURLProviderImpl(servletRequest,window);
-    }
-}
+/*
+ * 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.driver.services.container;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.pluto.container.PortletContainer;
+import org.apache.pluto.container.PortletResponseContext;
+import org.apache.pluto.container.PortletURLProvider;
+import org.apache.pluto.container.PortletWindow;
+import org.apache.pluto.container.ResourceURLProvider;
+import org.apache.pluto.container.PortletURLProvider.TYPE;
+import org.apache.pluto.driver.core.PortalRequestContext;
+import org.apache.pluto.driver.url.PortalURL;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * @version $Id$
+ *
+ */
+public abstract class PortletResponseContextImpl implements PortletResponseContext
+{
+    private PortletContainer container;
+    private HttpServletRequest containerRequest;
+    private HttpServletResponse containerResponse;
+    private HttpServletRequest servletRequest;
+    private HttpServletResponse servletResponse;
+    private PortletWindow window;
+    private PortalURL portalURL;
+    private boolean closed;
+    private boolean released;
+    
+    public PortletResponseContextImpl(PortletContainer container, HttpServletRequest containerRequest,
+                                      HttpServletResponse containerResponse, PortletWindow
window)
+    {
+        this.container = container;
+        this.containerRequest = containerRequest;
+        this.containerResponse = containerResponse;
+        this.window = window;
+        this.portalURL = PortalRequestContext.getContext(containerRequest).createPortalURL();
+    }
+    
+    protected PortalURL getPortalURL()
+    {
+        return portalURL;
+    }
+
+    protected boolean isClosed()
+    {
+        return closed;
+    }
+    
+    protected boolean isReleased()
+    {
+        return released;
+    }
+
+    public void init(HttpServletRequest servletRequest, HttpServletResponse servletResponse)
+    {
+        this.servletRequest = servletRequest;
+        this.servletResponse = servletResponse;
+    }
+    
+    public void addProperty(Cookie cookie)
+    {
+        if (!isClosed())
+        {
+            servletResponse.addCookie(cookie);
+        }
+    }
+
+    public void addProperty(String key, Element element)
+    {
+        // not supported 
+    }
+
+    public void addProperty(String key, String value)
+    {
+        // not supported
+    }
+    
+    public Element createElement(String tagName) throws DOMException
+    {
+        DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
+        DocumentBuilder docBuilder;
+        
+        try
+        {
+            docBuilder = dbfac.newDocumentBuilder();
+            Document doc = docBuilder.newDocument();
+            return doc.createElement(tagName);
+        }
+        catch (ParserConfigurationException e)
+        {
+            throw new DOMException((short) 0, "Initialization failure");
+        }
+    }
+
+    public void close()
+    {
+        closed = true;
+    }
+
+    public PortletContainer getContainer()
+    {
+        return container;
+    }
+
+    public PortletWindow getPortletWindow()
+    {
+        return window;
+    }
+
+    public HttpServletRequest getContainerRequest()
+    {
+        return containerRequest;
+    }
+
+    public HttpServletResponse getContainerResponse()
+    {
+        return containerResponse;
+    }
+
+    public HttpServletRequest getServletRequest()
+    {
+        return servletRequest;
+    }
+
+    public HttpServletResponse getServletResponse()
+    {
+        return servletResponse;
+    }
+
+    public void release()
+    {
+        closed = true;
+        released = true;
+        container = null;
+        servletRequest = null;
+        servletResponse = null;
+        window = null;
+    }
+
+    public void setProperty(String key, String value)
+    {
+        // not supported
+    }
+
+    public ResourceURLProvider getResourceURLProvider()
+    {
+        return isReleased() ? null : new ResourceURLProviderImpl(servletRequest,window);
+    }
+
+    public PortletURLProvider getPortletURLProvider(TYPE type)
+    {
+        return isClosed() ? null : new PortletURLProviderImpl(getPortalURL(), type, getPortletWindow());
+    }
+}


Mime
View raw message