JBoss Portal SVN: r9909 - in modules/portlet/trunk: test/src/test/resources/google-map-portlet-war/WEB-INF and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-09 12:34:08 -0500 (Sat, 09 Feb 2008)
New Revision: 9909
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java
modules/portlet/trunk/test/src/test/resources/google-map-portlet-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/google-weather-portlet-war/WEB-INF/portlet.xml
Log:
- use caching in google portlets
- implements public nav state caching in consumer cache interceptor
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2008-02-09 17:12:18 UTC (rev 9908)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2008-02-09 17:34:08 UTC (rev 9909)
@@ -35,6 +35,7 @@
import org.jboss.portal.portlet.cache.CacheControl;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.common.invocation.AttributeResolver;
+import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.WindowState;
import org.jboss.portal.Mode;
@@ -64,7 +65,8 @@
RenderInvocation renderInvocation = (RenderInvocation)invocation;
//
- StateString navState = renderInvocation.getNavigationalState();
+ StateString navigationalState = renderInvocation.getNavigationalState();
+ ParameterMap publicNavigationalState = renderInvocation.getPublicNavigationalState();
WindowState windowState = renderInvocation.getWindowState();
Mode mode = renderInvocation.getMode();
@@ -76,33 +78,58 @@
{
// Check time validity for fragment
boolean useEntry = false;
- StateString entryNavState = cachedEntry.navigationalState;
+ StateString entryNavigationalState = cachedEntry.navigationalState;
+ ParameterMap entryPublicNavigationalState = cachedEntry.publicNavigationalState;
// Then check nav state equality
- if (navState == null)
+ if (navigationalState == null)
{
- if (entryNavState == null)
+ if (entryNavigationalState == null)
{
useEntry = true;
}
- else if (entryNavState instanceof ParametersStateString)
+ else if (entryNavigationalState instanceof ParametersStateString)
{
// We consider a parameters state string empty equivalent to a null value
- useEntry = ((ParametersStateString)entryNavState).getSize() == 0;
+ useEntry = ((ParametersStateString)entryNavigationalState).getSize() == 0;
}
}
- else if (entryNavState == null)
+ else if (entryNavigationalState == null)
{
- if (navState instanceof ParametersStateString)
+ if (navigationalState instanceof ParametersStateString)
{
- useEntry = ((ParametersStateString)navState).getSize() == 0;
+ useEntry = ((ParametersStateString)navigationalState).getSize() == 0;
}
}
else
{
- useEntry = navState.equals(entryNavState);
+ useEntry = navigationalState.equals(entryNavigationalState);
}
+ // Check public nav state equality
+ if (useEntry)
+ {
+ if (publicNavigationalState == null)
+ {
+ if (entryPublicNavigationalState == null)
+ {
+ //
+ }
+ else
+ {
+ useEntry = entryPublicNavigationalState.size() == 0;
+ }
+ }
+ else if (entryPublicNavigationalState == null)
+ {
+ useEntry = publicNavigationalState.size() == 0;
+ }
+ else
+ {
+ useEntry = publicNavigationalState.equals(entryPublicNavigationalState);
+ }
+ }
+
// Then check window state equality
useEntry &= windowState.equals(cachedEntry.windowState);
@@ -173,7 +200,8 @@
if (expirationTimeMillis > 0)
{
CacheEntry cacheEntry = new CacheEntry(
- navState,
+ navigationalState,
+ publicNavigationalState,
windowState,
mode,
fragment,
@@ -216,6 +244,9 @@
/** . */
private final Mode mode;
+ /** . */
+ private final ParameterMap publicNavigationalState;
+
/** The timed content. */
private final ContentRef contentRef;
@@ -227,6 +258,7 @@
public CacheEntry(
StateString navigationalState,
+ ParameterMap publicNavigationalState,
WindowState windowState,
Mode mode,
FragmentResponse content,
@@ -240,6 +272,7 @@
this.navigationalState = navigationalState;
this.windowState = windowState;
this.mode = mode;
+ this.publicNavigationalState = publicNavigationalState;
this.contentRef = new StrongContentRef(content);
this.expirationTimeMillis = expirationTimeMillis;
this.validationToken = validationToken;
Modified: modules/portlet/trunk/test/src/test/resources/google-map-portlet-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/google-map-portlet-war/WEB-INF/portlet.xml 2008-02-09 17:12:18 UTC (rev 9908)
+++ modules/portlet/trunk/test/src/test/resources/google-map-portlet-war/WEB-INF/portlet.xml 2008-02-09 17:34:08 UTC (rev 9909)
@@ -30,6 +30,7 @@
<portlet-name>GoogleMap</portlet-name>
<display-name>Google Map Portlet</display-name>
<portlet-class>org.jboss.portal.simple.samples.GoogleClippingPortlet</portlet-class>
+ <expiration-cache>120</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
Modified: modules/portlet/trunk/test/src/test/resources/google-weather-portlet-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/google-weather-portlet-war/WEB-INF/portlet.xml 2008-02-09 17:12:18 UTC (rev 9908)
+++ modules/portlet/trunk/test/src/test/resources/google-weather-portlet-war/WEB-INF/portlet.xml 2008-02-09 17:34:08 UTC (rev 9909)
@@ -30,6 +30,7 @@
<portlet-name>GoogleWeather</portlet-name>
<display-name>Google Weather Portlet</display-name>
<portlet-class>org.jboss.portal.simple.samples.GoogleWeatherClippingPortlet</portlet-class>
+ <expiration-cache>120</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
16 years, 5 months
JBoss Portal SVN: r9908 - in modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet: test/jsp and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-09 12:12:18 -0500 (Sat, 09 Feb 2008)
New Revision: 9908
Removed:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/basic/ErrorPortlet.java
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
Log:
handle error in actions
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/basic/ErrorPortlet.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/basic/ErrorPortlet.java 2008-02-09 17:00:33 UTC (rev 9907)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/basic/ErrorPortlet.java 2008-02-09 17:12:18 UTC (rev 9908)
@@ -1,41 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.portal.samples.basic;
-
-import javax.portlet.GenericPortlet;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.PortletException;
-import java.io.IOException;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class ErrorPortlet extends GenericPortlet
-{
- protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException
- {
- throw new PortletException("Some exception");
- }
-}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-09 17:00:33 UTC (rev 9907)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-09 17:12:18 UTC (rev 9908)
@@ -27,12 +27,14 @@
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.invocation.response.ErrorResponse;
import org.jboss.portal.portlet.controller.PortletController;
import org.jboss.portal.portlet.controller.request.PortletActionRequest;
import org.jboss.portal.portlet.controller.impl.state.StateControllerContextImpl;
import org.jboss.portal.portlet.controller.response.ControllerResponse;
import org.jboss.portal.portlet.controller.response.PageUpdateResponse;
import org.jboss.portal.portlet.controller.response.ResourceResponse;
+import org.jboss.portal.portlet.controller.response.PortletResponse;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.common.io.IOTools;
@@ -197,6 +199,31 @@
//
return;
}
+ else if (controllerResponse instanceof PortletResponse)
+ {
+ PortletResponse portletResponse = (PortletResponse)controllerResponse;
+ PortletInvocationResponse pir = portletResponse.response;
+
+ //
+ if (pir instanceof ErrorResponse)
+ {
+ ErrorResponse errorResponse = (ErrorResponse)pir;
+
+ //
+ if (errorResponse.getCause() != null)
+ {
+ throw new ServletException(errorResponse.getMessage(), errorResponse.getCause());
+ }
+ else
+ {
+ throw new ServletException(errorResponse.getMessage());
+ }
+ }
+ else
+ {
+ // todo
+ }
+ }
else
{
// todo
16 years, 5 months
JBoss Portal SVN: r9907 - modules/portlet/trunk/test/src/test/resources/portal/samples/basic-war/WEB-INF.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-09 12:00:33 -0500 (Sat, 09 Feb 2008)
New Revision: 9907
Modified:
modules/portlet/trunk/test/src/test/resources/portal/samples/basic-war/WEB-INF/portlet.xml
Log:
set title on exception portlet
Modified: modules/portlet/trunk/test/src/test/resources/portal/samples/basic-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/portal/samples/basic-war/WEB-INF/portlet.xml 2008-02-09 16:58:19 UTC (rev 9906)
+++ modules/portlet/trunk/test/src/test/resources/portal/samples/basic-war/WEB-INF/portlet.xml 2008-02-09 17:00:33 UTC (rev 9907)
@@ -34,7 +34,7 @@
<mime-type>text/html</mime-type>
</supports>
<portlet-info>
- <title></title>
+ <title>ExceptionPortlet</title>
</portlet-info>
</portlet>
16 years, 5 months
JBoss Portal SVN: r9906 - in modules/portlet/trunk/test/src: test/resources/portal/samples/basic-war/WEB-INF and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-09 11:58:19 -0500 (Sat, 09 Feb 2008)
New Revision: 9906
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/basic/ExceptionPortlet.java
Modified:
modules/portlet/trunk/test/src/test/resources/portal/samples/basic-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jsp/error.jsp
modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo.jsp
modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo2.jsp
modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo3.jsp
Log:
minor updates
Copied: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/basic/ExceptionPortlet.java (from rev 9905, modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/basic/ErrorPortlet.java)
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/basic/ExceptionPortlet.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/basic/ExceptionPortlet.java 2008-02-09 16:58:19 UTC (rev 9906)
@@ -0,0 +1,113 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.portal.samples.basic;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletURL;
+import javax.portlet.PortletRequest;
+import javax.portlet.ActionRequest;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.ActionResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ExceptionPortlet extends GenericPortlet
+{
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ throwException(req);
+ }
+
+ protected void doView(RenderRequest req, RenderResponse resp) throws PortletException, PortletSecurityException, IOException
+ {
+ throwException(req);
+
+ //
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+ PortletURL renderURL = resp.createRenderURL();
+ PortletURL actionURL = resp.createActionURL();
+
+ //
+ writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Throw :</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ renderURL.setParameter("op", "portletexception");
+ writer.write("<div><a href=\"" + renderURL + "\">render PortletException</a></div>");
+ renderURL.setParameter("op", "portletsecurityexception");
+ writer.write("<div><a href=\"" + renderURL + "\">render PortletSecurityException</a></div>");
+ renderURL.setParameter("op", "ioexception");
+ writer.write("<div><a href=\"" + renderURL + "\">render IOException</a></div>");
+ renderURL.setParameter("op", "runtimeexception");
+ writer.write("<div><a href=\"" + renderURL + "\">render RuntimeException</a></div>");
+ actionURL.setParameter("op", "error");
+ writer.write("<div><a href=\"" + renderURL + "\">render Error</a></div>");
+ actionURL.setParameter("op", "portletexception");
+ writer.write("<div><a href=\"" + actionURL + "\">action PortletException</a></div>");
+ actionURL.setParameter("op", "portletsecurityexception");
+ writer.write("<div><a href=\"" + actionURL + "\">action PortletSecurityException</a></div>");
+ actionURL.setParameter("op", "ioexception");
+ writer.write("<div><a href=\"" + actionURL + "\">action IOException</a></div>");
+ actionURL.setParameter("op", "runtimeexception");
+ writer.write("<div><a href=\"" + actionURL + "\">action RuntimeException</a></div>");
+ actionURL.setParameter("op", "error");
+ writer.write("<div><a href=\"" + actionURL + "\">action Error</a></div>");
+ writer.write("</div>");
+ writer.write("</p>");
+ }
+
+ private void throwException(PortletRequest req) throws PortletException, IOException
+ {
+ String op = req.getParameter("op");
+
+ // Throw any required exception
+ if ("portletexception".equals(op))
+ {
+ throw new PortletException();
+ }
+ if ("portletsecurityexception".equals(op))
+ {
+ throw new PortletSecurityException("");
+ }
+ if ("ioexception".equals(op))
+ {
+ throw new IOException();
+ }
+ if ("runtimeexception".equals(op))
+ {
+ throw new RuntimeException();
+ }
+ if ("error".equals(op))
+ {
+ throw new Error();
+ }
+ }
+}
Modified: modules/portlet/trunk/test/src/test/resources/portal/samples/basic-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/portal/samples/basic-war/WEB-INF/portlet.xml 2008-02-09 16:39:07 UTC (rev 9905)
+++ modules/portlet/trunk/test/src/test/resources/portal/samples/basic-war/WEB-INF/portlet.xml 2008-02-09 16:58:19 UTC (rev 9906)
@@ -28,8 +28,8 @@
version="1.0">
<portlet>
- <portlet-name>ErrorPortlet</portlet-name>
- <portlet-class>org.jboss.portal.portlet.portal.samples.basic.ErrorPortlet</portlet-class>
+ <portlet-name>ExceptionPortlet</portlet-name>
+ <portlet-class>org.jboss.portal.portlet.portal.samples.basic.ExceptionPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
</supports>
Modified: modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jsp/error.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jsp/error.jsp 2008-02-09 16:39:07 UTC (rev 9905)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jsp/error.jsp 2008-02-09 16:58:19 UTC (rev 9906)
@@ -15,7 +15,7 @@
<b>Portlet name:</b> <%= request.getAttribute("org.jboss.portal.portlet.portal.error.portlet_name")%><br/>
<b>Portlet application
name:</b> <%= request.getAttribute("org.jboss.portal.portlet.portal.error.application_name")%><br/>
- <b>Exception:</b> <%= request.getAttribute("org.jboss.portal.portlet.portal.error.exception")%><br/>
+ <b>Exception:</b> <%= request.getAttribute("org.jboss.portal.portlet.portal.error.cause")%><br/>
<b>Window id:</b> <%= request.getAttribute("org.jboss.portal.portlet.portal.error.window_id")%><br/>
</div>
</div>
Modified: modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo.jsp 2008-02-09 16:39:07 UTC (rev 9905)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo.jsp 2008-02-09 16:58:19 UTC (rev 9906)
@@ -12,7 +12,7 @@
<jsp:attribute name="leftcol">
<jbp:portlet name="RemoteControl" applicationName="remotecontrol-portlet"/>
<jbp:portlet name="Foo" applicationName="bar"/>
- <jbp:portlet name="ErrorPortlet" applicationName="samples-basic"/>
+ <jbp:portlet name="ExceptionPortlet" applicationName="samples-basic"/>
<jbp:portlet name="Cart" applicationName="cart-event-portlet"/>
</jsp:attribute>
<jsp:attribute name="rightcol">
Modified: modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo2.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo2.jsp 2008-02-09 16:39:07 UTC (rev 9905)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo2.jsp 2008-02-09 16:58:19 UTC (rev 9906)
@@ -15,6 +15,7 @@
</jsp:attribute>
<jsp:attribute name="rightcol">
+ <jbp:portlet name="GoogleMap" applicationName="google-map-portlet"/>
<jbp:portlet name="GoogleWeather" applicationName="google-weather-portlet"/>
</jsp:attribute>
Modified: modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo3.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo3.jsp 2008-02-09 16:39:07 UTC (rev 9905)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo3.jsp 2008-02-09 16:58:19 UTC (rev 9906)
@@ -16,7 +16,7 @@
</jsp:attribute>
<jsp:attribute name="rightcol">
- <jbp:portlet name="ErrorPortlet" applicationName="samples-basic"/>
+ <jbp:portlet name="ExceptionPortlet" applicationName="samples-basic"/>
</jsp:attribute>
</jbp:layout1>
</portal:page>
16 years, 5 months
JBoss Portal SVN: r9905 - modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-09 11:39:07 -0500 (Sat, 09 Feb 2008)
New Revision: 9905
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageParamTag.java
Log:
fix issue with shared render param update overwritten by JSP page param
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageParamTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageParamTag.java 2008-02-09 16:22:50 UTC (rev 9904)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageParamTag.java 2008-02-09 16:39:07 UTC (rev 9905)
@@ -94,8 +94,12 @@
QName name = new QName(namespaceURI, localName);
//
- if (!"true".equals(frozen) || renderResponse.getPageParameter(name) == null)
+ if ("true".equals(frozen))
{
+ //
+ }
+ else if (renderResponse.getPageParameter(name) == null)
+ {
renderResponse.setPageParameter(name, value);
}
}
16 years, 5 months
JBoss Portal SVN: r9904 - modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-09 11:22:50 -0500 (Sat, 09 Feb 2008)
New Revision: 9904
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageEventControllerContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java
Log:
some basic javadoc
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-09 16:18:37 UTC (rev 9903)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-09 16:22:50 UTC (rev 9904)
@@ -88,12 +88,13 @@
//
PortalActionResponse actionResponse = new PortalActionResponse(resp, invoker);
- // Discover existing portlets on the page
+ // Discover existing portlets on the page (introspection phase)
chain.doFilter(req, actionResponse);
// Now we can create a populated context
PagePortletControllerContext context = new PagePortletControllerContext(req, resp, getServletContext(), actionResponse);
+ //
PageNavigationalState pageState = null;
if (context.getRequest() != null)
{
@@ -217,79 +218,4 @@
{
this.config = null;
}
-
- protected void render(HttpServletRequest req, PortalRenderResponse resp) throws ServletException, IOException, ClassNotFoundException
- {
-
- //
-// PagePortletControllerContext context = resp.getPortletControllerContext();
-
- //
-
- // Look if we need to handle maxmized rendering
-/*
- for (Window window : page.getWindows())
- {
- WindowNavigationalState windowState = pageState.getWindowNavigationalState(window.getId());
- if (windowState != null && WindowState.MAXIMIZED.equals(windowState.getWindowState()))
- {
- List<Chunk> chunks = new LinkedList<Chunk>();
- int mode = 0;
- int count = 0;
- Map<StartPortletChunk, Window> windows = Collections.emptyMap();
- for (Iterator<Chunk> i = page.getChunks().iterator();i.hasNext();)
- {
- Chunk chunk = i.next();
-
- switch (mode)
- {
- case 0:
- if (chunk instanceof StartPageChunk)
- {
- mode = 1;
- chunks.add(chunk);
- }
- break;
- case 1:
- if (chunk instanceof StartPortletChunk)
- {
- StartPortletChunk startPortletChunk = (StartPortletChunk)chunk;
- String windowId = "" + count;
- if (window.getId().equals(windowId))
- {
- mode = 2;
- chunks.add(startPortletChunk);
- windows = Collections.singletonMap(startPortletChunk, window);
- }
- }
- else if (chunk instanceof EndPageChunk)
- {
- mode = 0;
- chunks.add(chunk);
- }
- break;
- case 2:
- if (chunk instanceof EndPortletChunk)
- {
- mode = 1;
- }
-
- //
- chunks.add(chunk);
- break;
- }
-
- //
- if (chunk instanceof EndPortletChunk)
- {
- count++;
- }
- }
-
- // New page
- page = new Page(chunks, windows);
- }
- }
-*/
- }
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageEventControllerContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageEventControllerContext.java 2008-02-09 16:18:37 UTC (rev 9903)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageEventControllerContext.java 2008-02-09 16:22:50 UTC (rev 9904)
@@ -31,6 +31,9 @@
import java.util.ArrayList;
/**
+ * Route events according to the portlets discovered on the page. For now it is pretty trivial.
+ * We could leverage JSP tags to 'wire' portlets on the same page for instance.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java 2008-02-09 16:18:37 UTC (rev 9903)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java 2008-02-09 16:22:50 UTC (rev 9904)
@@ -33,6 +33,8 @@
import java.util.HashMap;
/**
+ * Expose stuff common to action and render response.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
@@ -80,6 +82,10 @@
return portlets.get(new Key(applicationName, portletName));
}
+ /**
+ * todo : add on JSP portlet tag a notion of 'id', because this id generation relies on the portlet
+ * rendering order on the page which could not be the same between 2 requests.
+ */
public String nextId()
{
return "" + count++;
16 years, 5 months
JBoss Portal SVN: r9903 - in modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp: taglib and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-09 11:18:37 -0500 (Sat, 09 Feb 2008)
New Revision: 9903
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java
Log:
no need to use the window id that contains the portlet context id marshalled in since we always have a map of window id -> Portlet
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-09 16:11:20 UTC (rev 9902)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-09 16:18:37 UTC (rev 9903)
@@ -85,32 +85,18 @@
{
PortletInvoker invoker = (PortletInvoker)getServletContext().getAttribute("ConsumerPortletInvoker");
-
+ //
PortalActionResponse actionResponse = new PortalActionResponse(resp, invoker);
+ // Discover existing portlets on the page
chain.doFilter(req, actionResponse);
- //
- PagePortletControllerContext context;
- try
- {
- context = new PagePortletControllerContext(
- req,
- resp,
- getServletContext(),
- actionResponse);
- }
- catch (PortletInvokerException e)
- {
- throw new ServletException(e);
- }
+ // Now we can create a populated context
+ PagePortletControllerContext context = new PagePortletControllerContext(req, resp, getServletContext(), actionResponse);
PageNavigationalState pageState = null;
if (context.getRequest() != null)
{
-
-
-
ControllerResponse controllerResponse;
try
{
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java 2008-02-09 16:11:20 UTC (rev 9902)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java 2008-02-09 16:18:37 UTC (rev 9903)
@@ -23,7 +23,6 @@
package org.jboss.portal.portlet.test.jsp;
import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.PortletContext;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.controller.event.EventControllerContext;
import org.jboss.portal.portlet.invocation.PortletInvocation;
@@ -48,7 +47,7 @@
private final EventControllerContext eventControllerContext;
/** . */
- private final PortalResponse actionResponse;
+ private final PortalActionResponse actionResponse;
public PagePortletControllerContext(
HttpServletRequest req,
@@ -66,20 +65,7 @@
protected Portlet getPortlet(String windowId) throws PortletInvokerException
{
- int index = windowId.lastIndexOf('.');
- String portletId = windowId.substring(0, index);
-
- // in the case of an event propagation, the given 'windowId' is actually the portlet id already so need to check
- // for that case (portletId should still have a '.', if not it means that the windowId was really a portlet id)
-// if (portletId.indexOf('.') == -1)
-// {
-// portletId = windowId;
-// }
-
- PortletContext portletContext = PortletContext.createPortletContext(portletId);
-
- //
- return actionResponse.getInvoker().getPortlet(portletContext);
+ return actionResponse.getPortlet(windowId);
}
public PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java 2008-02-09 16:11:20 UTC (rev 9902)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java 2008-02-09 16:18:37 UTC (rev 9903)
@@ -188,11 +188,7 @@
Portlet portlet = portalResponse.findPortlet(applicationNameAttr, nameAttr);
//
- String windowId = null;
- if (portlet != null)
- {
- windowId = portlet.getContext().getId() + "." + portalResponse.nextId();
- }
+ String windowId = portalResponse.nextId();
//
this.initialMode = initialMode;
16 years, 5 months
JBoss Portal SVN: r9902 - modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-09 11:11:20 -0500 (Sat, 09 Feb 2008)
New Revision: 9902
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java
Log:
PageEventControllerContext that use the page structure to route events (thanks Chris, I totally missed the use case)
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java 2008-02-09 16:11:20 UTC (rev 9902)
@@ -0,0 +1,122 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.test.jsp;
+
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.info.PortletInfo;
+
+import javax.servlet.http.HttpServletResponseWrapper;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortalResponse extends HttpServletResponseWrapper
+{
+
+ /** . */
+ private final PortletInvoker invoker;
+
+ /** . */
+ private final Map<Key, Portlet> portlets;
+
+ /** . */
+ private int count = 0;
+
+ public PortalResponse(
+ HttpServletResponse response,
+ PortletInvoker invoker) throws PortletInvokerException
+ {
+ super(response);
+
+ //
+ Map<Key, Portlet> portlets = new HashMap<Key, Portlet>();
+ for (Portlet portlet : invoker.getPortlets())
+ {
+ PortletInfo portletInfo = portlet.getInfo();
+ String portletName = portletInfo.getName();
+ String applicationName = portletInfo.getApplicationName();
+ Key key = new Key(applicationName, portletName);
+ portlets.put(key, portlet);
+ }
+
+ //
+ this.portlets = portlets;
+ this.invoker = invoker;
+ }
+
+ public PortletInvoker getInvoker()
+ {
+ return invoker;
+ }
+
+ public Portlet findPortlet(String applicationName, String portletName)
+ {
+ return portlets.get(new Key(applicationName, portletName));
+ }
+
+ public String nextId()
+ {
+ return "" + count++;
+ }
+
+ private static class Key
+ {
+
+ /** . */
+ private final String applicationName;
+
+ /** . */
+ private final String portletName;
+
+ private Key(String applicationName, String portletName)
+ {
+ this.applicationName = applicationName;
+ this.portletName = portletName;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof Key)
+ {
+ Key that = (Key)obj;
+ return applicationName.equals(that.applicationName) && portletName.equals(that.portletName);
+ }
+ return false;
+ }
+
+ public int hashCode()
+ {
+ return applicationName.hashCode() + portletName.hashCode();
+ }
+ }
+}
16 years, 5 months
JBoss Portal SVN: r9901 - in modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp: taglib and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-09 11:11:00 -0500 (Sat, 09 Feb 2008)
New Revision: 9901
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageEventControllerContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalActionResponse.java
Removed:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalRenderResponse.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageParamTag.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageTag.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/ParamTag.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalBodyTagSupport.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalSimpleTagSupport.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletMarkupTag.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTitleTag.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java
Log:
PageEventControllerContext that use the page structure to route events (thanks Chris, I totally missed the use case)
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-09 14:44:32 UTC (rev 9900)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-09 16:11:00 UTC (rev 9901)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.test.jsp;
-import org.jboss.portal.portlet.test.jsp.PortalRenderResponse;
import org.jboss.portal.portlet.test.controller.PortletURLRenderer;
import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.PortletInvokerException;
@@ -72,13 +71,25 @@
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException
{
- doFilter((HttpServletRequest)req, (HttpServletResponse)resp, chain);
+ try
+ {
+ doFilter((HttpServletRequest)req, (HttpServletResponse)resp, chain);
+ }
+ catch (PortletInvokerException e)
+ {
+ throw new ServletException(e);
+ }
}
- public void doFilter(HttpServletRequest req, HttpServletResponse resp, FilterChain chain) throws IOException, ServletException
+ public void doFilter(HttpServletRequest req, HttpServletResponse resp, FilterChain chain) throws IOException, ServletException, PortletInvokerException
{
PortletInvoker invoker = (PortletInvoker)getServletContext().getAttribute("ConsumerPortletInvoker");
+
+ PortalActionResponse actionResponse = new PortalActionResponse(resp, invoker);
+
+ chain.doFilter(req, actionResponse);
+
//
PagePortletControllerContext context;
try
@@ -87,7 +98,7 @@
req,
resp,
getServletContext(),
- invoker);
+ actionResponse);
}
catch (PortletInvokerException e)
{
@@ -97,6 +108,9 @@
PageNavigationalState pageState = null;
if (context.getRequest() != null)
{
+
+
+
ControllerResponse controllerResponse;
try
{
@@ -207,7 +221,7 @@
}
//
- PortalRenderResponse renderResponse = new PortalRenderResponse(resp, context, pageState);
+ PortalRenderResponse renderResponse = new PortalRenderResponse(resp, invoker, context, pageState);
//
chain.doFilter(req, renderResponse);
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageEventControllerContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageEventControllerContext.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PageEventControllerContext.java 2008-02-09 16:11:00 UTC (rev 9901)
@@ -0,0 +1,71 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.test.jsp;
+
+import org.jboss.portal.portlet.controller.event.EventControllerContext;
+import org.jboss.portal.portlet.controller.event.Event;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.info.PortletInfo;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PageEventControllerContext implements EventControllerContext
+{
+
+ /** . */
+ private final PortalActionResponse actionResponse;
+
+ public PageEventControllerContext(PortalActionResponse actionResponse)
+ {
+ this.actionResponse = actionResponse;
+ }
+
+ public List<Event> getConsumedEvents(Event producedEvent)
+ {
+ ArrayList<Event> consumedEvents = new ArrayList<Event>();
+
+ //
+ for (String windowId : actionResponse.getWindowIds())
+ {
+ Portlet portlet = actionResponse.getPortlet(windowId);
+
+ //
+ PortletInfo portletInfo = portlet.getInfo();
+
+ //
+ if (portletInfo.getEventing().getConsumedEvents().containsKey(producedEvent.getName()))
+ {
+ Event consumedEvent = new Event(producedEvent.getName(), producedEvent.getPayload(), windowId);
+ consumedEvents.add(consumedEvent);
+ }
+ }
+
+ //
+ return consumedEvents;
+ }
+}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java 2008-02-09 14:44:32 UTC (rev 9900)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java 2008-02-09 16:11:00 UTC (rev 9901)
@@ -24,11 +24,8 @@
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletContext;
-import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.controller.event.EventControllerContext;
-import org.jboss.portal.portlet.controller.impl.event.EventControllerContextImpl;
-import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.test.controller.AbstractPortletControllerContext;
@@ -39,8 +36,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -50,45 +45,25 @@
{
/** . */
- private final PortletInvoker invoker;
-
- /** . */
private final EventControllerContext eventControllerContext;
/** . */
- private final Map<Key, Portlet> portlets;
+ private final PortalResponse actionResponse;
public PagePortletControllerContext(
HttpServletRequest req,
HttpServletResponse resp,
ServletContext servletContext,
- PortletInvoker invoker)
+ PortalActionResponse actionResponse)
throws IllegalRequestException, IOException, ServletException, PortletInvokerException
{
super(req, resp, servletContext);
//
- Map<Key, Portlet> portlets = new HashMap<Key, Portlet>();
- for (Portlet portlet : invoker.getPortlets())
- {
- PortletInfo portletInfo = portlet.getInfo();
- String portletName = portletInfo.getName();
- String applicationName = portletInfo.getApplicationName();
- Key key = new Key(applicationName, portletName);
- portlets.put(key, portlet);
- }
-
- //
- this.portlets = portlets;
- this.invoker = invoker;
- this.eventControllerContext = new EventControllerContextImpl(invoker);
+ this.actionResponse = actionResponse;
+ this.eventControllerContext = new PageEventControllerContext(actionResponse);
}
- public Portlet findPortlet(String applicationName, String portletName)
- {
- return portlets.get(new Key(applicationName, portletName));
- }
-
protected Portlet getPortlet(String windowId) throws PortletInvokerException
{
int index = windowId.lastIndexOf('.');
@@ -96,58 +71,24 @@
// in the case of an event propagation, the given 'windowId' is actually the portlet id already so need to check
// for that case (portletId should still have a '.', if not it means that the windowId was really a portlet id)
- if (portletId.indexOf('.') == -1)
- {
- portletId = windowId;
- }
+// if (portletId.indexOf('.') == -1)
+// {
+// portletId = windowId;
+// }
PortletContext portletContext = PortletContext.createPortletContext(portletId);
- return invoker.getPortlet(portletContext);
+
+ //
+ return actionResponse.getInvoker().getPortlet(portletContext);
}
public PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException
{
- return invoker.invoke(invocation);
+ return actionResponse.getInvoker().invoke(invocation);
}
public EventControllerContext getEventControllerContext()
{
return eventControllerContext;
}
-
- private static class Key
- {
-
- /** . */
- private final String applicationName;
-
- /** . */
- private final String portletName;
-
- private Key(String applicationName, String portletName)
- {
- this.applicationName = applicationName;
- this.portletName = portletName;
- }
-
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
- if (obj instanceof Key)
- {
- Key that = (Key)obj;
- return applicationName.equals(that.applicationName) && portletName.equals(that.portletName);
- }
- return false;
- }
-
- public int hashCode()
- {
- return applicationName.hashCode() + portletName.hashCode();
- }
- }
-
}
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalActionResponse.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalActionResponse.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalActionResponse.java 2008-02-09 16:11:00 UTC (rev 9901)
@@ -0,0 +1,242 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.test.jsp;
+
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.PortletInvokerException;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.Cookie;
+import javax.servlet.ServletOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.Writer;
+import java.util.Locale;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortalActionResponse extends PortalResponse
+{
+
+ /** . */
+ private String contentType;
+
+ /** . */
+ private Locale locale;
+
+ /** . */
+ private String characterEncoding;
+
+ /** . */
+ private int bufferSize;
+
+ /** . */
+ private ServletOutputStream outputStream;
+
+ /** . */
+ private PrintWriter writer;
+
+ /** . */
+ private Map<String, Portlet> windows;
+
+ public PortalActionResponse(HttpServletResponse response, PortletInvoker invoker) throws PortletInvokerException
+ {
+ super(response, invoker);
+
+ //
+ this.windows = new HashMap<String, Portlet>();
+ }
+
+ public void addWindow(String windowId, Portlet portlet)
+ {
+ windows.put(windowId, portlet);
+ }
+
+ public Set<String> getWindowIds()
+ {
+ return windows.keySet();
+ }
+
+ public Portlet getPortlet(String windowId)
+ {
+ return windows.get(windowId);
+ }
+
+ public ServletOutputStream getOutputStream() throws IOException
+ {
+ if (writer != null)
+ {
+ throw new IllegalStateException();
+ }
+ if (outputStream == null)
+ {
+ outputStream = new ServletOutputStream()
+ {
+ public void write(int b) throws IOException
+ {
+ }
+ };
+ }
+ return outputStream;
+ }
+
+ public PrintWriter getWriter() throws IOException
+ {
+ if (outputStream != null)
+ {
+ throw new IllegalStateException();
+ }
+ if (writer == null)
+ {
+ Writer tmp = new Writer()
+ {
+ public void write(char cbuf[], int off, int len) throws IOException
+ {
+ }
+ public void flush() throws IOException
+ {
+ }
+ public void close() throws IOException
+ {
+ }
+ };
+ writer = new PrintWriter(tmp);
+ }
+ return writer;
+ }
+
+ public void flushBuffer() throws IOException
+ {
+ }
+
+ public boolean isCommitted()
+ {
+ return false;
+ }
+
+ public void reset()
+ {
+ }
+
+ public void resetBuffer()
+ {
+ }
+
+ public void sendError(int i, String s) throws IOException
+ {
+ }
+
+ public void sendError(int i) throws IOException
+ {
+ }
+
+ public void sendRedirect(String s) throws IOException
+ {
+ }
+
+ public void addCookie(Cookie cookie)
+ {
+ }
+
+ public void setDateHeader(String s, long l)
+ {
+ }
+
+ public void addDateHeader(String s, long l)
+ {
+ }
+
+ public void setHeader(String s, String s1)
+ {
+ }
+
+ public void addHeader(String s, String s1)
+ {
+ }
+
+ public void setContentType(String contentType)
+ {
+ this.contentType = contentType;
+ }
+
+ public void setContentLength(int i)
+ {
+ }
+
+ public void setCharacterEncoding(String characterEncoding)
+ {
+ this.characterEncoding = characterEncoding;
+ }
+
+ public void setIntHeader(String s, int i)
+ {
+ }
+
+ public void addIntHeader(String s, int i)
+ {
+ }
+
+ public void setStatus(int i)
+ {
+ }
+
+ public void setStatus(int i, String s)
+ {
+ }
+
+ public void setLocale(Locale locale)
+ {
+ this.locale = locale;
+ }
+
+ public String getContentType()
+ {
+ return contentType;
+ }
+
+ public Locale getLocale()
+ {
+ return locale;
+ }
+
+ public String getCharacterEncoding()
+ {
+ return characterEncoding;
+ }
+
+ public void setBufferSize(int bufferSize)
+ {
+ this.bufferSize = bufferSize;
+ }
+
+ public int getBufferSize()
+ {
+ return bufferSize;
+ }
+}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalRenderResponse.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalRenderResponse.java 2008-02-09 14:44:32 UTC (rev 9900)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalRenderResponse.java 2008-02-09 16:11:00 UTC (rev 9901)
@@ -31,6 +31,7 @@
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.impl.spi.AbstractClientContext;
import org.jboss.portal.portlet.impl.spi.AbstractServerContext;
import org.jboss.portal.portlet.impl.spi.AbstractUserContext;
@@ -42,39 +43,36 @@
import org.jboss.portal.common.util.ParameterMap;
import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpServletResponseWrapper;
import javax.xml.namespace.QName;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class PortalRenderResponse extends HttpServletResponseWrapper
+public class PortalRenderResponse extends PortalResponse
{
/** . */
- private final PagePortletControllerContext portletControllerContext;
-
- /** . */
private PageNavigationalState pageState;
- /** . */
- private int count = 0;
-
/** Wether or not the page state can be modified. */
private boolean pageStateModifiable;
+ /** . */
+ private PagePortletControllerContext portletControllerContext;
+
public PortalRenderResponse(
HttpServletResponse response,
+ PortletInvoker invoker,
PagePortletControllerContext portletControllerContext,
- PageNavigationalState pageState)
+ PageNavigationalState pageState) throws PortletInvokerException
{
- super(response);
+ super(response, invoker);
//
- this.portletControllerContext = portletControllerContext;
this.pageState = pageState;
this.pageStateModifiable = true;
+ this.portletControllerContext = portletControllerContext;
}
/**
@@ -87,6 +85,11 @@
return pageState;
}
+ public PagePortletControllerContext getPortletControllerContext()
+ {
+ return portletControllerContext;
+ }
+
public PortletInvocationResponse render(Portlet portlet, String windowId) throws PortletInvokerException
{
WindowNavigationalState windowNS = null;
@@ -190,14 +193,4 @@
//
return null;
}
-
- public PagePortletControllerContext getPortletControllerContext()
- {
- return portletControllerContext;
- }
-
- public String nextId()
- {
- return "" + count++;
- }
}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java 2008-02-09 14:44:32 UTC (rev 9900)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java 2008-02-09 16:11:00 UTC (rev 9901)
@@ -1,203 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.test.jsp;
-
-import org.jboss.portal.portlet.test.controller.TestInstanceContext;
-import org.jboss.portal.portlet.test.controller.TestPortalContext;
-import org.jboss.portal.portlet.controller.state.PageNavigationalState;
-import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.impl.spi.AbstractClientContext;
-import org.jboss.portal.portlet.impl.spi.AbstractServerContext;
-import org.jboss.portal.portlet.impl.spi.AbstractUserContext;
-import org.jboss.portal.portlet.impl.spi.AbstractWindowContext;
-import org.jboss.portal.portlet.impl.spi.AbstractSecurityContext;
-import org.jboss.portal.portlet.spi.PortletInvocationContext;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.Mode;
-import org.jboss.portal.common.util.ParameterMap;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpServletResponseWrapper;
-import javax.xml.namespace.QName;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PortalResponse extends HttpServletResponseWrapper
-{
-
- /** . */
- private final PagePortletControllerContext portletControllerContext;
-
- /** . */
- private PageNavigationalState pageState;
-
- /** . */
- private int count = 0;
-
- /** Wether or not the page state can be modified. */
- private boolean pageStateModifiable;
-
- public PortalResponse(
- HttpServletResponse response,
- PagePortletControllerContext portletControllerContext,
- PageNavigationalState pageState)
- {
- super(response);
-
- //
- this.portletControllerContext = portletControllerContext;
- this.pageState = pageState;
- this.pageStateModifiable = true;
- }
-
- /**
- * The page state for the rendering.
- *
- * @return the page state
- */
- public PageNavigationalState getPageState()
- {
- return pageState;
- }
-
- public PortletInvocationResponse render(Portlet portlet, String windowId) throws PortletInvokerException
- {
- WindowNavigationalState windowNS = null;
- if (pageState != null)
- {
- windowNS = pageState.getWindowNavigationalState(windowId);
- }
-
- //
- ParameterMap publicNS = null;
- if (pageState != null)
- {
- publicNS = pageState.getPublicNavigationalState(windowId);
- }
-
- //
- Mode mode = Mode.VIEW;
- WindowState windowState = WindowState.NORMAL;
- StateString portletNS = null;
-
- //
- if (windowNS != null)
- {
- if (windowNS.getMode() != null)
- {
- mode = windowNS.getMode();
- }
- if (windowNS.getWindowState() != null)
- {
- windowState = windowNS.getWindowState();
- }
- if (windowNS.getPortletNavigationalState() != null)
- {
- portletNS = windowNS.getPortletNavigationalState();
- }
- }
-
- //
- PortletInvocationContext renderContext = portletControllerContext.createPortletInvocationContext(windowId, pageState);
- RenderInvocation render = new RenderInvocation(renderContext);
- render.setClientContext(new AbstractClientContext(portletControllerContext.getClientRequest()));
- render.setServerContext(new AbstractServerContext(portletControllerContext.getClientRequest(), portletControllerContext.getClientResponse()));
- render.setInstanceContext(new TestInstanceContext(portletControllerContext.getClientRequest(), portlet.getContext(), false));
- render.setUserContext(new AbstractUserContext(portletControllerContext.getClientRequest()));
- render.setWindowContext(new AbstractWindowContext(windowId));
- render.setPortalContext(new TestPortalContext());
- render.setSecurityContext(new AbstractSecurityContext(portletControllerContext.getClientRequest()));
- render.setTarget(portlet.getContext());
- render.setMode(mode);
- render.setWindowState(windowState);
- render.setNavigationalState(portletNS);
- render.setPublicNavigationalState(publicNS);
-
- //
- pageStateModifiable = false;
-
- //
- return portletControllerContext.invoke(render);
- }
-
- public boolean isPageStateModifiable()
- {
- return pageStateModifiable;
- }
-
- public String getPageParameter(QName name)
- {
- return pageState != null ? pageState.getPublicNavigationalState(name)[0] : null;
- }
-
- public void setPageParameter(QName name, String value)
- {
- if (pageStateModifiable)
- {
- if (pageState == null)
- {
- pageState = portletControllerContext.getStateControllerContext().createPageState(true);
- }
- pageState.setPublicNavigationalState(name, new String[]{value});
- }
- else
- {
- throw new IllegalStateException("Page state cannot be modified");
- }
- }
-
- public String getMaximizedWindowId()
- {
- if (pageState != null)
- {
- for (String windowId : pageState.getWindowIds())
- {
- WindowNavigationalState windowNS = pageState.getWindowNavigationalState(windowId);
- if (WindowState.MAXIMIZED.equals(windowNS.getWindowState()))
- {
- return windowId;
- }
- }
- }
-
- //
- return null;
- }
-
- public PagePortletControllerContext getPortletControllerContext()
- {
- return portletControllerContext;
- }
-
- public String nextId()
- {
- return "" + count++;
- }
-}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageParamTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageParamTag.java 2008-02-09 14:44:32 UTC (rev 9900)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageParamTag.java 2008-02-09 16:11:00 UTC (rev 9901)
@@ -87,11 +87,8 @@
this.frozen = frozen;
}
- public void internalDoTag() throws JspException, IOException
+ public void doRenderTag(PortalRenderResponse renderResponse) throws JspException, IOException
{
- PortalRenderResponse renderResponse = getPortalResponse();
-
- //
if (renderResponse.isPageStateModifiable())
{
QName name = new QName(namespaceURI, localName);
@@ -103,4 +100,8 @@
}
}
}
+
+ public void doActionTag() throws JspException, IOException
+ {
+ }
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageTag.java 2008-02-09 14:44:32 UTC (rev 9900)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageTag.java 2008-02-09 16:11:00 UTC (rev 9901)
@@ -23,6 +23,7 @@
package org.jboss.portal.portlet.test.jsp.taglib;
import org.jboss.portal.portlet.test.jsp.PortalRenderResponse;
+import org.jboss.portal.portlet.test.jsp.PortalResponse;
import javax.servlet.jsp.JspException;
import javax.xml.namespace.QName;
@@ -38,7 +39,7 @@
enum Status
{
- INACTIVE, ACTIVE, SUSPENDED
+ ACTIVE, SUSPENDED
}
/** . */
@@ -51,49 +52,25 @@
String content;
/** . */
- Status status = Status.INACTIVE;
+ Status status = Status.ACTIVE;
- public int doStartTag() throws JspException
+ public int doStartRenderTag(PortalRenderResponse renderResponse) throws JspException
{
- if (status == Status.INACTIVE)
- {
- PortalRenderResponse renderResponse = getPortalResponse();
+ maximizedId = renderResponse.getMaximizedWindowId();
- //
- status = Status.ACTIVE;
-
- //
- maximizedId = renderResponse.getMaximizedWindowId();
-
- //
- if (maximizedId != null)
- {
- return EVAL_BODY_BUFFERED;
- }
- else
- {
- return EVAL_BODY_INCLUDE;
- }
+ //
+ if (maximizedId != null)
+ {
+ return EVAL_BODY_BUFFERED;
}
else
{
- return SKIP_BODY;
+ return EVAL_BODY_INCLUDE;
}
}
- public int doEndTag() throws JspException
+ public int doEndRenderTag(PortalRenderResponse renderResponse) throws JspException
{
- switch (status)
- {
- case SUSPENDED:
- break;
- case INACTIVE:
- break;
- case ACTIVE:
- status = Status.INACTIVE;
- }
-
- //
if (maximizedId != null)
{
try
@@ -109,4 +86,14 @@
//
return EVAL_PAGE;
}
+
+ public int doStartTag(PortalResponse portalResponse) throws JspException
+ {
+ return EVAL_BODY_INCLUDE;
+ }
+
+ public int doEndTag(PortalResponse portalResponse) throws JspException
+ {
+ return EVAL_PAGE;
+ }
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/ParamTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/ParamTag.java 2008-02-09 14:44:32 UTC (rev 9900)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/ParamTag.java 2008-02-09 16:11:00 UTC (rev 9901)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.portlet.test.jsp.taglib;
+import org.jboss.portal.portlet.test.jsp.PortalRenderResponse;
+
import javax.servlet.jsp.tagext.SimpleTagSupport;
import javax.servlet.jsp.JspException;
import java.io.IOException;
@@ -59,7 +61,7 @@
this.value = value;
}
- public void internalDoTag() throws JspException, IOException
+ public void doRenderTag(PortalRenderResponse renderResponse) throws JspException, IOException
{
AbstractURLTag urlTag = (AbstractURLTag)SimpleTagSupport.findAncestorWithClass(this, AbstractURLTag.class);
urlTag.setParam(name, value);
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalBodyTagSupport.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalBodyTagSupport.java 2008-02-09 14:44:32 UTC (rev 9900)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalBodyTagSupport.java 2008-02-09 16:11:00 UTC (rev 9901)
@@ -23,6 +23,9 @@
package org.jboss.portal.portlet.test.jsp.taglib;
import org.jboss.portal.portlet.test.jsp.PortalRenderResponse;
+import org.jboss.portal.portlet.test.jsp.PortalActionResponse;
+import org.jboss.portal.portlet.test.jsp.PortalResponse;
+import org.jboss.portal.common.NotYetImplemented;
import javax.servlet.jsp.tagext.BodyTagSupport;
import javax.servlet.jsp.JspException;
@@ -33,34 +36,74 @@
*/
public class PortalBodyTagSupport extends BodyTagSupport
{
- protected final PortalRenderResponse getPortalResponse()
+
+ private PortalResponse getPortalResponse()
{
- return (PortalRenderResponse)pageContext.getResponse();
+ return (PortalResponse)pageContext.getResponse();
}
- public int doStartTag() throws JspException
+ public final int doStartTag() throws JspException
{
+ return doStartTag(getPortalResponse());
+ }
+
+ public final int doEndTag() throws JspException
+ {
+ return doEndTag(getPortalResponse());
+ }
+
+ public int doStartTag(PortalResponse portalResponse) throws JspException
+ {
PageTag pageTag = (PageTag)findAncestorWithClass(this, PageTag.class);
//
+ if (pageTag == null && this instanceof PageTag)
+ {
+ pageTag = (PageTag)this;
+
+ //
+ pageTag.status = PageTag.Status.ACTIVE;
+ }
+
+ //
if (pageTag == null || pageTag.status != PageTag.Status.ACTIVE)
{
return SKIP_BODY;
}
else
{
- return internalDoStartTag();
+ if (portalResponse instanceof PortalActionResponse)
+ {
+ return doStartActionTag((PortalActionResponse)portalResponse);
+ }
+ else
+ {
+ return doStartRenderTag((PortalRenderResponse)portalResponse);
+ }
}
}
- public int doEndTag() throws JspException
+ public int doEndTag(PortalResponse portalResponse) throws JspException
{
PageTag pageTag = (PageTag)findAncestorWithClass(this, PageTag.class);
//
+ if (pageTag == null && this instanceof PageTag)
+ {
+ pageTag = (PageTag)this;
+ }
+
+ //
if (pageTag != null && pageTag.status == PageTag.Status.ACTIVE)
{
- return internalDoEndTag();
+ if (portalResponse instanceof PortalActionResponse)
+ {
+ return doEndActionTag((PortalActionResponse)portalResponse);
+ }
+ else
+ {
+ return doEndRenderTag((PortalRenderResponse)portalResponse);
+ }
}
else
{
@@ -68,12 +111,22 @@
}
}
- public int internalDoStartTag() throws JspException
+ public int doStartActionTag(PortalActionResponse actionResponse) throws JspException
{
+ throw new NotYetImplemented();
+ }
+
+ public int doEndActionTag(PortalActionResponse actionResponse) throws JspException
+ {
+ throw new NotYetImplemented();
+ }
+
+ public int doStartRenderTag(PortalRenderResponse renderResponse) throws JspException
+ {
return super.doStartTag();
}
- public int internalDoEndTag() throws JspException
+ public int doEndRenderTag(PortalRenderResponse renderResponse) throws JspException
{
return super.doEndTag();
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalSimpleTagSupport.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalSimpleTagSupport.java 2008-02-09 14:44:32 UTC (rev 9900)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortalSimpleTagSupport.java 2008-02-09 16:11:00 UTC (rev 9901)
@@ -23,6 +23,9 @@
package org.jboss.portal.portlet.test.jsp.taglib;
import org.jboss.portal.portlet.test.jsp.PortalRenderResponse;
+import org.jboss.portal.portlet.test.jsp.PortalResponse;
+import org.jboss.portal.portlet.test.jsp.PortalActionResponse;
+import org.jboss.portal.common.NotYetImplemented;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import javax.servlet.jsp.PageContext;
@@ -35,25 +38,37 @@
*/
public class PortalSimpleTagSupport extends SimpleTagSupport
{
- protected final PortalRenderResponse getPortalResponse()
+ private PortalResponse getPortalResponse()
{
PageContext pageContext = (PageContext)getJspContext();
- return (PortalRenderResponse)pageContext.getResponse();
+ return (PortalResponse)pageContext.getResponse();
}
- public void doTag() throws JspException, IOException
+ public final void doTag() throws JspException, IOException
{
PageTag pageTag = (PageTag)findAncestorWithClass(this, PageTag.class);
//
if (pageTag != null && pageTag.status == PageTag.Status.ACTIVE)
{
- internalDoTag();
+ if (getPortalResponse() instanceof PortalActionResponse)
+ {
+ doActionTag();
+ }
+ else
+ {
+ doRenderTag((PortalRenderResponse)getPortalResponse());
+ }
}
}
- public void internalDoTag() throws JspException, IOException
+ public void doActionTag() throws JspException, IOException
{
+ throw new NotYetImplemented();
+ }
+
+ public void doRenderTag(PortalRenderResponse renderResponse) throws JspException, IOException
+ {
super.doTag();
}
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletMarkupTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletMarkupTag.java 2008-02-09 14:44:32 UTC (rev 9900)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletMarkupTag.java 2008-02-09 16:11:00 UTC (rev 9901)
@@ -39,10 +39,8 @@
*/
public class PortletMarkupTag extends PortalSimpleTagSupport
{
- public void internalDoTag() throws JspException, IOException
+ public void doRenderTag(PortalRenderResponse renderResponse) throws JspException, IOException
{
- PortalRenderResponse resp = getPortalResponse();
-
PortletTag portletTag = (PortletTag)SimpleTagSupport.findAncestorWithClass(this, PortletTag.class);
PortletInvocationResponse portletResp = portletTag.result.getResponse();
@@ -55,9 +53,9 @@
{
FragmentResponse fragment = (FragmentResponse)portletResp;
WindowNavigationalState windowNS = null;
- if (resp.getPageState() != null)
+ if (renderResponse.getPageState() != null)
{
- windowNS = resp.getPageState().getWindowNavigationalState(portletTag.result.getWindowId());
+ windowNS = renderResponse.getPageState().getWindowNavigationalState(portletTag.result.getWindowId());
}
if (windowNS == null || !windowNS.getWindowState().equals(WindowState.MINIMIZED))
{
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java 2008-02-09 14:44:32 UTC (rev 9900)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java 2008-02-09 16:11:00 UTC (rev 9901)
@@ -23,7 +23,8 @@
package org.jboss.portal.portlet.test.jsp.taglib;
import org.jboss.portal.portlet.test.jsp.PortalRenderResponse;
-import org.jboss.portal.portlet.test.jsp.PagePortletControllerContext;
+import org.jboss.portal.portlet.test.jsp.PortalActionResponse;
+import org.jboss.portal.portlet.test.jsp.PortalResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
@@ -78,7 +79,8 @@
private Set<Mode> supportedModes;
private Mode initialMode;
private PageTag pageTag;
- private PortalRenderResponse renderResponse;
+ private Portlet portlet;
+ private String windowId;
/** . */
PortletResult result;
@@ -143,7 +145,7 @@
this.errorPageAttr = errorPage;
}
- private void initState()
+ private void initState(PortalResponse portalResponse)
{
//
Set<Mode> supportedModes = new LinkedHashSet<Mode>();
@@ -183,11 +185,22 @@
}
//
+ Portlet portlet = portalResponse.findPortlet(applicationNameAttr, nameAttr);
+
+ //
+ String windowId = null;
+ if (portlet != null)
+ {
+ windowId = portlet.getContext().getId() + "." + portalResponse.nextId();
+ }
+
+ //
this.initialMode = initialMode;
this.supportedModes = supportedModes;
this.supportedWindowStates = supportedWindowStates;
this.pageTag = (PageTag)findAncestorWithClass(this, PageTag.class);
- this.renderResponse = getPortalResponse();
+ this.portlet = portlet;
+ this.windowId = windowId;
}
private void destroyState()
@@ -196,37 +209,51 @@
this.supportedModes = null;
this.supportedWindowStates = null;
this.pageTag = null;
- this.renderResponse = null;
+ this.portlet = null;
+ this.windowId = null;
}
- public int internalDoStartTag() throws JspException
+ public int doStartActionTag(PortalActionResponse actionResponse) throws JspException
{
- initState();
+ initState(actionResponse);
//
- PagePortletControllerContext context = renderResponse.getPortletControllerContext();
+ if (portlet != null)
+ {
+ actionResponse.addWindow(windowId, portlet);
+ }
//
- Portlet portlet = context.findPortlet(applicationNameAttr, nameAttr);
+ return SKIP_BODY;
+ }
+ public int doEndActionTag(PortalActionResponse actionResponse) throws JspException
+ {
+ destroyState();
+
//
+ return EVAL_PAGE;
+ }
+
+ public int doStartRenderTag(PortalRenderResponse renderResponse) throws JspException
+ {
+ initState(renderResponse);
+
+ //
if (portlet == null)
{
- handleError(null, Constants.NOT_FOUND, null, null);
+ handleError(renderResponse, Constants.NOT_FOUND, null, null);
// We cannot show an absent portlet, no meta data
return SKIP_BODY;
}
else
{
- String windowId = portlet.getContext().getId() + "." + renderResponse.nextId();
-
- //
if (pageTag.maximizedId != null)
{
if (windowId.equals(pageTag.maximizedId))
{
- return render(portlet, windowId, EVAL_BODY_BUFFERED);
+ return render(renderResponse, EVAL_BODY_BUFFERED);
}
else
{
@@ -235,12 +262,12 @@
}
else
{
- return render(portlet, windowId, EVAL_BODY_INCLUDE);
+ return render(renderResponse, EVAL_BODY_INCLUDE);
}
}
}
- public int internalDoEndTag() throws JspException
+ public int doEndRenderTag(PortalRenderResponse renderResponse) throws JspException
{
if (bodyContent != null)
{
@@ -254,7 +281,7 @@
return EVAL_PAGE;
}
- public int render(Portlet portlet, String windowId, int rt)
+ public int render(PortalRenderResponse renderResponse, int rt)
{
try
{
@@ -280,21 +307,21 @@
ErrorResponse error = (ErrorResponse)portletResponse;
//
- handleError(windowId, Constants.PORTLET_ERROR, error.getCause(), error.getMessage());
+ handleError(renderResponse, Constants.PORTLET_ERROR, error.getCause(), error.getMessage());
//
return SKIP_BODY;
}
else if (portletResponse instanceof UnavailableResponse)
{
- handleError(windowId, Constants.UNAVAILABLE, null, null);
+ handleError(renderResponse, Constants.UNAVAILABLE, null, null);
//
return SKIP_BODY;
}
else
{
- handleError(windowId, Constants.INTERNAL_ERROR, null, null);
+ handleError(renderResponse, Constants.INTERNAL_ERROR, null, null);
//
return SKIP_BODY;
@@ -302,14 +329,14 @@
}
catch (PortletInvokerException e)
{
- handleError(windowId, Constants.INTERNAL_ERROR, e, e.getMessage());
+ handleError(renderResponse, Constants.INTERNAL_ERROR, e, e.getMessage());
//
return SKIP_BODY;
}
}
- private void handleError(String windowId, String errorStatus, Throwable cause, String message)
+ private void handleError(PortalRenderResponse renderResponse, String errorStatus, Throwable cause, String message)
{
if (errorPageAttr != null)
{
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTitleTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTitleTag.java 2008-02-09 14:44:32 UTC (rev 9900)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTitleTag.java 2008-02-09 16:11:00 UTC (rev 9901)
@@ -24,6 +24,7 @@
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.test.jsp.PortalRenderResponse;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
@@ -37,7 +38,7 @@
public class PortletTitleTag extends PortalSimpleTagSupport
{
- public void internalDoTag() throws JspException, IOException
+ public void doRenderTag(PortalRenderResponse renderResponse) throws JspException, IOException
{
PortletTag portletTag = (PortletTag)SimpleTagSupport.findAncestorWithClass(this, PortletTag.class);
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java 2008-02-09 14:44:32 UTC (rev 9900)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java 2008-02-09 16:11:00 UTC (rev 9901)
@@ -70,14 +70,13 @@
this.windowStateValue = windowState;
}
- public int internalDoStartTag() throws JspException
+ public int doStartRenderTag(PortalRenderResponse renderResponse) throws JspException
{
return EVAL_BODY_BUFFERED;
}
- public int internalDoEndTag() throws JspException
+ public int doEndRenderTag(PortalRenderResponse renderResponse) throws JspException
{
- PortalRenderResponse renderResponse = getPortalResponse();
PagePortletControllerContext context = renderResponse.getPortletControllerContext();
PortletTag portletTag = (PortletTag)SimpleTagSupport.findAncestorWithClass(this, PortletTag.class);
16 years, 5 months
JBoss Portal SVN: r9900 - modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2008-02-09 09:44:32 -0500 (Sat, 09 Feb 2008)
New Revision: 9900
Modified:
modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo1.jsp
modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo2.jsp
modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo3.jsp
Log:
page updates
Modified: modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo1.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo1.jsp 2008-02-09 14:31:49 UTC (rev 9899)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo1.jsp 2008-02-09 14:44:32 UTC (rev 9900)
@@ -10,10 +10,10 @@
<portal:pageparam namespaceURI="urn:jboss:portal:simple:google" localName="zipcode" value="80201"/>
<jbp:layout1>
<jsp:attribute name="leftcol">
-
+ <jbp:portlet name="Cart" applicationName="cart-event-portlet"/>
</jsp:attribute>
<jsp:attribute name="rightcol">
-
+ <jbp:portlet name="Catalog" applicationName="cart-event-portlet"/>
</jsp:attribute>
</jbp:layout1>
</portal:page>
Modified: modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo2.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo2.jsp 2008-02-09 14:31:49 UTC (rev 9899)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo2.jsp 2008-02-09 14:44:32 UTC (rev 9900)
@@ -10,10 +10,13 @@
<portal:pageparam namespaceURI="urn:jboss:portal:simple:google" localName="zipcode" value="80201"/>
<jbp:layout1>
<jsp:attribute name="leftcol">
+ <jbp:portlet name="RemoteControl" applicationName="remotecontrol-portlet"/>
</jsp:attribute>
<jsp:attribute name="rightcol">
+ <jbp:portlet name="GoogleWeather" applicationName="google-weather-portlet"/>
+
</jsp:attribute>
</jbp:layout1>
</portal:page>
Modified: modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo3.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo3.jsp 2008-02-09 14:31:49 UTC (rev 9899)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo/demo3.jsp 2008-02-09 14:44:32 UTC (rev 9900)
@@ -11,9 +11,12 @@
<jbp:layout1>
<jsp:attribute name="leftcol">
+ <jbp:portlet name="Foo" applicationName="bar"/>
+
+
</jsp:attribute>
<jsp:attribute name="rightcol">
-
+ <jbp:portlet name="ErrorPortlet" applicationName="samples-basic"/>
</jsp:attribute>
</jbp:layout1>
</portal:page>
16 years, 5 months