Author: mstruk
Date: 2010-08-20 10:16:33 -0400 (Fri, 20 Aug 2010)
New Revision: 3880
Modified:
sandbox/cdi_support/pc/branches/cdi/api/pom.xml
sandbox/cdi_support/pc/branches/cdi/api/src/main/java/org/gatein/pc/api/PortletInvoker.java
sandbox/cdi_support/pc/branches/cdi/bridge/pom.xml
sandbox/cdi_support/pc/branches/cdi/controller/pom.xml
sandbox/cdi_support/pc/branches/cdi/docs/pom.xml
sandbox/cdi_support/pc/branches/cdi/docs/user-guide/pom.xml
sandbox/cdi_support/pc/branches/cdi/federation/pom.xml
sandbox/cdi_support/pc/branches/cdi/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java
sandbox/cdi_support/pc/branches/cdi/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java
sandbox/cdi_support/pc/branches/cdi/jsr168api/pom.xml
sandbox/cdi_support/pc/branches/cdi/management/pom.xml
sandbox/cdi_support/pc/branches/cdi/mc/pom.xml
sandbox/cdi_support/pc/branches/cdi/pom.xml
sandbox/cdi_support/pc/branches/cdi/portal/pom.xml
sandbox/cdi_support/pc/branches/cdi/portlet/pom.xml
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/PortletInvokerInterceptor.java
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/ResourceResponseImpl.java
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/ResourceURLImpl.java
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr286/taglib/ResourceURL286Tag.java
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr286/taglib/ResourceURL286TagTEI.java
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/state/consumer/ConsumerPortletInvoker.java
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/state/producer/ProducerPortletInvoker.java
sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/portlet/support/PortletInvokerSupport.java
sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java
sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java
sandbox/cdi_support/pc/branches/cdi/samples/pom.xml
sandbox/cdi_support/pc/branches/cdi/samples/src/main/java/org/gatein/pc/samples/remotecontroller/RemoteControllerPortlet.java
sandbox/cdi_support/pc/branches/cdi/test/pom.xml
sandbox/cdi_support/pc/branches/cdi/test/src/test/java/org/gatein/pc/test/portlet/jsr286/tck/resourceserving/DowngradeCacheabilityTestCase.java
sandbox/cdi_support/pc/branches/cdi/test/src/test/java/org/gatein/pc/test/portlet/jsr286/tck/taglib/ResourceURLTestCase.java
sandbox/cdi_support/pc/branches/cdi/test/src/test/resources/jsr286/tck/taglib-war/resourceURL.jsp
Log:
Merged trunk changes up to r3877
Modified: sandbox/cdi_support/pc/branches/cdi/api/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/api/pom.xml 2010-08-20 12:45:16 UTC (rev 3879)
+++ sandbox/cdi_support/pc/branches/cdi/api/pom.xml 2010-08-20 14:16:33 UTC (rev 3880)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.2-GA-SNAPSHOT</version>
+ <version>2.2.0-Beta02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.gatein.pc</groupId>
Modified:
sandbox/cdi_support/pc/branches/cdi/api/src/main/java/org/gatein/pc/api/PortletInvoker.java
===================================================================
---
sandbox/cdi_support/pc/branches/cdi/api/src/main/java/org/gatein/pc/api/PortletInvoker.java 2010-08-20
12:45:16 UTC (rev 3879)
+++
sandbox/cdi_support/pc/branches/cdi/api/src/main/java/org/gatein/pc/api/PortletInvoker.java 2010-08-20
14:16:33 UTC (rev 3880)
@@ -71,7 +71,7 @@
/**
* Clone a portlet.
*
- * @param stateType the portle state type desired
+ * @param stateType the portlet state type desired
* @param portletContext the portlet context to clone @return the clone id
* @return the cloned portlet context
* @throws IllegalArgumentException if the portletId is null
@@ -125,4 +125,26 @@
* @throws PortletInvokerException a portlet invoker exception
*/
PortletContext setProperties(PortletContext portletContext, PropertyChange[] changes)
throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException;
+
+ /**
+ * Exports a portlet from the invoker which can be used to recreate this portlet
during an import portlet operation
+ * The returned portlet Id will be the portlet Id of the base portlet, not a cloned
portlet Id
+ * If the portlet contains state, it will be returned regardless if the portlet
invoker is set to persist state locally.
+ *
+ * @param stateType the portlet state type desired
+ * @param originalPortletContext the context of the porlet to be exported
+ * @return A new portlet context which can be used to import a portlet
+ * @throws PortletInvokerException
+ */
+ PortletContext exportPortlet(PortletStateType stateType, PortletContext
originalPortletContext) throws PortletInvokerException;
+
+ /**
+ * Imports a portlet into the invoker.
+ *
+ * @param stateType the portlet state type desired
+ * @param contextToImport the context to be imported
+ * @return The portletcontext for the imported portlet
+ * @throws PortletInvokerException
+ */
+ PortletContext importPortlet(PortletStateType stateType, PortletContext
contextToImport) throws PortletInvokerException;
}
Modified: sandbox/cdi_support/pc/branches/cdi/bridge/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/bridge/pom.xml 2010-08-20 12:45:16 UTC (rev 3879)
+++ sandbox/cdi_support/pc/branches/cdi/bridge/pom.xml 2010-08-20 14:16:33 UTC (rev 3880)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.2-GA-SNAPSHOT</version>
+ <version>2.2.0-Beta02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-bridge</artifactId>
Modified: sandbox/cdi_support/pc/branches/cdi/controller/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/controller/pom.xml 2010-08-20 12:45:16 UTC (rev
3879)
+++ sandbox/cdi_support/pc/branches/cdi/controller/pom.xml 2010-08-20 14:16:33 UTC (rev
3880)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.2-GA-SNAPSHOT</version>
+ <version>2.2.0-Beta02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-controller</artifactId>
Modified: sandbox/cdi_support/pc/branches/cdi/docs/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/docs/pom.xml 2010-08-20 12:45:16 UTC (rev 3879)
+++ sandbox/cdi_support/pc/branches/cdi/docs/pom.xml 2010-08-20 14:16:33 UTC (rev 3880)
@@ -3,7 +3,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.2-GA-SNAPSHOT</version>
+ <version>2.2.0-Beta02-SNAPSHOT</version>
</parent>
<artifactId>docs-aggregator</artifactId>
<packaging>pom</packaging>
Modified: sandbox/cdi_support/pc/branches/cdi/docs/user-guide/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/docs/user-guide/pom.xml 2010-08-20 12:45:16 UTC
(rev 3879)
+++ sandbox/cdi_support/pc/branches/cdi/docs/user-guide/pom.xml 2010-08-20 14:16:33 UTC
(rev 3880)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.2-GA-SNAPSHOT</version>
+ <version>2.2.0-Beta02-SNAPSHOT</version>
</parent>
<groupId>org.gatein.pc</groupId>
<artifactId>user-guide-${translation}</artifactId>
Modified: sandbox/cdi_support/pc/branches/cdi/federation/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/federation/pom.xml 2010-08-20 12:45:16 UTC (rev
3879)
+++ sandbox/cdi_support/pc/branches/cdi/federation/pom.xml 2010-08-20 14:16:33 UTC (rev
3880)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.2-GA-SNAPSHOT</version>
+ <version>2.2.0-Beta02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-federation</artifactId>
Modified:
sandbox/cdi_support/pc/branches/cdi/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java
===================================================================
---
sandbox/cdi_support/pc/branches/cdi/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java 2010-08-20
12:45:16 UTC (rev 3879)
+++
sandbox/cdi_support/pc/branches/cdi/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java 2010-08-20
14:16:33 UTC (rev 3880)
@@ -219,6 +219,21 @@
}
+ public PortletContext exportPortlet(PortletStateType stateType, PortletContext
compoundPortletContext)
+ throws PortletInvokerException
+ {
+ PortletContext portletContext = dereference(compoundPortletContext);
+ portletContext = portletInvoker.exportPortlet(stateType, portletContext);
+ return reference(portletContext);
+ }
+
+ public PortletContext importPortlet(PortletStateType stateType, PortletContext
compoundPortletContext) throws PortletInvokerException
+ {
+ PortletContext portletContext = dereference(compoundPortletContext);
+ portletContext = portletInvoker.exportPortlet(stateType, portletContext);
+ return reference(portletContext);
+ }
+
private PortletContext dereference(PortletContext compoundPortletContext)
{
String portletId = compoundPortletContext.getId().substring(id.length() + 1);
Modified:
sandbox/cdi_support/pc/branches/cdi/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java
===================================================================
---
sandbox/cdi_support/pc/branches/cdi/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java 2010-08-20
12:45:16 UTC (rev 3879)
+++
sandbox/cdi_support/pc/branches/cdi/federation/src/main/java/org/gatein/pc/federation/impl/FederatingPortletInvokerService.java 2010-08-20
14:16:33 UTC (rev 3880)
@@ -231,6 +231,20 @@
return federated.setProperties(compoundPortletContext, changes);
}
+ public PortletContext exportPortlet(PortletStateType stateType, PortletContext
compoundPortletContext)
+ throws PortletInvokerException
+ {
+ PortletInvoker federated = getFederatedPortletInvokerFor(compoundPortletContext);
+ return federated.exportPortlet(stateType, compoundPortletContext);
+ }
+
+ public PortletContext importPortlet(PortletStateType stateType, PortletContext
compoundPortletContext)
+ throws PortletInvokerException
+ {
+ PortletInvoker federated = getFederatedPortletInvokerFor(compoundPortletContext);
+ return federated.importPortlet(stateType, compoundPortletContext);
+ }
+
public synchronized void setNullInvokerHandler(NullInvokerHandler nullHandler)
{
if (nullHandler == null)
Modified: sandbox/cdi_support/pc/branches/cdi/jsr168api/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/jsr168api/pom.xml 2010-08-20 12:45:16 UTC (rev
3879)
+++ sandbox/cdi_support/pc/branches/cdi/jsr168api/pom.xml 2010-08-20 14:16:33 UTC (rev
3880)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.2-GA-SNAPSHOT</version>
+ <version>2.2.0-Beta02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-jsr168api</artifactId>
Modified: sandbox/cdi_support/pc/branches/cdi/management/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/management/pom.xml 2010-08-20 12:45:16 UTC (rev
3879)
+++ sandbox/cdi_support/pc/branches/cdi/management/pom.xml 2010-08-20 14:16:33 UTC (rev
3880)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.2-GA-SNAPSHOT</version>
+ <version>2.2.0-Beta02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-management</artifactId>
Modified: sandbox/cdi_support/pc/branches/cdi/mc/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/mc/pom.xml 2010-08-20 12:45:16 UTC (rev 3879)
+++ sandbox/cdi_support/pc/branches/cdi/mc/pom.xml 2010-08-20 14:16:33 UTC (rev 3880)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.2-GA-SNAPSHOT</version>
+ <version>2.2.0-Beta02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-mc</artifactId>
Modified: sandbox/cdi_support/pc/branches/cdi/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/pom.xml 2010-08-20 12:45:16 UTC (rev 3879)
+++ sandbox/cdi_support/pc/branches/cdi/pom.xml 2010-08-20 14:16:33 UTC (rev 3880)
@@ -1,284 +1,307 @@
+<!--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2010, 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.
+ -->
+
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <name>GateIn - Portlet Container</name>
-
- <groupId>org.gatein.pc</groupId>
- <artifactId>pc-parent</artifactId>
- <version>2.1.2-GA-SNAPSHOT</version>
- <packaging>pom</packaging>
-
- <parent>
- <groupId>org.gatein</groupId>
- <artifactId>gatein-parent</artifactId>
- <version>1.0.1-GA</version>
- </parent>
-
- <scm>
-
<
connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/pc...
-
<
developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/compone...
- <
url>http://fisheye.jboss.org/browse/gatein/components/pc/trunk/</ur...
- </scm>
-
- <properties>
- <version.gatein.common>2.0.2-GA</version.gatein.common>
- <version.gatein.wci>2.0.1-GA</version.gatein.wci>
- <version.apache.portals.bridges>1.0.4</version.apache.portals.bridges>
- <version.apache.taglibs>1.1.2</version.apache.taglibs>
- <version.apache.log4j>1.2.14</version.apache.log4j>
- <!-- used in test module by maven-antrun-extended-plugin -->
- <version.jboss.unit>1.2.3</version.jboss.unit>
- <version.cargo>1.0.1-alpha-1</version.cargo>
-
- <preparationGoals>clean install</preparationGoals>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <!-- Import dependency management configuration -->
- <dependency>
- <groupId>org.gatein</groupId>
- <artifactId>gatein-dep</artifactId>
- <version>1.0.2-GA</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
-
- <!-- Internal dependencies -->
- <dependency>
- <groupId>org.gatein.common</groupId>
- <artifactId>common-common</artifactId>
- <version>${version.gatein.common}</version>
- </dependency>
+ <modelVersion>4.0.0</modelVersion>
- <dependency>
- <groupId>org.gatein.common</groupId>
- <artifactId>common-logging</artifactId>
- <version>${version.gatein.common}</version>
- </dependency>
-
- <dependency>
- <groupId>org.gatein.common</groupId>
- <artifactId>common-mc</artifactId>
- <version>${version.gatein.common}</version>
- </dependency>
+ <name>GateIn - Portlet Container</name>
- <dependency>
- <groupId>org.gatein.pc</groupId>
- <artifactId>pc-portlet</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.gatein.pc</groupId>
- <artifactId>pc-portlet</artifactId>
- <type>test-jar</type>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.gatein.pc</groupId>
- <artifactId>pc-portlet</artifactId>
- <type>test-jar</type>
- <classifier>tests</classifier>
- <version>${project.version}</version>
- </dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-parent</artifactId>
+ <version>2.2.0-Beta02-SNAPSHOT</version>
+ <packaging>pom</packaging>
- <dependency>
- <groupId>org.gatein.pc</groupId>
- <artifactId>pc-controller</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.gatein.pc</groupId>
- <artifactId>pc-mc</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.gatein.pc</groupId>
- <artifactId>pc-api</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.gatein.wci</groupId>
- <artifactId>wci-wci</artifactId>
- <version>${version.gatein.wci}</version>
- </dependency>
- <dependency>
- <groupId>org.gatein.wci</groupId>
- <artifactId>wci-tomcat</artifactId>
- <version>${version.gatein.wci}</version>
- </dependency>
+ <parent>
+ <groupId>org.gatein</groupId>
+ <artifactId>gatein-parent</artifactId>
+ <version>1.0.1-GA</version>
+ </parent>
+ <scm>
+
<
connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/pc...
+
<
developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/compone...
+ <
url>http://fisheye.jboss.org/browse/gatein/components/pc/trunk/</ur...
+ </scm>
+
+ <properties>
+ <version.gatein.common>2.0.3-GA</version.gatein.common>
+ <version.gatein.wci>2.0.1-GA</version.gatein.wci>
+ <version.apache.portals.bridges>1.0.4</version.apache.portals.bridges>
+ <version.apache.taglibs>1.1.2</version.apache.taglibs>
+ <version.apache.log4j>1.2.14</version.apache.log4j>
+
+ <!-- used in test module by maven-antrun-extended-plugin -->
+ <version.jboss.unit>1.2.3</version.jboss.unit>
+ <version.cargo>1.0.1-alpha-1</version.cargo>
+
+ <preparationGoals>clean install</preparationGoals>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <!-- Import dependency management configuration -->
+ <dependency>
+ <groupId>org.gatein</groupId>
+ <artifactId>gatein-dep</artifactId>
+ <version>1.0.2-GA</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+
+ <!-- Internal dependencies -->
+ <dependency>
+ <groupId>org.gatein.common</groupId>
+ <artifactId>common-common</artifactId>
+ <version>${version.gatein.common}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.gatein.common</groupId>
+ <artifactId>common-logging</artifactId>
+ <version>${version.gatein.common}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.gatein.common</groupId>
+ <artifactId>common-mc</artifactId>
+ <version>${version.gatein.common}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-portlet</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-portlet</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-portlet</artifactId>
+ <type>test-jar</type>
+ <classifier>tests</classifier>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-controller</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-mc</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.pc</groupId>
+ <artifactId>pc-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.gatein.wci</groupId>
+ <artifactId>wci-wci</artifactId>
+ <version>${version.gatein.wci}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wci</groupId>
+ <artifactId>wci-tomcat</artifactId>
+ <version>${version.gatein.wci}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>apache-taglibs</groupId>
+ <artifactId>jstl</artifactId>
+ <version>${version.apache.taglibs}</version>
+ </dependency>
+ <dependency>
+ <groupId>apache-taglibs</groupId>
+ <artifactId>standard</artifactId>
+ <version>${version.apache.taglibs}</version>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
<dependency>
- <groupId>apache-taglibs</groupId>
- <artifactId>jstl</artifactId>
- <version>${version.apache.taglibs}</version>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <!--<version>${org.slf4j.version}</version>-->
+ <scope>test</scope>
</dependency>
- <dependency>
- <groupId>apache-taglibs</groupId>
- <artifactId>standard</artifactId>
- <version>${version.apache.taglibs}</version>
- </dependency>
-
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <!--<version>${org.slf4j.version}</version>-->
- <scope>test</scope>
- </dependency>
- </dependencies>
+ </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.3.1</version>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.1</version>
- <configuration>
- <archive>
- <manifest>
- <addClasspath>false</addClasspath>
- </manifest>
- </archive>
- </configuration>
- </plugin>
- </plugins>
- <pluginManagement>
+ <build>
<plugins>
- <plugin>
- <groupId>org.jboss.unit</groupId>
- <artifactId>jboss-unit-tooling-maven2</artifactId>
- <version>1.2.1</version>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3.1</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.1</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>false</addClasspath>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
</plugins>
- </pluginManagement>
- </build>
-
- <profiles>
- <profile>
- <id>default</id>
- <modules>
- <module>api</module>
- <module>jsr168api</module>
- <module>portlet</module>
- <module>controller</module>
- <module>bridge</module>
- <module>federation</module>
- <module>management</module>
- <module>mc</module>
- <module>test</module>
- <module>portal</module>
- <module>samples</module>
- <module>docs</module>
- </modules>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- </profile>
- <profile>
- <id>docs</id>
- <modules>
- <module>docs</module>
- </modules>
- </profile>
- <profile>
- <id>test</id>
- <modules>
- <module>api</module>
- <module>portlet</module>
- <module>controller</module>
- <module>mc</module>
- <module>test</module>
- </modules>
- </profile>
- <profile>
- <id>portal</id>
- <modules>
- <module>api</module>
- <module>portlet</module>
- <module>controller</module>
- <module>mc</module>
- <module>portal</module>
- <module>samples</module>
- </modules>
- </profile>
- <profile>
- <id>release</id>
- <modules>
- <module>api</module>
- <module>portlet</module>
- <module>controller</module>
- <module>mc</module>
- <module>portal</module>
- <module>samples</module>
- <module>docs</module>
- </modules>
- </profile>
- </profiles>
-
- <repositories>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-tooling-maven2</artifactId>
+ <version>1.2.1</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
- <repository>
- <id>jboss-public-repository-group</id>
- <name>JBoss Public Maven Repository Group</name>
- <
url>https://repository.jboss.org/nexus/content/groups/public/</url>
- <layout>default</layout>
- <releases>
- <enabled>true</enabled>
- <updatePolicy>never</updatePolicy>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- <updatePolicy>never</updatePolicy>
- </snapshots>
- </repository>
- <repository>
- <id>repository.jboss.org</id>
- <name>JBoss Repository</name>
- <layout>default</layout>
- <
url>http://repository.jboss.org/maven2/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>snapshots.jboss.org</id>
- <name>JBoss Snapshots Repository</name>
- <layout>default</layout>
- <
url>http://snapshots.jboss.org/maven2/</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>false</enabled>
- </releases>
- </repository>
- </repositories>
-
+ <profiles>
+ <profile>
+ <id>default</id>
+ <modules>
+ <module>api</module>
+ <module>jsr168api</module>
+ <module>portlet</module>
+ <module>controller</module>
+ <module>bridge</module>
+ <module>federation</module>
+ <module>management</module>
+ <module>mc</module>
+ <module>test</module>
+ <module>portal</module>
+ <module>samples</module>
+ <module>docs</module>
+ </modules>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ </profile>
+ <profile>
+ <id>docs</id>
+ <modules>
+ <module>docs</module>
+ </modules>
+ </profile>
+ <profile>
+ <id>test</id>
+ <modules>
+ <module>api</module>
+ <module>portlet</module>
+ <module>controller</module>
+ <module>mc</module>
+ <module>test</module>
+ </modules>
+ </profile>
+ <profile>
+ <id>portal</id>
+ <modules>
+ <module>api</module>
+ <module>portlet</module>
+ <module>controller</module>
+ <module>mc</module>
+ <module>portal</module>
+ <module>samples</module>
+ </modules>
+ </profile>
+ <profile>
+ <id>release</id>
+ <modules>
+ <module>api</module>
+ <module>portlet</module>
+ <module>controller</module>
+ <module>mc</module>
+ <module>portal</module>
+ <module>samples</module>
+ <module>docs</module>
+ </modules>
+ </profile>
+ </profiles>
+
+ <repositories>
+
+ <repository>
+ <id>jboss-public-repository-group</id>
+ <name>JBoss Public Maven Repository Group</name>
+
<
url>https://repository.jboss.org/nexus/content/groups/public/</url>
+ <layout>default</layout>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <
url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshots Repository</name>
+ <layout>default</layout>
+ <
url>http://snapshots.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+ </repositories>
+
</project>
Modified: sandbox/cdi_support/pc/branches/cdi/portal/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/portal/pom.xml 2010-08-20 12:45:16 UTC (rev 3879)
+++ sandbox/cdi_support/pc/branches/cdi/portal/pom.xml 2010-08-20 14:16:33 UTC (rev 3880)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.2-GA-SNAPSHOT</version>
+ <version>2.2.0-Beta02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-portal</artifactId>
Modified: sandbox/cdi_support/pc/branches/cdi/portlet/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/portlet/pom.xml 2010-08-20 12:45:16 UTC (rev
3879)
+++ sandbox/cdi_support/pc/branches/cdi/portlet/pom.xml 2010-08-20 14:16:33 UTC (rev
3880)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.2-GA-SNAPSHOT</version>
+ <version>2.2.0-Beta02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-portlet</artifactId>
Modified:
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/PortletInvokerInterceptor.java
===================================================================
---
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/PortletInvokerInterceptor.java 2010-08-20
12:45:16 UTC (rev 3879)
+++
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/PortletInvokerInterceptor.java 2010-08-20
14:16:33 UTC (rev 3880)
@@ -32,7 +32,9 @@
import org.gatein.pc.api.PortletInvokerException;
import org.gatein.pc.api.PortletInvoker;
import org.gatein.pc.api.PortletStateType;
+import org.gatein.pc.portlet.state.StateConversionException;
+import java.io.Serializable;
import java.util.Set;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
@@ -131,4 +133,16 @@
//
return next;
}
+
+ public PortletContext exportPortlet(PortletStateType stateType, PortletContext
originalPortletContext)
+ throws PortletInvokerException, IllegalArgumentException
+ {
+ return safeGetNext().exportPortlet(stateType, originalPortletContext);
+ }
+
+ public PortletContext importPortlet(PortletStateType stateType, PortletContext
originalPortletContext)
+ throws PortletInvokerException, IllegalArgumentException
+ {
+ return safeGetNext().importPortlet(stateType, originalPortletContext);
+ }
}
Modified:
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/ResourceResponseImpl.java
===================================================================
---
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/ResourceResponseImpl.java 2010-08-20
12:45:16 UTC (rev 3879)
+++
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/ResourceResponseImpl.java 2010-08-20
14:16:33 UTC (rev 3880)
@@ -1,39 +1,39 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, 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. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.pc.portlet.impl.jsr168.api;
import org.gatein.common.net.media.ContentType;
import org.gatein.common.net.media.MediaType;
import org.gatein.common.net.media.Parameter;
+import org.gatein.pc.api.cache.CacheControl;
+import org.gatein.pc.api.cache.CacheLevel;
import org.gatein.pc.api.invocation.ResourceInvocation;
import org.gatein.pc.api.invocation.response.ContentResponse;
import org.gatein.pc.api.invocation.response.ResponseProperties;
-import org.gatein.pc.api.cache.CacheLevel;
-import org.gatein.pc.api.cache.CacheControl;
+import javax.portlet.PortletURL;
import javax.portlet.ResourceResponse;
-import javax.portlet.PortletURL;
-
+import javax.portlet.ResourceURL;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
@@ -54,24 +54,29 @@
super(invocation, preq);
//
- this.cacheability = invocation.getCacheLevel();
+ CacheLevel cacheLevel = invocation.getCacheLevel();
+ if (cacheLevel == null)
+ {
+ cacheLevel = CacheLevel.PAGE;
+ }
+ this.cacheability = cacheLevel;
}
public void setLocale(Locale locale)
{
// TODO: setLocale should also set the character encoding according to the mapping
done in web.xml
-
+
if (locale == null)
{
throw new IllegalArgumentException("Locale cannot be null");
}
- if ("".equals(locale.getCountry()))
+ if (locale.getCountry().length() == 0)
{
- addProperty("Content-Language", locale.getLanguage());
+ addProperty("Content-Language", locale.getLanguage());
}
else
{
- addProperty("Content-Language", locale.getLanguage() + "-"
+ locale.getCountry());
+ addProperty("Content-Language", locale.getLanguage() + "-" +
locale.getCountry());
}
}
@@ -79,7 +84,7 @@
{
List<Parameter> parameters = new ArrayList<Parameter>();
MediaType mediaType = null;
-
+
String contentTypeString = getContentType();
if (contentTypeString != null)
{
@@ -99,7 +104,7 @@
mediaType = MediaType.TEXT_HTML;
}
parameters.add(new Parameter("charset", s));
-
+
setContentType(new ContentType(mediaType, parameters).getValue());
}
@@ -110,26 +115,23 @@
public PortletURL createActionURL()
{
- if (cacheability != CacheLevel.PAGE)
- {
- throw new IllegalStateException("Cannot create action URL because the
current cache level " + cacheability +
- " is not " + CacheLevel.PAGE);
- }
-
- //
+ checkCacheLevel();
return super.createActionURL();
}
public PortletURL createRenderURL()
{
+ checkCacheLevel();
+ return super.createRenderURL();
+ }
+
+ private void checkCacheLevel()
+ {
if (cacheability != CacheLevel.PAGE)
{
- throw new IllegalStateException("Cannot create render URL because the
current cache level " + cacheability +
- " is not " + CacheLevel.PAGE);
+ throw new IllegalStateException("A resource cannot create URLs if the cache
level hasn't been set to "
+ + ResourceURL.PAGE + " as mandated by JSR-286 PLT.13.7. Cache level was:
" + cacheability);
}
-
- //
- return super.createRenderURL();
}
protected ContentResponse createMarkupResponse(ResponseProperties properties,
Map<String, Object> attributeMap, String contentType, byte[] bytes, String chars,
CacheControl cacheControl)
Modified:
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/ResourceURLImpl.java
===================================================================
---
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/ResourceURLImpl.java 2010-08-20
12:45:16 UTC (rev 3879)
+++
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/ResourceURLImpl.java 2010-08-20
14:16:33 UTC (rev 3880)
@@ -1,40 +1,40 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, 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. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.pc.portlet.impl.jsr168.api;
-import org.gatein.pc.api.invocation.PortletInvocation;
-import org.gatein.pc.api.invocation.ResourceInvocation;
-import org.gatein.pc.api.cache.CacheLevel;
-import org.gatein.pc.api.StateString;
-import org.gatein.pc.api.ParametersStateString;
import org.gatein.common.util.ParameterMap;
import org.gatein.pc.api.Mode;
+import org.gatein.pc.api.ParametersStateString;
+import org.gatein.pc.api.StateString;
import org.gatein.pc.api.WindowState;
+import org.gatein.pc.api.cache.CacheLevel;
+import org.gatein.pc.api.invocation.PortletInvocation;
+import org.gatein.pc.api.invocation.ResourceInvocation;
+import javax.portlet.PortletURLGenerationListener;
import javax.portlet.ResourceURL;
-import javax.portlet.PortletURLGenerationListener;
+import java.util.HashMap;
import java.util.Map;
-import java.util.HashMap;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -142,6 +142,10 @@
url.cacheLevel = cacheLevel;
}
}
+ else
+ {
+ throw new IllegalArgumentException("Unknown cache level: " + s);
+ }
}
protected InternalContainerURL getContainerURL()
@@ -164,7 +168,7 @@
return new ResourceURLImpl(
invocation,
preq,
- new InternalResourceURL(invocation.getNavigationalState(),
invocation.getMode(),invocation.getWindowState()),
+ new InternalResourceURL(invocation.getNavigationalState(), invocation.getMode(),
invocation.getWindowState()),
true);
}
Modified:
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr286/taglib/ResourceURL286Tag.java
===================================================================
---
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr286/taglib/ResourceURL286Tag.java 2010-08-20
12:45:16 UTC (rev 3879)
+++
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr286/taglib/ResourceURL286Tag.java 2010-08-20
14:16:33 UTC (rev 3880)
@@ -1,29 +1,30 @@
/*
-* JBoss, a division of Red Hat
-* Copyright 2006, 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.
-*/
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.pc.portlet.impl.jsr286.taglib;
+import javax.portlet.BaseURL;
import javax.portlet.ResourceURL;
-import javax.portlet.BaseURL;
/**
@@ -71,7 +72,7 @@
}
else
{
- resourceURL.setCacheability("PAGE");
+ resourceURL.setCacheability(ResourceURL.PAGE);
}
}
@@ -84,6 +85,7 @@
/* (non-Javadoc)
* @see org.gatein.pc.portlet.taglib.GenerateURLTag#addTypeParameter()
*/
+
protected String getTypeValue()
{
return typeParameter;
@@ -91,7 +93,7 @@
protected BaseURL generateURL() throws Exception
{
- BaseURL newPortletURL = super.generateURL();
+ BaseURL newPortletURL = super.generateURL();
setId((ResourceURL)newPortletURL);
setCacheability((ResourceURL)newPortletURL);
Modified:
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr286/taglib/ResourceURL286TagTEI.java
===================================================================
---
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr286/taglib/ResourceURL286TagTEI.java 2010-08-20
12:45:16 UTC (rev 3879)
+++
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr286/taglib/ResourceURL286TagTEI.java 2010-08-20
14:16:33 UTC (rev 3880)
@@ -1,27 +1,29 @@
/*
-* JBoss, a division of Red Hat
-* Copyright 2006, 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.
-*/
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.pc.portlet.impl.jsr286.taglib;
+import javax.portlet.ResourceURL;
import javax.servlet.jsp.tagext.TagData;
/**
@@ -47,16 +49,11 @@
if (o != null && o != TagData.REQUEST_TIME_VALUE)
{
String s = (String)o;
- if (s.toLowerCase().equals("full") ||
- s.toLowerCase().equals("portlet") ||
- s.toLowerCase().equals("page"))
- {
- return true;
- }
- else
- {
- return false;
- }
+ // GTNPC-25: note that this change will possibly render previously accepted
values in JSPs incorrect
+ // these values were wrong and ignored in ResourceURLImpl.setCacheability so
were ineffective
+ return s.toLowerCase().equals(ResourceURL.FULL) ||
+ s.toLowerCase().equals(ResourceURL.PORTLET) ||
+ s.toLowerCase().equals(ResourceURL.PAGE);
}
else
{
Modified:
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/state/consumer/ConsumerPortletInvoker.java
===================================================================
---
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/state/consumer/ConsumerPortletInvoker.java 2010-08-20
12:45:16 UTC (rev 3879)
+++
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/state/consumer/ConsumerPortletInvoker.java 2010-08-20
14:16:33 UTC (rev 3880)
@@ -225,6 +225,36 @@
}
}
+ public PortletContext importPortlet(PortletStateType stateType,
+ PortletContext portletContext) throws PortletInvokerException,
IllegalArgumentException
+ {
+ ConsumerContext consumerContext = getConsumerContext(portletContext);
+
+ PortletContext importContext = super.importPortlet(stateType,
consumerContext.producerPortletContext);
+
+ if (importContext instanceof StatefulPortletContext)
+ {
+ StatefulPortletContext statefulimportContext =
(StatefulPortletContext)importContext;
+ ConsumerState consumerState = new
ConsumerState<Serializable>(importContext.getId(), statefulimportContext.getType(),
statefulimportContext.getState());
+ String id = persistenceManager.createState(consumerState);
+ return PortletContext.createPortletContext(CLONE_ID_PREFIX + id);
+ }
+ else
+ {
+ return importContext;
+ }
+
+ }
+
+ public PortletContext exportPortlet(PortletStateType stateType,
+ PortletContext portletContext) throws PortletInvokerException,
IllegalArgumentException
+ {
+ ConsumerContext consumerContext = getConsumerContext(portletContext);
+
+ //
+ return super.exportPortlet(stateType, consumerContext.producerPortletContext);
+ }
+
public List<DestroyCloneFailure> destroyClones(List<PortletContext>
portletContexts) throws IllegalArgumentException, PortletInvokerException,
UnsupportedOperationException
{
if (portletContexts == null)
Modified:
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/state/producer/ProducerPortletInvoker.java
===================================================================
---
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/state/producer/ProducerPortletInvoker.java 2010-08-20
12:45:16 UTC (rev 3879)
+++
sandbox/cdi_support/pc/branches/cdi/portlet/src/main/java/org/gatein/pc/portlet/state/producer/ProducerPortletInvoker.java 2010-08-20
14:16:33 UTC (rev 3880)
@@ -630,6 +630,104 @@
}
}
+ public PortletContext exportPortlet(PortletStateType stateType, PortletContext
originalPortletContext) throws PortletInvokerException, IllegalArgumentException
+ {
+ if (originalPortletContext == null)
+ {
+ throw new IllegalArgumentException("No null portlet context
accepted");
+ }
+
+ //
+ InternalContext context = getStateContext(originalPortletContext);
+ String portletId = context.getPortletId();
+
+ //
+ boolean persistLocally = stateManagementPolicy.persistLocally();
+
+ //
+ if (context.isStateful())
+ {
+ StatefulContext statefulContext = (StatefulContext)context;
+ try
+ {
+ PortletState sstate = new PortletState(portletId,
statefulContext.getProperties());
+ Serializable marshalledState = stateConverter.marshall(stateType, sstate);
+ return StatefulPortletContext.create(portletId, stateType, marshalledState);
+ }
+ catch (StateConversionException e)
+ {
+ throw new PortletInvokerException(e);
+ }
+ }
+ else
+ {
+ if (persistLocally)
+ {
+ PropertyMap newState = new SimplePropertyMap();
+ getPropertiesFromMetaData(originalPortletContext, newState);
+ try
+ {
+ PortletState sstate = new PortletState(portletId, newState);
+ Serializable marshalledState = stateConverter.marshall(stateType,
sstate);
+ return StatefulPortletContext.create(portletId, stateType,
marshalledState);
+ }
+ catch (StateConversionException e)
+ {
+ throw new PortletInvokerException(e);
+ }
+ }
+ else
+ {
+ // if we don't have a state associated with this portlet context and we
don't persistLocally then there is nothing to
+ // store here and we need to just return the value we were given.
+ //return context.getPortletContext();
+ return
getPortlet(originalPortletContext).getContext();//originalPortletContext;
+ }
+ }
+ }
+
+ public PortletContext importPortlet(PortletStateType stateType, PortletContext
contextToImport) throws PortletInvokerException
+ {
+ if (contextToImport == null)
+ {
+ throw new IllegalArgumentException("No null portlet id accepted");
+ }
+
+ try
+ {
+ if (contextToImport instanceof StatefulPortletContext)
+ {
+ StatefulPortletContext statefulPortletContext = (StatefulPortletContext)
contextToImport;
+ Boolean persistLocally = stateManagementPolicy.persistLocally();
+
+ PortletState portletState = getStateConverter().unmarshall(stateType,
statefulPortletContext.getState());
+ //
+ if (persistLocally)
+ {
+ // Create the new state
+
+ String cloneStateId =
persistenceManager.createState(statefulPortletContext.getId(),
portletState.getProperties());
+
+ // Return the clone context
+ String cloneId = PRODUCER_CLONE_ID_PREFIX + cloneStateId;
+ return PortletContext.createPortletContext(cloneId);
+ }
+ else
+ {
+ return marshall(statefulPortletContext.getType(),
statefulPortletContext.getId(), portletState.getProperties());
+ }
+ }
+ else
+ {
+ return getPortlet(contextToImport).getContext();
+ }
+ }
+ catch (StateConversionException e)
+ {
+ throw new PortletInvokerException(e);
+ }
+ }
+
private <S extends Serializable> PortletContext
marshall(PortletStateType<S> stateType, String portletId, PropertyMap props) throws
PortletInvokerException
{
try
Modified:
sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/portlet/support/PortletInvokerSupport.java
===================================================================
---
sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/portlet/support/PortletInvokerSupport.java 2010-08-20
12:45:16 UTC (rev 3879)
+++
sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/portlet/support/PortletInvokerSupport.java 2010-08-20
14:16:33 UTC (rev 3880)
@@ -212,4 +212,16 @@
{
throw new UnsupportedOperationException();
}
+
+ public PortletContext exportPortlet(PortletStateType stateType,
+ PortletContext originalPortletContext) throws PortletInvokerException,
IllegalArgumentException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public PortletContext importPortlet(PortletStateType stateType,
+ PortletContext originalPortletContext) throws PortletInvokerException,
IllegalArgumentException
+ {
+ throw new UnsupportedOperationException();
+ }
}
Modified:
sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
===================================================================
---
sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java 2010-08-20
12:45:16 UTC (rev 3879)
+++
sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java 2010-08-20
14:16:33 UTC (rev 3880)
@@ -29,8 +29,10 @@
import org.gatein.pc.api.Portlet;
import org.gatein.pc.api.PortletContext;
import org.gatein.pc.api.PortletInvokerException;
+import org.gatein.pc.api.PortletStateType;
import org.gatein.pc.api.StatefulPortletContext;
import org.gatein.pc.api.state.PropertyMap;
+import org.gatein.pc.portlet.impl.state.StateConverterV0;
import org.gatein.pc.portlet.support.info.PortletInfoSupport;
import org.gatein.pc.portlet.support.PortletSupport;
import org.gatein.pc.api.info.MetaInfo;
@@ -38,11 +40,13 @@
import org.gatein.pc.api.invocation.PortletInvocation;
import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
import org.gatein.pc.portlet.state.AbstractPropertyContext;
+import org.gatein.pc.portlet.state.StateConverter;
import org.gatein.pc.api.state.AccessMode;
import org.gatein.pc.api.state.DestroyCloneFailure;
import org.gatein.pc.api.state.PropertyChange;
import org.gatein.pc.api.state.PropertyContext;
import org.gatein.pc.portlet.state.SimplePropertyMap;
+import org.gatein.pc.portlet.state.producer.PortletState;
import static org.jboss.unit.api.Assert.*;
import org.jboss.unit.api.pojo.annotations.Test;
@@ -168,6 +172,17 @@
*
*/
protected abstract void addPreference(PortletContext popRef, String key,
List<String> defaultValue, Boolean readOnly);
+
+ /**
+ *
+ */
+ protected abstract PortletContext exportPortletContext(PortletContext contextToImport)
throws PortletInvokerException;
+
+ /**
+ *
+ */
+ protected abstract PortletContext importPortletContext(PortletContext contextToImport)
throws PortletInvokerException;
+
/**
*
@@ -958,4 +973,240 @@
}
}
}
+
+ @Test
+ public void testExportNullPortletContext() throws Exception
+ {
+ try
+ {
+ exportPortletContext(null);
+ fail("Was expecting an illegal arguement exception.");
+ }
+ catch (IllegalArgumentException e)
+ {
+ //expected
+ }
+ assertNoExistingState();
+ }
+
+ @Test
+ public void testExportsNonExisitngPOP() throws Exception
+ {
+ PortletContext popCTX = createNonExistingPOPRef();
+ try
+ {
+ exportPortletContext(popCTX);
+ fail("Was expecting a NoSuchPortletException.");
+ }
+ catch (NoSuchPortletException e)
+ {
+ //expected
+ }
+ assertNoExistingState();
+ }
+
+ @Test
+ public void testExportNonExisitngCCP() throws Exception
+ {
+ PortletContext ccpCTX = createNonExistingLocalCCPRef();
+ try
+ {
+ exportPortletContext(ccpCTX);
+ fail("Was expecting a NoSuchPortletException.");
+ }
+ catch (NoSuchPortletException e)
+ {
+ //expected
+ }
+ assertNoExistingState();
+ }
+
+ @Test
+ public void testExportInvalidPOP() throws Exception
+ {
+ PortletContext popCtx = createInvalidPOPRef();
+ try
+ {
+ exportPortletContext(popCtx);
+ fail("was expecting an InvalidPortletIdException");
+ }
+ catch (InvalidPortletIdException expected)
+ {
+ }
+ assertNoExistingState();
+ }
+
+ @Test
+ public void testExportPortlet() throws Exception
+ {
+ PropertyMap expectedProperties = new SimplePropertyMap();
+ expectedProperties.setProperty("abc", Arrays.asList("def"));
+
+ PortletInfoSupport info = new PortletInfoSupport();
+ info.getMeta().setDisplayName("MyPortlet");
+ PortletContext popCtx = createPOPRef(info);
+
+ PortletContext export0Ctx = exportPortletContext(popCtx);
+
+ //Make sure we get back the ID for the original portlet
+ assertEquals("PortletId", export0Ctx.getId());
+ //check by doing an import
+ checkWithImportPortlet(export0Ctx, popCtx, new SimplePropertyMap());
+
+
+ //add a preference to the portlet to make it store a state
+ addPreference(popCtx, "abc", Arrays.asList("def"));
+ PortletContext export1Ctx = exportPortletContext(popCtx);
+
+ //Make sure we get back the ID for the original portlet
+ assertEquals("PortletId", export1Ctx.getId());
+ //check by doing an import
+ checkWithImportPortlet(export1Ctx, popCtx, expectedProperties);
+
+ PortletContext ccp1Ctx = createClone(popCtx);
+ PortletContext export2Ctx = exportPortletContext(ccp1Ctx);
+
+ //Make sure we get back the ID for the original portlet
+ assertEquals("PortletId", export2Ctx.getId());
+ //Check by doing an import
+ checkWithImportPortlet(export2Ctx, ccp1Ctx, expectedProperties);
+
+ PortletContext ccp2Ctx = createClone(ccp1Ctx);
+ //make sure that adding a property to the already cloned ccp1Ctx doesn't
interfere with exports
+ PropertyChange[] propertyChanges = new PropertyChange[1];
+ propertyChanges[0] = PropertyChange.newUpdate("123",
Arrays.asList("456"));
+ ccp1Ctx = setProperties(ccp1Ctx, propertyChanges);
+ assertTrue(getProperties(ccp1Ctx).containsKey("123"));
+ assertFalse(getProperties(export2Ctx).containsKey("123"));
+
+ PortletContext export3Ctx = exportPortletContext(ccp2Ctx);
+
+ //Make sure we get back the ID for the original portlet
+ assertEquals("PortletId", export3Ctx.getId());
+ //Check by doing an import
+ checkWithImportPortlet(export3Ctx, ccp2Ctx, expectedProperties);
+ }
+
+ protected void checkWithImportPortlet(PortletContext exportedPortletContext,
PortletContext originalPortletContext, PropertyMap expectedProperties) throws Exception
+ {
+ PortletContext importedPortletContext =
importPortletContext(exportedPortletContext);
+
+ Portlet importedPortlet = getPortlet(importedPortletContext);
+
+ PortletContext portletContext = importedPortlet.getContext();
+
+ //make sure the expected portlet context and the one we get back from the import
are the same
+ assertEquals(originalPortletContext.getApplicationName(),
portletContext.getApplicationName());
+ assertEquals(originalPortletContext.getPortletName(),
portletContext.getPortletName());
+
+ if (originalPortletContext instanceof StatefulPortletContext)
+ {
+ StatefulPortletContext statefulExpected =
(StatefulPortletContext)originalPortletContext;
+
+ assertTrue(portletContext instanceof StatefulPortletContext);
+ StatefulPortletContext statefulPortletContext =
(StatefulPortletContext)portletContext;
+
+ //Check that the states are the same
+ StateConverter sc = new StateConverterV0();
+ PortletState state = sc.unmarshall(PortletStateType.OPAQUE,
(byte[])statefulPortletContext.getState());
+ PortletState expectedState = sc.unmarshall(PortletStateType.OPAQUE,
(byte[])statefulExpected.getState());
+
+ assertEquals(expectedState.getPortletId(), state.getPortletId());
+ assertEquals(expectedState.getProperties(), state.getProperties());
+ assertEquals(expectedState.getTerminationTime(), state.getTerminationTime());
+ assertEquals(expectedState.getClass(), state.getClass());
+ }
+
+ PropertyMap properties = getProperties(portletContext);
+ assertEquals(expectedProperties, properties);
+ assertEquals(getProperties(originalPortletContext), properties);
+
+ }
+
+ @Test
+ public void testImportNullPortletContext() throws Exception
+ {
+ try
+ {
+ importPortletContext(null);
+ fail("Was expecting an illegal arguement exception.");
+ }
+ catch (IllegalArgumentException e)
+ {
+ //expected
+ }
+ assertNoExistingState();
+ }
+
+ @Test
+ public void testImportsNonExisitngPOP() throws Exception
+ {
+ PortletContext popCTX = createNonExistingPOPRef();
+ try
+ {
+ importPortletContext(popCTX);
+ fail("Was expecting a NoSuchPortletException.");
+ }
+ catch (NoSuchPortletException e)
+ {
+ //expected
+ }
+ assertNoExistingState();
+ }
+
+ @Test
+ public void testImportNonExisitngCCP() throws Exception
+ {
+ PortletContext ccpCTX = createNonExistingLocalCCPRef();
+ try
+ {
+ importPortletContext(ccpCTX);
+ fail("Was expecting a NoSuchPortletException.");
+ }
+ catch (NoSuchPortletException e)
+ {
+ //expected
+ }
+ assertNoExistingState();
+ }
+
+ @Test
+ public void testImportInvalidPOP() throws Exception
+ {
+ PortletContext popCtx = createInvalidPOPRef();
+ try
+ {
+ importPortletContext(popCtx);
+ fail("was expecting an InvalidPortletIdException");
+ }
+ catch (InvalidPortletIdException expected)
+ {
+ }
+ assertNoExistingState();
+ }
+
+ @Test
+ public void testImport() throws Exception
+ {
+ //This will create the portlet into the container and check that it doesn't
have any properties set
+ PortletContext popCtx = createPOPRef(new PortletInfoSupport());
+ assertTrue(getProperties(popCtx).isEmpty());
+
+ //Create the state bytes manually and create the portletcontext.
+ //Tests what happens if a stateful portlet is export on one machine and imported
into another
+ StateConverter sc = new StateConverterV0();
+ PropertyMap propertyMap = new SimplePropertyMap();
+ propertyMap.setProperty("test", Arrays.asList("123"));
+ PortletState portletState = new PortletState("PortletId", propertyMap);
+ byte[] stateBytes = sc.marshall(PortletStateType.OPAQUE, portletState);
+
+ StatefulPortletContext portletContext =
StatefulPortletContext.create("PortletId", PortletStateType.OPAQUE,
stateBytes);
+
+ //import portlet
+ PortletContext importedPortletContext = importPortletContext(portletContext);
+
+ //Make sure that this new portlet has the properties we want
+ assertEquals(propertyMap, getProperties(importedPortletContext));
+ }
+
}
Modified:
sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java
===================================================================
---
sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java 2010-08-20
12:45:16 UTC (rev 3879)
+++
sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/ConsumerStatefulPortletInvokerTestCase.java 2010-08-20
14:16:33 UTC (rev 3880)
@@ -252,4 +252,14 @@
assertEquals(1, portlets.size());
return (Portlet)portlets.iterator().next();
}
+
+ protected PortletContext importPortletContext(PortletContext contextToImport) throws
PortletInvokerException
+ {
+ return consumer.importPortlet(PortletStateType.OPAQUE, contextToImport);
+ }
+
+ protected PortletContext exportPortletContext(PortletContext originalPortletContext)
throws PortletInvokerException
+ {
+ return consumer.exportPortlet(PortletStateType.OPAQUE, originalPortletContext);
+ }
}
Modified:
sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java
===================================================================
---
sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java 2010-08-20
12:45:16 UTC (rev 3879)
+++
sandbox/cdi_support/pc/branches/cdi/portlet/src/test/java/org/gatein/pc/test/portlet/state/ProducerStatefulPortletInvokerTestCase.java 2010-08-20
14:16:33 UTC (rev 3880)
@@ -237,4 +237,14 @@
assertEquals(1, portlets.size());
return (Portlet)portlets.iterator().next();
}
+
+ protected PortletContext importPortletContext(PortletContext contextToImport) throws
PortletInvokerException
+ {
+ return producer.importPortlet(PortletStateType.OPAQUE, contextToImport);
+ }
+
+ protected PortletContext exportPortletContext(PortletContext originalPortletContext)
throws PortletInvokerException
+ {
+ return producer.exportPortlet(PortletStateType.OPAQUE, originalPortletContext);
+ }
}
Modified: sandbox/cdi_support/pc/branches/cdi/samples/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/samples/pom.xml 2010-08-20 12:45:16 UTC (rev
3879)
+++ sandbox/cdi_support/pc/branches/cdi/samples/pom.xml 2010-08-20 14:16:33 UTC (rev
3880)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.2-GA-SNAPSHOT</version>
+ <version>2.2.0-Beta02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-samples</artifactId>
Modified:
sandbox/cdi_support/pc/branches/cdi/samples/src/main/java/org/gatein/pc/samples/remotecontroller/RemoteControllerPortlet.java
===================================================================
---
sandbox/cdi_support/pc/branches/cdi/samples/src/main/java/org/gatein/pc/samples/remotecontroller/RemoteControllerPortlet.java 2010-08-20
12:45:16 UTC (rev 3879)
+++
sandbox/cdi_support/pc/branches/cdi/samples/src/main/java/org/gatein/pc/samples/remotecontroller/RemoteControllerPortlet.java 2010-08-20
14:16:33 UTC (rev 3880)
@@ -1,5 +1,24 @@
/*
- * Copyright (c) 2008, Your Corporation. All Rights Reserved.
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.pc.samples.remotecontroller;
@@ -32,6 +51,8 @@
String namespace = "n_" + renderResponse.getNamespace();
printWriter.print("<p><a href='#' onclick=\"" +
namespace + "_remote=" + namespace + "_openRemote('");
ResourceURL resource = renderResponse.createResourceURL();
+ // set the cache level to PAGE since the resource creates URLs and the spec
mandates PAGE cache level in that case
+ resource.setCacheability(ResourceURL.PAGE);
printWriter.print(resource);
printWriter.print("')\">Open remote
control!</a></p>");
}
@@ -61,30 +82,39 @@
@Override
public void serveResource(ResourceRequest resourceRequest, ResourceResponse
resourceResponse) throws PortletException, IOException
{
- resourceResponse.setContentType("text/html");
- PrintWriter writer = resourceResponse.getWriter();
- String namespace = "n_" + resourceResponse.getNamespace();
- writer.print("<html><head><script
type='text/javascript'>function
openLinkInParent(url){window.open(url,'"
- + namespace + "_parent');}</script>\n<link
rel=\"stylesheet\" href='" + resourceRequest.getContextPath() +
"/css/master.css'
type=\"text/css\"/></head><body>");
- PortletURL url = resourceResponse.createRenderURL();
- url.setWindowState(WindowState.MINIMIZED);
- writer.print("<div
class=\"remote-container\"><ul><li><a href='#'
onclick=\"" + createParentURL(url) + "\"><img\n" +
- " src=\"" +
resourceRequest.getContextPath() + "/images/icon-minimize.gif\"
alt=\"\"/> minimize parent portlet</a></li>");
- url.setWindowState(WindowState.MAXIMIZED);
- writer.print("<li><a href='#' onclick=\"" +
createParentURL(url) + "\"><img\n" +
- " src=\"" +
resourceRequest.getContextPath() + "/images/icon-maximize.gif\"
alt=\"\"/> maximize parent portlet</a></li>");
- url.setWindowState(WindowState.NORMAL);
- writer.print("<li><a href='#' onclick=\"" +
createParentURL(url) + "\"><img\n" +
- " src=\"" +
resourceRequest.getContextPath() + "/images/icon-normal.gif\"
alt=\"\"/> make parent portlet
normal</a></li></ul>");
- writer.print("<br/><ul><li>");
- writer.print("Set value of <b>'zipcode'</b> public render
parameter to:</li>");
- url.setParameter(ZIPCODE, "80201");
- writer.print("<li><a href='#' onclick=\"" +
createParentURL(url) + "\">Denver, CO</a>");
- url.setParameter(ZIPCODE, "94102");
- writer.print("<li><a href='#' onclick=\"" +
createParentURL(url) + "\">San Francisco, CA</a>");
- url.setParameter(ZIPCODE, "20001");
- writer.print("<li><a href='#' onclick=\"" +
createParentURL(url) + "\">Washington, DC</a>");
- writer.print("</ul></div></body></html>");
+ String id = resourceRequest.getResourceID();
+ if (id == null)
+ {
+ resourceResponse.setContentType("text/html");
+ PrintWriter writer = resourceResponse.getWriter();
+ String namespace = "n_" + resourceResponse.getNamespace();
+ writer.print("<html><head><script
type='text/javascript'>function
openLinkInParent(url){window.open(url,'"
+ + namespace + "_parent');}</script>\n<link
rel=\"stylesheet\" href='" + resourceRequest.getContextPath() +
"/css/master.css'
type=\"text/css\"/></head><body>");
+ PortletURL url = resourceResponse.createRenderURL();
+ url.setWindowState(WindowState.MINIMIZED);
+ writer.print("<div
class=\"remote-container\"><ul><li><a href='#'
onclick=\"" + createParentURL(url) + "\"><img\n" +
+ " src=\"" +
resourceRequest.getContextPath() + "/images/icon-minimize.gif\"
alt=\"\"/> minimize parent portlet</a></li>");
+ url.setWindowState(WindowState.MAXIMIZED);
+ writer.print("<li><a href='#' onclick=\"" +
createParentURL(url) + "\"><img\n" +
+ " src=\"" +
resourceRequest.getContextPath() + "/images/icon-maximize.gif\"
alt=\"\"/> maximize parent portlet</a></li>");
+ url.setWindowState(WindowState.NORMAL);
+ writer.print("<li><a href='#' onclick=\"" +
createParentURL(url) + "\"><img\n" +
+ " src=\"" +
resourceRequest.getContextPath() + "/images/icon-normal.gif\"
alt=\"\"/> make parent portlet
normal</a></li></ul>");
+ writer.print("<br/><ul><li>");
+ url = resourceResponse.createRenderURL();
+ writer.print("Set value of <b>'zipcode'</b> public
render parameter to:</li>");
+ url.setParameter(ZIPCODE, "80201");
+ writer.print("<li><a href='#' onclick=\"" +
createParentURL(url) + "\">Denver, CO</a>");
+ url.setParameter(ZIPCODE, "94102");
+ writer.print("<li><a href='#' onclick=\"" +
createParentURL(url) + "\">San Francisco, CA</a>");
+ url.setParameter(ZIPCODE, "20001");
+ writer.print("<li><a href='#' onclick=\"" +
createParentURL(url) + "\">Washington, DC</a>");
+ writer.print("</ul></div></body></html>");
+ }
+ else
+ {
+ throw new IllegalArgumentException("Don't know how to handle resource:
" + id);
+ }
}
private String createParentURL(PortletURL url)
Modified: sandbox/cdi_support/pc/branches/cdi/test/pom.xml
===================================================================
--- sandbox/cdi_support/pc/branches/cdi/test/pom.xml 2010-08-20 12:45:16 UTC (rev 3879)
+++ sandbox/cdi_support/pc/branches/cdi/test/pom.xml 2010-08-20 14:16:33 UTC (rev 3880)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.2-GA-SNAPSHOT</version>
+ <version>2.2.0-Beta02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-test</artifactId>
Modified:
sandbox/cdi_support/pc/branches/cdi/test/src/test/java/org/gatein/pc/test/portlet/jsr286/tck/resourceserving/DowngradeCacheabilityTestCase.java
===================================================================
---
sandbox/cdi_support/pc/branches/cdi/test/src/test/java/org/gatein/pc/test/portlet/jsr286/tck/resourceserving/DowngradeCacheabilityTestCase.java 2010-08-20
12:45:16 UTC (rev 3879)
+++
sandbox/cdi_support/pc/branches/cdi/test/src/test/java/org/gatein/pc/test/portlet/jsr286/tck/resourceserving/DowngradeCacheabilityTestCase.java 2010-08-20
14:16:33 UTC (rev 3880)
@@ -1,66 +1,61 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, 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. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.pc.test.portlet.jsr286.tck.resourceserving;
+import org.gatein.pc.test.portlet.framework.UTP1;
+import org.gatein.pc.test.unit.Assertion;
import org.gatein.pc.test.unit.PortletTestCase;
import org.gatein.pc.test.unit.PortletTestContext;
-import org.gatein.pc.test.unit.Assertion;
-import org.gatein.pc.test.unit.annotations.TestCase;
import org.gatein.pc.test.unit.actions.PortletRenderTestAction;
import org.gatein.pc.test.unit.actions.PortletResourceTestAction;
-import org.gatein.pc.test.portlet.framework.UTP1;
+import org.gatein.pc.test.unit.annotations.TestCase;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.response.EndTestResponse;
import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
-import static org.jboss.unit.api.Assert.*;
-
import javax.portlet.Portlet;
+import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
-import javax.portlet.PortletException;
-import javax.portlet.ResourceURL;
import javax.portlet.ResourceRequest;
import javax.portlet.ResourceResponse;
+import javax.portlet.ResourceURL;
import java.io.IOException;
+import static org.jboss.unit.api.Assert.assertEquals;
+import static org.jboss.unit.api.Assert.fail;
+
/**
- * cxxx:
- * Only URLs with a cache level FULL are allowed in the response of the
- * serveResource call triggered via a ResourceURL with a cache level FULL. The
- * same restriction is true for all downstream URLs that result from this
- * serveResource call. Setting a cachability different from must result in an
- * IllegalStateException.
+ * cxxx: Only URLs with a cache level FULL are allowed in the response of the
serveResource call triggered via a
+ * ResourceURL with a cache level FULL. The same restriction is true for all downstream
URLs that result from this
+ * serveResource call. Setting a cachability different from must result in an
IllegalStateException.
+ * <p/>
+ * cxxxi: Attempts to create URLs that are not of type FULL or are not resource URLs in
the current or a downstream
+ * response must result in an IllegalStateException25
+ * <p/>
+ * cxxxii: Creating other URLs, e.g. resource URLs of type or action or render URLs,
must result in an
+ * IllegalStateException
*
- * cxxxi:
- * Attempts to create URLs that are not of type FULL
- * or are not resource URLs in the current or a downstream response must result in
- * an IllegalStateException25
- *
- * cxxxii:
- * Creating other URLs, e.g. resource URLs of type or
- * action or render URLs, must result in an IllegalStateException
- *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
@@ -68,7 +63,7 @@
Assertion.JSR286_130,
Assertion.JSR286_131,
Assertion.JSR286_132
- })
+})
public class DowngradeCacheabilityTestCase
{
public DowngradeCacheabilityTestCase(PortletTestCase seq)
@@ -79,6 +74,22 @@
{
ResourceURL resourceURL = response.createResourceURL();
assertEquals(ResourceURL.PAGE, resourceURL.getCacheability());
+ try
+ {
+ resourceURL.setCacheability(null);
+ fail();
+ }
+ catch (IllegalArgumentException ignore)
+ {
+ }
+ try
+ {
+ resourceURL.setCacheability("inexistent");
+ fail();
+ }
+ catch (IllegalArgumentException ignore)
+ {
+ }
resourceURL.setCacheability(ResourceURL.PORTLET);
assertEquals(ResourceURL.PORTLET, resourceURL.getCacheability());
return new InvokeGetResponse(resourceURL.toString());
Modified:
sandbox/cdi_support/pc/branches/cdi/test/src/test/java/org/gatein/pc/test/portlet/jsr286/tck/taglib/ResourceURLTestCase.java
===================================================================
---
sandbox/cdi_support/pc/branches/cdi/test/src/test/java/org/gatein/pc/test/portlet/jsr286/tck/taglib/ResourceURLTestCase.java 2010-08-20
12:45:16 UTC (rev 3879)
+++
sandbox/cdi_support/pc/branches/cdi/test/src/test/java/org/gatein/pc/test/portlet/jsr286/tck/taglib/ResourceURLTestCase.java 2010-08-20
14:16:33 UTC (rev 3880)
@@ -1,43 +1,44 @@
/*
-* JBoss, a division of Red Hat
-* Copyright 2006, 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.
-*/
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.pc.test.portlet.jsr286.tck.taglib;
-import org.gatein.pc.test.unit.annotations.TestCase;
+import org.gatein.pc.test.portlet.framework.UTP1;
+import org.gatein.pc.test.unit.Assertion;
import org.gatein.pc.test.unit.PortletTestCase;
import org.gatein.pc.test.unit.PortletTestContext;
-import org.gatein.pc.test.unit.Assertion;
+import org.gatein.pc.test.unit.actions.PortletRenderTestAction;
+import org.gatein.pc.test.unit.annotations.TestCase;
import org.gatein.pc.test.unit.base.AbstractUniversalTestPortlet;
-import org.gatein.pc.test.unit.actions.PortletRenderTestAction;
-import org.gatein.pc.test.portlet.framework.UTP1;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.response.EndTestResponse;
import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
import javax.portlet.Portlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
-import javax.portlet.PortletException;
-import javax.portlet.PortletRequestDispatcher;
import javax.portlet.ResourceURL;
import java.io.IOException;
import java.io.StringWriter;
@@ -63,7 +64,7 @@
ResourceURL pu1 = response.createResourceURL();
pu1.setSecure(true);
- pu1.setCacheability("FULL");
+ pu1.setCacheability(ResourceURL.FULL);
ResourceURL pu2 = response.createResourceURL();
@@ -74,7 +75,7 @@
ResourceURL pu3 = response.createResourceURL();
pu3.setSecure(false);
- pu3.setParameter("testParam", new String[]
{"testParamValue", "testParamValue2"});
+ pu3.setParameter("testParam", new
String[]{"testParamValue", "testParamValue2"});
pu3.setParameter("secondParam", "testParamValue");
pu3.setProperty("testProperty", "testPropValue");
pu3.setProperty("testProperty", "testPropValue2");
@@ -103,7 +104,7 @@
String url3 = response.encodeURL(sw.toString());
- expectedResults = new String[]{ url1, url2, url3};
+ expectedResults = new String[]{url1, url2, url3};
include(dispatcher, request, response);
Modified:
sandbox/cdi_support/pc/branches/cdi/test/src/test/resources/jsr286/tck/taglib-war/resourceURL.jsp
===================================================================
---
sandbox/cdi_support/pc/branches/cdi/test/src/test/resources/jsr286/tck/taglib-war/resourceURL.jsp 2010-08-20
12:45:16 UTC (rev 3879)
+++
sandbox/cdi_support/pc/branches/cdi/test/src/test/resources/jsr286/tck/taglib-war/resourceURL.jsp 2010-08-20
14:16:33 UTC (rev 3880)
@@ -1,10 +1,33 @@
<%@ page language="java" %>
<%@ taglib
uri="http://java.sun.com/portlet_2_0" prefix="portlet"
%>
+<%--
+ ~ JBoss, a division of Red Hat
+ ~ Copyright 2010, 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.
+ --%>
+
<portlet:defineObjects/>
+<%@ page import="javax.portlet.ResourceURL" %>
+<portlet:resourceURL secure="true" escapeXml="true"
cacheability="<%= ResourceURL.FULL%>"/>
-<portlet:resourceURL secure="true" escapeXml="true"
cacheability="FULL"/>
-
<test_result_separator/>
<portlet:resourceURL secure="true" escapeXml="true"
id="testId1" var="testVar"/>