Author: julien(a)jboss.com
Date: 2008-02-29 18:47:01 -0500 (Fri, 29 Feb 2008)
New Revision: 10161
Added:
modules/portlet/trunk/portal/
modules/portlet/trunk/portal/pom.xml
modules/portlet/trunk/portal/src/
modules/portlet/trunk/portal/src/assembly/
modules/portlet/trunk/portal/src/assembly/simple-portal-jboss42.xml
modules/portlet/trunk/portal/src/build.xml
modules/portlet/trunk/portal/src/main/
modules/portlet/trunk/portal/src/main/java/
modules/portlet/trunk/portal/src/main/java/org/
modules/portlet/trunk/portal/src/main/java/org/jboss/
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/InterceptorStackFactoryImpl.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/TestPortletInvoker.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/ControllerFilter.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageParameterDef.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PagePortletControllerContext.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalPrepareResponse.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalRenderResponse.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalResponse.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/WindowDef.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/WindowResult.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/AbstractURLTag.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/Constants.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/HeadersTag.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/JspWriterResponse.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PageParamTag.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PageTag.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/ParamTag.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortalBodyTagSupport.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortalSimpleTagSupport.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletMarkupTag.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletTag.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletTitleTag.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletURLTag.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleClippingPortlet.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleWeatherClippingPortlet.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/RemoteControlResourcePortlet.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/ExceptionPortlet.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/FailDuringInitPortlet.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/HeaderPortlet.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/NullFilter.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartEvent.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartPortlet.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/Catalog.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogItem.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogPortlet.java
modules/portlet/trunk/portal/src/main/resources/
modules/portlet/trunk/portal/src/main/resources/samples/
modules/portlet/trunk/portal/src/main/resources/samples/basic-war/
modules/portlet/trunk/portal/src/main/resources/samples/cart-event-portlet-war/
modules/portlet/trunk/portal/src/main/resources/samples/google-map-portlet-war/
modules/portlet/trunk/portal/src/main/resources/samples/google-weather-portlet-war/
modules/portlet/trunk/portal/src/main/resources/samples/remotecontrol-portlet-war/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/META-INF/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-web.xml
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/demo/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/images/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/index.jsp
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/js/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/layouts/
modules/portlet/trunk/portal/src/test/
modules/portlet/trunk/portal/src/test/java/
modules/portlet/trunk/portal/src/test/resources/
Removed:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/TestPortletInvocationContext.java
modules/portlet/trunk/portal/src/main/resources/samples/basic-war/
modules/portlet/trunk/portal/src/main/resources/samples/cart-event-portlet-war/
modules/portlet/trunk/portal/src/main/resources/samples/google-map-portlet-war/
modules/portlet/trunk/portal/src/main/resources/samples/google-weather-portlet-war/
modules/portlet/trunk/portal/src/main/resources/samples/remotecontrol-portlet-war/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/META-INF/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/demo/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/images/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/index.jsp
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/js/
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/layouts/
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/admin/ui/
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/portal/samples/
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/
modules/portlet/trunk/test/src/test/resources/portal/samples/
modules/portlet/trunk/test/src/test/resources/simple-portal-war/
Modified:
modules/portlet/trunk/pom.xml
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-beans.xml
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/portal.tld
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/web.xml
modules/portlet/trunk/test/pom.xml
modules/portlet/trunk/test/src/test/build.xml
Log:
new portal module package for building the simple-portal
Deleted:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/TestPortletInvocationContext.java
===================================================================
---
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/TestPortletInvocationContext.java 2008-02-29
17:41:05 UTC (rev 10160)
+++
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/TestPortletInvocationContext.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -1,101 +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.controller.impl;
-
-import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
-import org.jboss.portal.common.invocation.resolver.PrincipalAttributeResolver;
-import org.jboss.portal.common.invocation.resolver.RequestAttributeResolver;
-import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.common.io.Serialization;
-import org.jboss.portal.portlet.ContainerURL;
-import org.jboss.portal.portlet.URLFormat;
-import org.jboss.portal.portlet.controller.state.PageNavigationalState;
-import org.jboss.portal.portlet.controller.impl.PortletURLRenderer;
-import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class TestPortletInvocationContext extends AbstractPortletInvocationContext
-{
-
- /** . */
- private final PortletURLRenderer urlRenderer;
-
- /** . */
- private final String windowId;
-
- /** . */
- private final HttpServletRequest clientRequest;
-
- /** . */
- private final HttpServletResponse clientResponse;
-
- public TestPortletInvocationContext(
- Serialization<PageNavigationalState> serialization,
- HttpServletRequest clientRequest,
- HttpServletResponse clientResponse,
- String windowId,
- PageNavigationalState pageNavigationalState,
- MarkupInfo markupInfo)
- {
- super(markupInfo);
-
- //
- this.clientRequest = clientRequest;
- this.clientResponse = clientResponse;
- this.windowId = windowId;
- this.urlRenderer = new PortletURLRenderer(pageNavigationalState, clientRequest,
clientResponse, serialization);
-
- //
- addResolver(PortletInvocation.PRINCIPAL_SCOPE, new
PrincipalAttributeResolver(clientRequest));
- addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
- addResolver(PortletInvocation.REQUEST_SCOPE, new
RequestAttributeResolver(clientRequest));
- }
-
- public String getWindowId()
- {
- return windowId;
- }
-
- public HttpServletRequest getClientRequest() throws IllegalStateException
- {
- return clientRequest;
- }
-
- public HttpServletResponse getClientResponse() throws IllegalStateException
- {
- return clientResponse;
- }
-
- public String renderURL(ContainerURL containerURL, URLFormat format)
- {
- return urlRenderer.renderURL(windowId, containerURL, format);
- }
-}
Modified: modules/portlet/trunk/pom.xml
===================================================================
--- modules/portlet/trunk/pom.xml 2008-02-29 17:41:05 UTC (rev 10160)
+++ modules/portlet/trunk/pom.xml 2008-02-29 23:47:01 UTC (rev 10161)
@@ -44,6 +44,7 @@
<module>management</module>
<module>mc</module>
<module>test</module>
+ <module>portal</module>
</modules>
</project>
Added: modules/portlet/trunk/portal/pom.xml
===================================================================
--- modules/portlet/trunk/portal/pom.xml (rev 0)
+++ modules/portlet/trunk/portal/pom.xml 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,403 @@
+<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">
+ <parent>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>module-parent</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <relativePath>../build/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>portlet-portal</artifactId>
+ <packaging>jar</packaging>
+ <name>Portlet Container Simple Portal</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-portlet</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-controller</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-portlet</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-mc</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>concurrent</groupId>
+ <artifactId>concurrent</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.common</groupId>
+ <artifactId>common-mc</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-remote</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-mc</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-tooling-ant</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>portal-test</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>portal-test-generic</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossxb</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-logging-jdk</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-remoting</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-aop-mc-int</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-classloader</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-container</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-dependency</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-client-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-core-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-structure-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-vfs-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-managed</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-metatype</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>cargo</groupId>
+ <artifactId>cargo-manager</artifactId>
+ <type>war</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.web</groupId>
+ <artifactId>web-web</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>javax.ccpp</groupId>
+ <artifactId>ccpp</artifactId>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-jsr168api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ -->
+ <dependency>
+ <groupId>javax.portlet</groupId>
+ <artifactId>portlet-api</artifactId>
+ </dependency>
+
+ <!-- JSTL for Tomcat -->
+ <dependency>
+ <groupId>apache-taglibs</groupId>
+ <artifactId>jstl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>apache-taglibs</groupId>
+ <artifactId>standard</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+
<descriptor>src/assembly/simple-portal-jboss42.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+
+<!--
+ <plugin>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-tooling-maven2</artifactId>
+ <executions>
+ <execution>
+ <phase>test</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <testsuites>
+ <testsuite>
+ <config>test/local-jboss-unit.xml</config>
+ </testsuite>
+ </testsuites>
+ <reports>
+ <xml>target/tests/reports/xml/local</xml>
+ <html>target/tests/reports/html/local</html>
+ </reports>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.jvnet.maven-antrun-extended-plugin</groupId>
+ <artifactId>maven-antrun-extended-plugin</artifactId>
+ <version>1.13</version>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-tooling-ant</artifactId>
+ <version>${version.jboss.unit}</version>
+ </dependency>
+
+ -->
+<!-- stuff to run servers for tests -->
+<!--
+ <dependency>
+ <groupId>cargo</groupId>
+ <artifactId>cargo-ant</artifactId>
+ <version>${version.cargo}</version>
+ </dependency>
+ <dependency>
+ <groupId>cargo</groupId>
+ <artifactId>cargo-core-uberjar</artifactId>
+ <version>${version.cargo}</version>
+ </dependency>
+
+ </dependencies>
+ <executions>
+ <execution>
+ <id>test</id>
+ <phase>integration-test</phase>
+ <configuration>
+ <tasks>
+
+ <property name="compile_classpath"
refid="maven.compile.classpath"/>
+ <property name="runtime_classpath"
refid="maven.runtime.classpath"/>
+ <property name="test_classpath"
refid="maven.test.classpath"/>
+ <property name="plugin_classpath"
refid="maven.plugin.classpath"/>
+
+ <property name="project.version"
value="${project.version}"/>
+
+ <property name="dependency.concurrent.jar"
+
value="${maven.dependency.concurrent.concurrent.jar.path}"/>
+ <property name="dependency.trove.jar"
value="${maven.dependency.trove.trove.jar.path}"/>
+ <property name="dependency.jboss-logging-spi.jar"
+
value="${maven.dependency.jboss.jboss-logging-spi.jar.path}"/>
+ <property name="dependency.jboss-logging-jdk.jar"
+
value="${maven.dependency.jboss.jboss-logging-jdk.jar.path}"/>
+ <property name="dependency.jboss-logging-log4j.jar"
+
value="${maven.dependency.jboss.jboss-logging-log4j.jar.path}"/>
+ <property name="dependency.jboss-vfs.jar"
+
value="${maven.dependency.org.jboss.jboss-vfs.jar.path}"/>
+ <property name="dependency.jboss-aop-mc-int.jar"
+
value="${maven.dependency.org.jboss.microcontainer.jboss-aop-mc-int.jar.path}"/>
+ <property name="dependency.jboss-classloader.jar"
+
value="${maven.dependency.org.jboss.microcontainer.jboss-classloader.jar.path}"/>
+ <property name="dependency.jboss-container.jar"
+
value="${maven.dependency.org.jboss.microcontainer.jboss-container.jar.path}"/>
+ <property name="dependency.jboss-dependency.jar"
+
value="${maven.dependency.org.jboss.microcontainer.jboss-dependency.jar.path}"/>
+ <property
name="dependency.jboss-deployers-client-spi.jar"
+
value="${maven.dependency.org.jboss.microcontainer.jboss-deployers-client-spi.jar.path}"/>
+ <property
name="dependency.jboss-deployers-client.jar"
+
value="${maven.dependency.org.jboss.microcontainer.jboss-deployers-client.jar.path}"/>
+ <property
name="dependency.jboss-deployers-core-spi.jar"
+
value="${maven.dependency.org.jboss.microcontainer.jboss-deployers-core-spi.jar.path}"/>
+ <property
name="dependency.jboss-deployers-core.jar"
+
value="${maven.dependency.org.jboss.microcontainer.jboss-deployers-core.jar.path}"/>
+ <property
name="dependency.jboss-deployers-impl.jar"
+
value="${maven.dependency.org.jboss.microcontainer.jboss-deployers-impl.jar.path}"/>
+ <property name="dependency.jboss-deployers-spi.jar"
+
value="${maven.dependency.org.jboss.microcontainer.jboss-deployers-spi.jar.path}"/>
+ <property
name="dependency.jboss-deployers-structure-spi.jar"
+
value="${maven.dependency.org.jboss.microcontainer.jboss-deployers-structure-spi.jar.path}"/>
+ <property
name="dependency.jboss-deployers-vfs-spi.jar"
+
value="${maven.dependency.org.jboss.microcontainer.jboss-deployers-vfs-spi.jar.path}"/>
+ <property name="dependency.jboss-deployers-vfs.jar"
+
value="${maven.dependency.org.jboss.microcontainer.jboss-deployers-vfs.jar.path}"/>
+ <property name="dependency.jboss-kernel.jar"
+
value="${maven.dependency.org.jboss.microcontainer.jboss-kernel.jar.path}"/>
+ <property name="dependency.jboss-managed.jar"
+
value="${maven.dependency.org.jboss.microcontainer.jboss-managed.jar.path}"/>
+ <property name="dependency.jboss-metatype.jar"
+
value="${maven.dependency.org.jboss.microcontainer.jboss.metatype.jar.path}"/>
+ <property name="dependency.jboss-aop.jar"
+
value="${maven.dependency.org.jboss.aop.jboss-aop.jar.path}"/>
+ <property
name="dependency.pluggable-instrumentor.jar"
+
value="${maven.dependency.jboss.aop.pluggable-instrumentor.jar.path}"/>
+ <property name="dependency.javassist.jar"
+
value="${maven.dependency.org.jboss.javassist.jar.path}"/>
+ <property name="dependency.jboss-common-core.jar"
+
value="${maven.dependency.org.jboss.jboss-common-core.jar.path}"/>
+ <property name="dependency.resolver.jar"
+
value="${maven.dependency.apache-xerces.resolver.jar.path}"/>
+ <property name="dependency.xercesImpl.jar"
+
value="${maven.dependency.apache-xerces.xercesImpl.jar.path}"/>
+ <property name="dependency.xml-apis.jar"
+
value="${maven.dependency.apache-xerces.xml-apis.jar.path}"/>
+ <property name="dependency.jbossxb.jar"
value="${maven.dependency.org.jboss.jbossxb.jar.path}"/>
+ <property name="dependency.jboss-remoting.jar"
+
value="${maven.dependency.jboss.jboss-remoting.jar.path}"/>
+ <property name="dependency.portal-common.jar"
+
value="${maven.dependency.org.jboss.portal.common.common-common.jar.path}"/>
+ <property
name="dependency.portal-common-portal.jar"
+
value="${maven.dependency.org.jboss.portal.common.common-portal.jar.path}"/>
+ <property name="dependency.portal-common-mc.jar"
+
value="${maven.dependency.org.jboss.portal.common.common-mc.jar.path}"/>
+ <property name="dependency.jboss-unit.jar"
+
value="${maven.dependency.org.jboss.unit.jboss-unit.jar.path}"/>
+ <property name="dependency.jboss-unit-mc.jar"
+
value="${maven.dependency.org.jboss.unit.jboss-unit-mc.jar.path}"/>
+ <property name="dependency.jboss-unit-remote.jar"
+
value="${maven.dependency.org.jboss.unit.jboss-unit-remote.jar.path}"/>
+ <property name="dependency.portal-test.jar"
+
value="${maven.dependency.org.jboss.unit.portal-test.jar.path}"/>
+ <property name="dependency.portal-test-generic.jar"
+
value="${maven.dependency.org.jboss.unit.portal-test-generic.jar.path}"/>
+ <property name="dependency.log4j.jar"
value="${maven.dependency.log4j.log4j.jar.path}"/>
+ <property name="dependency.commons-logging.jar"
+
value="${maven.dependency.commons-logging.commons-logging.jar.path}"/>
+ <property name="dependency.commons-httpclient.jar"
+
value="${maven.dependency.commons-httpclient.commons-httpclient.jar.path}"/>
+ <property name="dependency.activation.jar"
+
value="${maven.dependency.javax.activation.activation.jar.path}"/>
+ <property name="dependency.junit.jar"
value="${maven.dependency.junit.junit.jar.path}"/>
+ <property name="dependency.cargo-manager.war"
+
value="${maven.dependency.cargo.cargo-manager.war.path}"/>
+ <property name="dependency.portal-web.jar"
value="${maven.dependency.org.jboss.portal.web.web-web.jar.path}"/>
+ -->
+<!--<property name="dependency.jsr168api.jar"
value="${maven.dependency.org.jboss.portal.portlet.portlet-jsr168api.jar.path}"/>-->
+<!--
+ <property name="dependency.jsr168api.jar"
value="${maven.dependency.javax.portlet.portlet-api.jar.path}"/>
+ <property name="dependency.ccpp.jar"
value="${maven.dependency.javax.ccpp.ccpp.jar.path}"/>
+
+ <property name="dependency.portal-portlet.jar"
value="${maven.dependency.org.jboss.portal.portlet.portlet-portlet.jar.path}"/>
+ <property
name="dependency.portal-portlet-controller.jar"
value="${maven.dependency.org.jboss.portal.portlet.portlet-controller.jar.path}"/>
+ <property name="dependency.portal-portlet-mc.jar"
value="${maven.dependency.org.jboss.portal.portlet.portlet-mc.jar.path}"/>
+ <property
name="dependency.portal-portlet-tests.test-jar"
value="${maven.dependency.org.jboss.portal.portlet.portlet-portlet.tests.test-jar.path}"/>
+
+ <property name="dependency.cargo-core-uberjar.jar"
value="${maven.dependency.cargo.cargo-core-uberjar.jar.path}"/>
+ <property name="dependency.cargo-ant.jar"
value="${maven.dependency.cargo.cargo-ant.jar.path}"/>
+ <property name="dependency.jaxb-api.jar"
+
value="${maven.dependency.javax.xml.bind.jaxb-api.jar.path}"/>
+
+ -->
+<!-- JSTL for Tomcat -->
+<!--
+ <property name="dependency.apache-jstl.jar"
+
value="${maven.dependency.apache-taglibs.jstl.jar.path}"/>
+ <property name="dependency.apache-standard.jar"
+
value="${maven.dependency.apache-taglibs.standard.jar.path}"/>
+
+ <ant antfile="${basedir}/src/test/build.xml">
+ <target name="tests"/>
+ <target name="package-simple-portal"/>
+ <target name="package-tck-portal"/>
+ </ant>
+
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+-->
+ </plugins>
+
+ </build>
+
+</project>
\ No newline at end of file
Added: modules/portlet/trunk/portal/src/assembly/simple-portal-jboss42.xml
===================================================================
--- modules/portlet/trunk/portal/src/assembly/simple-portal-jboss42.xml
(rev 0)
+++ modules/portlet/trunk/portal/src/assembly/simple-portal-jboss42.xml 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,68 @@
+<assembly>
+ <id>simple-portal-jboss42</id>
+ <formats>
+ <format>dir</format>
+ </formats>
+ <baseDirectory>simple-portal</baseDirectory>
+
+ <dependencySets>
+
+ <dependencySet>
+ <includes>
+ <include>org.jboss.portal.common:common-common</include>
+ <include>org.jboss.portal.common:common-portal</include>
+ <include>org.jboss.portal.web:web-web</include>
+ <include>org.jboss.portal.portlet:portlet-portlet</include>
+ <include>javax.portlet:portlet-api</include>
+ <include>javax.ccpp:ccpp</include>
+ <include>javax.xml.bind:jaxb-api</include>
+ </includes>
+ </dependencySet>
+
+ <dependencySet>
+ <outputDirectory>simple-portal.war/WEB-INF/lib</outputDirectory>
+ <includes>
+ <include>org.jboss.portal.common:common-mc</include>
+ <include>org.jboss.portal.portlet:portlet-controller</include>
+ <include>org.jboss.portal.portlet:portlet-mc</include>
+ <include>trove:trove</include>
+ <include>org.jboss:jboss-common-core</include>
+ <include>org.jboss:jboss-vfs</include>
+ <include>org.jboss:javassist</include>
+ <include>org.jboss:jbossxb</include>
+ <include>org.jboss.aop:jboss-aop</include>
+ <include>org.jboss.microcontainer:jboss-aop-mc-int</include>
+ <include>org.jboss.microcontainer:jboss-classloader</include>
+ <include>org.jboss.microcontainer:jboss-dependency</include>
+ <include>org.jboss.microcontainer:jboss-container</include>
+
<include>org.jboss.microcontainer:jboss-deployers-client-spi</include>
+
<include>org.jboss.microcontainer:jboss-deployers-client</include>
+
<include>org.jboss.microcontainer:jboss-deployers-core-spi</include>
+ <include>org.jboss.microcontainer:jboss-deployers-core</include>
+ <include>org.jboss.microcontainer:jboss-deployers-impl</include>
+ <include>org.jboss.microcontainer:jboss-deployers-spi</include>
+
<include>org.jboss.microcontainer:jboss-deployers-structure-spi</include>
+
<include>org.jboss.microcontainer:jboss-deployers-vfs-spi</include>
+ <include>org.jboss.microcontainer:jboss-deployers-vfs</include>
+ <include>org.jboss.microcontainer:jboss-kernel</include>
+ <include>org.jboss.microcontainer:jboss-managed</include>
+ </includes>
+ </dependencySet>
+
+ </dependencySets>
+
+ <fileSets>
+
+ <fileSet>
+ <directory>src/main/resources/simple-portal-war</directory>
+ <outputDirectory>simple-portal.war</outputDirectory>
+ </fileSet>
+
+ <fileSet>
+ <directory>target/classes</directory>
+
<outputDirectory>simple-portal.war/WEB-INF/classes</outputDirectory>
+ </fileSet>
+
+ </fileSets>
+
+</assembly>
Added: modules/portlet/trunk/portal/src/build.xml
===================================================================
--- modules/portlet/trunk/portal/src/build.xml (rev 0)
+++ modules/portlet/trunk/portal/src/build.xml 2008-02-29 23:47:01 UTC (rev 10161)
@@ -0,0 +1,1014 @@
+<?xml version="1.0"?>
+<project name="portlet-integration-test">
+
+ <target name="tests" unless="maven.test.skip">
+ <antcall target="__tests"/>
+ </target>
+
+ <target name="__tests" depends="prepare_env,
evaluate_properties" >
+
+ <echo message="compile classpath: ${compile_classpath}"/>
+ <echo message="runtime classpath: ${runtime_classpath}"/>
+ <echo message="test classpath: ${test_classpath}"/>
+ <echo message="plugin classpath: ${plugin_classpath}"/>
+
+ <echo message="You can run small subset of tests using -Dtests=local,
-Dtests=jboss or -D=tests=tomcat"/>
+
+ <antcall target="package-tests"/>
+
+ <antcall target="tests.call.single"/>
+ <antcall target="tests.call.all"/>
+
+ </target>
+
+ <target name="tests.call.all" unless="tests">
+ <antcall target="tests.jboss"/>
+ <antcall target="tests.tomcat"/>
+ </target>
+
+ <target name="tests.call.single" if="tests">
+ <antcall target="tests.${tests}"/>
+ </target>
+
+ <target name="prepare_env">
+
+ <!--Relative path to target dir-->
+ <property name="target" value="${basedir}/target"/>
+ <property name="test.temp.dir"
value="${target}/test/tmp"/>
+ <property name="test.temp.portlet"
value="${test.temp.dir}/portlet-test"/>
+ <property name="test.temp.lib"
value="${test.temp.dir}/lib"/>
+
+ <mkdir dir="${test.temp.dir}"/>
+ <mkdir dir="${test.temp.lib}"/>
+ <mkdir dir="${test.temp.portlet}"/>
+ <mkdir dir="${target}/jboss-unit"/>
+
+ <echo message="Preparing environment"/>
+
+ <!--Paths-->
+ <path id="mc.concurrent">
+ <pathelement path="${dependency.concurrent.jar}"/>
+ </path>
+ <path id="mc.trove">
+ <pathelement path="${dependency.trove.jar}"/>
+ </path>
+ <path id="mc.xerces">
+ <pathelement path="${dependency.xercesImpl.jar}"/>
+ <pathelement path="${dependency.resolver.jar}"/>
+ <pathelement path="${dependency.xml-apis.jar}"/>
+ </path>
+ <path id="mc.javassist">
+ <pathelement path="${dependency.javassist.jar}"/>
+ </path>
+ <path id="mc.jboss_common_logging_spi">
+ <pathelement path="${dependency.jboss-logging-spi.jar}"/>
+ </path>
+ <path id="mc.jboss_common_logging_jdk">
+ <pathelement path="${dependency.jboss-logging-jdk.jar}"/>
+ </path>
+ <path id="mc.jboss_common_logging_log4j">
+ <pathelement path="${dependency.jboss-logging-log4j.jar}"/>
+ </path>
+ <path id="mc.jboss_common_core">
+ <pathelement path="${dependency.jboss-common-core.jar}"/>
+ </path>
+ <path id="mc.jboss_vfs">
+ <pathelement path="${dependency.jboss-vfs.jar}"/>
+ </path>
+ <path id="mc.jboss_xb">
+ <pathelement path="${dependency.jbossxb.jar}"/>
+ </path>
+ <path id="mc.jboss_aop">
+ <!--<pathelement
path="${dependency.jboss-aop-as4-deployer.jar}"/>-->
+ <!--<pathelement
path="${dependency.jboss-aop-deployer-jdk50.jar}"/>-->
+ <!--<pathelement
path="${dependency.jboss-aop-jdk50.jar}"/>-->
+ <!--<pathelement
path="${dependency.jboss-aop-jdk50-client.jar}"/>-->
+ <!--<pathelement
path="${dependency.jboss-standalone-aspect-library-jdk50.jar}"/>-->
+ <!--<pathelement
path="${dependency.jrockit-pluggable-instrumentor.jar}"/>-->
+ <!--<pathelement
path="${dependency.pluggable-instrumentor.jar}"/>-->
+ <pathelement path="${dependency.jboss-aop.jar}"/>
+
+ </path>
+ <path id="mc.jboss_microcontainer">
+ <pathelement path="${dependency.jboss-aop-mc-int.jar}"/>
+ <pathelement path="${dependency.jboss-classloader.jar}"/>
+ <pathelement path="${dependency.jboss-container.jar}"/>
+ <pathelement path="${dependency.jboss-dependency.jar}"/>
+ <pathelement
path="${dependency.jboss-container-metadata.jar}"/>
+ <pathelement
path="${dependency.jboss-container-metadata-spi.jar}"/>
+ <pathelement path="${dependency.jboss-deployers-core.jar}"/>
+ <pathelement
path="${dependency.jboss-deployers-core-spi.jar}"/>
+ <pathelement path="${dependency.jboss-deployers-client.jar}"/>
+ <pathelement
path="${dependency.jboss-deployers-client-spi.jar}"/>
+ <pathelement path="${dependency.jboss-deployers-impl.jar}"/>
+ <pathelement path="${dependency.jboss-deployers-spi.jar}"/>
+ <pathelement
path="${dependency.jboss-deployers-structure-spi.jar}"/>
+ <pathelement path="${dependency.jboss-deployers-vfs.jar}"/>
+ <pathelement path="${dependency.jboss-deployers-vfs-spi.jar}"/>
+ <pathelement path="${dependency.jboss-managed.jar}"/>
+ <pathelement path="${dependency.jboss.metatype.jar}"/>
+ <pathelement path="${dependency.jboss-kernel.jar}"/>
+ </path>
+ <path id="mc.portal-common">
+ <pathelement path="${dependency.portal-common-mc.jar}"/>
+ </path>
+ <path id="mc.jboss-unit">
+ <pathelement path="${dependency.jboss-unit.jar}"/>
+ <pathelement path="${dependency.jboss-unit-mc.jar}"/>
+ <pathelement path="${dependency.jboss-unit-remote.jar}"/>
+ <pathelement path="${dependency.portal-test-generic.jar}"/>
+ <pathelement path="${dependency.portal-test.jar}"/>
+ </path>
+ <path id="mc.portal-test-generic">
+ <pathelement path="${dependency.portal-test-generic.jar}"/>
+ </path>
+ <path id="mc.jboss-remoting">
+ <pathelement path="${dependency.jboss-remoting.jar}"/>
+ </path>
+ <path id="mc.log4j">
+ <pathelement path="${dependency.log4j.jar}"/>
+ </path>
+ <path id="mc.portal-portlet">
+ <pathelement path="${dependency.portal-portlet.jar}"/>
+ </path>
+ <path id="mc.portal-portlet-controller">
+ <pathelement
path="${dependency.portal-portlet-controller.jar}"/>
+ </path>
+ <path id="mc.portal-portlet-mc">
+ <pathelement path="${dependency.portal-portlet-mc.jar}"/>
+ </path>
+ <path id="mc.jaxb-api">
+ <pathelement path="${dependency.jaxb-api.jar}"/>
+ </path>
+ </target>
+
+ <!--Lets make the check in one place so the build fail in the beggining instead of
end-->
+ <target name="evaluate_properties">
+
+ <property environment="env"/>
+
+ <!--If properties are not in command line check if they are set in env-->
+ <condition property="JBOSS_4_2_1_HOME"
value="${env.JBOSS_4_2_1_HOME}">
+ <and>
+ <isset property="env.JBOSS_4_2_1_HOME"/>
+ <not>
+ <isset property="JBOSS_4_2_1_HOME"/>
+ </not>
+ </and>
+ </condition>
+ <condition property="JBOSS_4_2_2_HOME"
value="${env.JBOSS_4_2_2_HOME}">
+ <and>
+ <isset property="env.JBOSS_4_2_2_HOME"/>
+ <not>
+ <isset property="JBOSS_4_2_2_HOME"/>
+ </not>
+ </and>
+ </condition>
+ <condition property="JBOSS_4_2_0_HOME"
value="${env.JBOSS_4_2_0_HOME}">
+ <and>
+ <isset property="env.JBOSS_4_2_0_HOME"/>
+ <not>
+ <isset property="JBOSS_4_2_0_HOME"/>
+ </not>
+ </and>
+ </condition>
+ <condition property="TOMCAT_6_0_HOME"
value="${env.TOMCAT_6_0_HOME}">
+ <and>
+ <isset property="env.TOMCAT_6_0_HOME"/>
+ <not>
+ <isset property="TOMCAT_6_0_HOME"/>
+ </not>
+ </and>
+ </condition>
+
+ <fail message="Please set the environment variable JBOSS_4_2_0_HOME,
JBOSS_4_2_1_HOME or JBOSS_4_2_2_HOME">
+ <condition>
+ <and>
+ <not>
+ <isset property="JBOSS_4_2_0_HOME"/>
+ </not>
+ <not>
+ <isset property="JBOSS_4_2_1_HOME"/>
+ </not>
+ <not>
+ <isset property="JBOSS_4_2_2_HOME"/>
+ </not>
+ </and>
+ </condition>
+ </fail>
+
+ <fail message="Please set the environment variable
TOMCAT_6_0_HOME">
+ <condition>
+ <and>
+ <not>
+ <isset property="TOMCAT_6_0_HOME"/>
+ </not>
+ </and>
+ </condition>
+ </fail>
+
+ </target>
+
+ <macrodef name="package-misc-test">
+ <attribute name="test"/>
+ <sequential>
+ <package-testsuite testsuiteversion="jsr168"
testsuitetype="misc" testsuitename="@{test}"/>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="package-ext-test">
+ <attribute name="test"/>
+ <sequential>
+ <package-testsuite testsuiteversion="jsr168"
testsuitetype="ext" testsuitename="@{test}"/>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="package-tck-test">
+ <attribute name="test"/>
+ <sequential>
+ <package-testsuite testsuiteversion="jsr168"
testsuitetype="tck" testsuitename="@{test}"/>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="package-api-test">
+ <attribute name="test"/>
+ <sequential>
+ <package-testsuite testsuiteversion="jsr168"
testsuitetype="api" testsuitename="@{test}"/>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="package-jsr286-tck-test">
+ <attribute name="test"/>
+ <sequential>
+ <package-testsuite testsuiteversion="jsr286"
testsuitetype="tck" testsuitename="@{test}"/>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="package-jsr286-api-test">
+ <attribute name="test"/>
+ <sequential>
+ <package-testsuite testsuiteversion="jsr286"
testsuitetype="api" testsuitename="@{test}"/>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="package-jsr286-ext-test">
+ <attribute name="test"/>
+ <sequential>
+ <package-testsuite testsuiteversion="jsr286"
testsuitetype="ext" testsuitename="@{test}"/>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="package-testsuite">
+ <attribute name="testsuiteversion"/>
+ <attribute name="testsuitetype"/>
+ <attribute name="testsuitename"/>
+ <sequential>
+ <mkdir
dir="${test.temp.dir}/@{testsuiteversion}/@{testsuitetype}/@{testsuitename}-war/WEB-INF/classes"/>
+ <copy
todir="${test.temp.dir}/@{testsuiteversion}/@{testsuitetype}/@{testsuitename}-war/WEB-INF/classes">
+ <fileset
+ dir="${test.temp.portlet}"
+
includes="org/jboss/portal/test/portlet/@{testsuiteversion}/@{testsuitetype}/common/**"/>
+ <fileset
+ dir="${test.temp.portlet}"
+
includes="org/jboss/portal/test/portlet/@{testsuiteversion}/common/**"/>
+ <fileset
+ dir="${test.temp.portlet}"
+ includes="org/jboss/portal/test/portlet/common/**"/>
+ <fileset
+ dir="${test.temp.portlet}"
+
includes="org/jboss/portal/test/portlet/@{testsuiteversion}/@{testsuitetype}/@{testsuitename}/**"/>
+ <fileset
+ dir="${test.temp.portlet}"
+ includes="org/jboss/portal/test/portlet/framework/**"/>
+ </copy>
+ <copy
todir="${test.temp.dir}/@{testsuiteversion}/@{testsuitetype}/@{testsuitename}-war/WEB-INF/lib">
+ <fileset
+ dir="${test.temp.lib}"
+ includes="portal-portlet-test-framework-lib.jar"/>
+ </copy>
+ <copy
todir="${test.temp.dir}/@{testsuiteversion}/@{testsuitetype}/@{testsuitename}-war">
+ <fileset
+
dir="${target}/test-classes/@{testsuiteversion}/@{testsuitetype}/@{testsuitename}-war"/>
+ </copy>
+ <jar
jarfile="${test.temp.lib}/test-@{testsuiteversion}-@{testsuitetype}-(a){testsuitename}.war">
+ <fileset
dir="${test.temp.dir}/@{testsuiteversion}/@{testsuitetype}/@{testsuitename}-war"/>
+ </jar>
+ </sequential>
+ </macrodef>
+
+ <target name="package-tests">
+
+ <unjar src="${dependency.portal-portlet-tests.test-jar}"
dest="${test.temp.portlet}"/>
+
+ <!--Portlet test framework lib jar-->
+ <jar
jarfile="${test.temp.lib}/portal-portlet-test-framework-lib.jar">
+
+ <!-- -->
+ <fileset dir="${test.temp.portlet}"
includes="org/jboss/portal/unit/**"/>
+
+ <!-- JSR 168 TLD -->
+ <zipfileset
+ src="${dependency.portal-portlet.jar}"
+ includes="META-INF/portlet.tld"
+ fullpath="META-INF/portlet.tld"/>
+ <zipfileset
+ src="${dependency.portal-portlet.jar}"
+ includes="META-INF/portlet_2_0.tld"
+ fullpath="META-INF/portlet_2_0.tld"/>
+ </jar>
+
+ <!--<jar jarfile="${test.temp.lib}/test-info.jar">-->
+ <!--<fileset dir="${test.temp.portlet}"
includes="org/jboss/portal/test/portlet/info/**"/>-->
+ <!--</jar>-->
+ <!--<jar jarfile="${test.temp.lib}/test-info.war">-->
+ <!--<fileset
dir="${target}/test-classes/info/test-info-war"/>-->
+ <!--</jar>-->
+
+
+ <!--<jar jarfile="${test.temp.lib}/test-ha-session.war">-->
+ <!--<fileset
dir="${target}/test-classes/ha/test-session-war"/>-->
+ <!--<fileset dir="${target}/test-classes"
includes="org/jboss/portal/test/portlet/ha/session/**"/>-->
+ <!--<fileset dir="${target}/test-classes"
includes="org/jboss/portal/test/portlet/framework/**"/>-->
+ <!--</jar>-->
+
+ <package-tck-test test="portletinterface"/>
+ <package-tck-test test="dispatcher"/>
+ <package-tck-test test="portletrequests"/>
+ <package-tck-test test="portletmode"/>
+ <package-tck-test test="portletconfig"/>
+ <package-tck-test test="portletresponses"/>
+ <package-tck-test test="preferences"/>
+ <package-tck-test test="portletsession"/>
+ <package-tck-test test="portleturl"/>
+ <package-tck-test test="windowstates"/>
+ <package-tck-test test="portletcontext"/>
+ <package-api-test test="portletconfig"/>
+ <package-api-test test="portletmode"/>
+ <package-api-test test="windowstate"/>
+ <package-api-test test="portletsessionutil"/>
+ <package-api-test test="portalcontext"/>
+ <package-api-test test="portletcontext"/>
+ <package-api-test test="portleturl"/>
+ <package-api-test test="portletpreferences"/>
+ <package-api-test test="portletsession"/>
+ <package-api-test test="actionrequest"/>
+ <package-api-test test="renderrequest"/>
+ <package-api-test test="actionresponse"/>
+ <package-api-test test="renderresponse"/>
+ <package-ext-test test="nocache"/>
+ <package-ext-test test="expiringcache"/>
+ <package-ext-test test="neverexpiringcache"/>
+ <package-ext-test test="preferences"/>
+ <package-ext-test test="session"/>
+ <package-ext-test test="portletresponses"/>
+ <package-ext-test test="portletrequests"/>
+ <package-ext-test test="portletmode"/>
+ <package-ext-test test="portletconfig"/>
+ <package-ext-test test="taglib"/>
+ <package-misc-test test="log4j"/>
+ <package-jsr286-tck-test test="dispatcher"/>
+ <package-jsr286-tck-test test="portletconfig"/>
+ <package-jsr286-tck-test test="portletconfignonamespace"/>
+ <package-jsr286-tck-test test="event"/>
+ <package-jsr286-tck-test test="eventnonamespace"/>
+ <package-jsr286-tck-test test="stateawareresponse"/>
+ <package-jsr286-tck-test test="portletrequests"/>
+ <package-jsr286-tck-test test="resourceserving"/>
+ <package-jsr286-tck-test test="portleturl"/>
+ <package-jsr286-tck-test test="portletfilter"/>
+ <package-jsr286-tck-test test="taglib"/>
+ <package-jsr286-api-test test="event"/>
+ <package-jsr286-api-test test="portleturl"/>
+ <package-jsr286-ext-test test="portletrequests"/>
+ <package-jsr286-ext-test test="portletfilter"/>
+ <package-jsr286-ext-test test="portletresponses"/>
+ <package-jsr286-ext-test test="dispatcher"/>
+ <package-jsr286-ext-test test="portletcontext"/>
+ <package-jsr286-ext-test test="portletinterface"/>
+
+ <!-- -->
+ <jar jarfile="${test.temp.lib}/portlet-test-lib.jar">
+ <fileset dir="${target}/test-classes"/>
+ <fileset dir="${target}/classes"/>
+ </jar>
+
+
+ <!-- JBoss 4.2 portlet-test.war -->
+ <copy todir="${test.temp.dir}/jboss-4.2/portlet-test-war">
+ <fileset dir="${target}/test-classes/portlet-test-war"/>
+ <fileset
dir="${target}/test-classes/jboss-4.2/portlet-test-war"/>
+ </copy>
+ <copy todir="${test.temp.dir}/jboss-4.2/portlet-test-war/WEB-INF/lib"
flatten="true">
+
+ <!-- -->
+ <fileset dir="${test.temp.lib}"
includes="portlet-test-lib.jar"/>
+
+ <!-- -->
+ <path refid="mc.portal-common"/>
+
+ <path refid="mc.portal-portlet-controller"/>
+ <path refid="mc.portal-portlet-mc"/>
+
+ <!-- Remote plugin -->
+ <path refid="mc.jboss-remoting"/>
+ <path refid="mc.portal-test-generic"/>
+
+
+ <!-- MC 2.0.0.Beta4 -->
+ <path refid="mc.trove"/>
+ <path refid="mc.javassist"/>
+ <path refid="mc.jboss_common_core"/>
+ <path refid="mc.jboss_vfs"/>
+ <path refid="mc.jboss_xb"/>
+ <path refid="mc.jboss_aop"/>
+ <path refid="mc.jboss_microcontainer"/>
+ <path refid="mc.jaxb-api"/>
+
+ </copy>
+ <mkdir dir="${test.temp.lib}/jboss-4.2"/>
+ <jar jarfile="${test.temp.lib}/jboss-4.2/portlet-test.war">
+ <fileset dir="${test.temp.dir}/jboss-4.2/portlet-test-war"/>
+ </jar>
+
+ <!-- Tomcat 6.0 portlet-test.war -->
+ <copy todir="${test.temp.dir}/tomcat-6.0/portlet-test-war">
+ <fileset dir="${target}/test-classes/portlet-test-war"/>
+ <fileset
dir="${target}/test-classes/tomcat-6.0/portlet-test-war"/>
+ </copy>
+ <copy todir="${test.temp.dir}/tomcat-6.0/portlet-test-war/WEB-INF/lib"
flatten="true">
+
+ <!-- -->
+ <fileset dir="${test.temp.lib}"
includes="portlet-test-lib.jar"/>
+
+ <!-- -->
+ <path refid="mc.portal-common"/>
+
+ <path refid="mc.portal-portlet-controller"/>
+ <path refid="mc.portal-portlet-mc"/>
+
+ <!-- Remote plugin -->
+ <path refid="mc.jboss-remoting"/>
+ <path refid="mc.portal-test-generic"/>
+
+ <!-- MC 2.0.0.Beta4 -->
+ <path refid="mc.trove"/>
+ <path refid="mc.xerces"/>
+ <path refid="mc.javassist"/>
+ <path refid="mc.jboss_common_core"/>
+ <path refid="mc.jboss_vfs"/>
+ <path refid="mc.jboss_xb"/>
+ <path refid="mc.jboss_aop"/>
+ <path refid="mc.jboss_microcontainer"/>
+
+ </copy>
+ <mkdir dir="${test.temp.lib}/tomcat-6.0"/>
+ <jar jarfile="${test.temp.lib}/tomcat-6.0/portlet-test.war">
+ <fileset dir="${test.temp.dir}/tomcat-6.0/portlet-test-war"/>
+ </jar>
+
+ <!-- Strip cargo manager war filename-->
+ <copy file="${dependency.cargo-manager.war}"
tofile="${test.temp.lib}/manager.war"/>
+
+ </target>
+
+ <target name="cargo.setup">
+ <property name="cargo.log.dir"
value="${target}/test/cargo"/>
+ <mkdir dir="${cargo.log.dir}"/>
+ <taskdef resource="cargo.tasks">
+ <classpath>
+ <pathelement path="${plugin_classpath}"/>
+ </classpath>
+ </taskdef>
+ </target>
+
+ <target name="cargo.jboss-4.2.start" depends="cargo.setup">
+ <!-- The lib portal-test-lib.jar must be loaded at the shared level rather than
in the war file
+ otherwise it is somehow inspected and produce a NoClassDefFoundError in the
web service integration
+ layer on the class
org/jboss/portal/test/framework/driver/remote/RemoteTestDriver for some unknown
+ reason, the class initiating the loading of the RemoteTestDriver class is
+
org.jboss.ws.integration.jboss42.DeployerInterceptorJSE.isWebserviceDeployment(DeployerInterceptorJSE.java:84)
+ -->
+
+
+ <cargo
+ containerId="jboss42x"
+ home="${test.jboss-4.2.home}"
+ log="${cargo.log.dir}/cargo.${test.id}.shutdown.log"
+ output="${cargo.log.dir}/cargo.${test.id}.server.log"
+ action="start"
+ wait="${cargo.wait}">
+ <!--<sysproperty key="java.io.tmpdir"
value="${target}/cargo-tmp"/>-->
+ <sharedClasspath>
+
+ <path location="${dependency.portal-common.jar}"/>
+ <path location="${dependency.portal-common-portal.jar}"/>
+ <path location="${dependency.portal-portlet.jar}"/>
+ <path location="${dependency.portal-web.jar}"/>
+ <path location="${dependency.jsr168api.jar}"/>
+ <path location="${dependency.ccpp.jar}"/>
+
+ <path location="${dependency.jboss-unit.jar}"/>
+ <path location="${dependency.jboss-unit-remote.jar}"/>
+ <path location="${dependency.portal-test.jar}"/>
+
+ </sharedClasspath>
+ <configuration home="${test.jboss-4.2.tempdir}">
+ <property name="cargo.servlet.port" value="8080"/>
+ <property name="cargo.logging" value="high"/>
+ <!--<property name="cargo.jvmargs"
value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"/>-->
+ <deployable type="war"
file="${test.temp.lib}/jboss-4.2/portlet-test.war"/>
+ </configuration>
+ </cargo>
+ </target>
+
+ <target name="cargo.jboss-4.2.stop" depends="cargo.setup">
+ <cargo
+ containerId="jboss42x"
+ home="${test.jboss-4.2.home}"
+ log="${cargo.log.dir}/cargo.${test.id}.startup.log"
+ action="stop">
+ <!--<sysproperty key="java.io.tmpdir"
value="${target}/cargo-tmp"/>-->
+ <configuration home="${test.jboss-4.2.tempdir}">
+ <property name="cargo.rmi.port" value="1099"/>
+ </configuration>
+ </cargo>
+ </target>
+
+ <target name="tests.jboss-4.2.container-servlet"
if="${test.jboss-4.2.home.variable-name}">
+ <echo message="Starting JBoss 4.2 container-servlet tests with
${test.jboss-4.2.home}"/>
+ <antcall target="cargo.jboss-4.2.start">
+ <param name="cargo.wait" value="false"/>
+ <param name="test.spi.server.path"
value="${test.archive.path}"/>
+ </antcall>
+ <antcall target="tests.remote">
+ <param name="test.server.name"
value="${test.jboss-4.2.name}"/>
+ <param name="test.deploy.name"
value="jboss-4.2-container-servlet"/>
+ </antcall>
+ <antcall target="cargo.jboss-4.2.stop">
+ </antcall>
+ </target>
+
+ <target name="tests.jboss-4.2.generic"
if="${test.jboss-4.2.home.variable-name}">
+ <echo message="Starting JBoss 4.2 generic tests with
${test.jboss-4.2.home}"/>
+ <antcall target="cargo.jboss-4.2.start">
+ <param name="cargo.wait" value="false"/>
+ <param name="test.spi.server.path"
value="${test.archive.path}"/>
+ </antcall>
+ <antcall target="tests.remote">
+ <param name="test.server.name"
value="${test.jboss-4.2.name}"/>
+ <param name="test.deploy.name"
value="jboss-4.2-generic"/>
+ </antcall>
+ <antcall target="cargo.jboss-4.2.stop">
+ </antcall>
+ </target>
+
+ <target name="tests.jboss-4.2">
+ <antcall target="tests.jboss-4.2.container-servlet">
+ <param name="test.id"
value="JBoss-4_2_0-container-servlet"/>
+ <param name="test.jboss-4.2.name"
value="RemoteJBoss_4_2_0"/>
+ <param name="test.jboss-4.2.home"
value="${JBOSS_4_2_0_HOME}"/>
+ <param name="test.jboss-4.2.home.variable-name"
value="JBOSS_4_2_0_HOME"/>
+ <param name="test.jboss-4.2.tempdir"
value="${target}/cargo-tmp/4_2_0"/>
+ </antcall>
+ <antcall target="tests.jboss-4.2.container-servlet">
+ <param name="test.id"
value="JBoss-4_2_1-container-servlet"/>
+ <param name="test.jboss-4.2.name"
value="RemoteJBoss_4_2_1"/>
+ <param name="test.jboss-4.2.home"
value="${JBOSS_4_2_1_HOME}"/>
+ <param name="test.jboss-4.2.home.variable-name"
value="JBOSS_4_2_1_HOME"/>
+ <param name="test.jboss-4.2.tempdir"
value="${target}/cargo-tmp/4_2_1"/>
+ </antcall>
+ <antcall target="tests.jboss-4.2.container-servlet">
+ <param name="test.id"
value="JBoss-4_2_2-container-servlet"/>
+ <param name="test.jboss-4.2.name"
value="RemoteJBoss_4_2_2"/>
+ <param name="test.jboss-4.2.home"
value="${JBOSS_4_2_2_HOME}"/>
+ <param name="test.jboss-4.2.home.variable-name"
value="JBOSS_4_2_2_HOME"/>
+ <param name="test.jboss-4.2.tempdir"
value="${target}/cargo-tmp/4_2_2"/>
+ </antcall>
+ </target>
+
+ <target name="tests.jboss">
+ <antcall target="tests.jboss-4.2"/>
+ </target>
+
+ <target name="cargo.tomcat-6.start" depends="cargo.setup">
+
+ <taskdef resource="cargo.tasks">
+ <classpath>
+ <pathelement path="${plugin_classpath}"/>
+ </classpath>
+ </taskdef>
+
+ <cargo
+ containerId="tomcat5x"
+ home="${test.tomcat-6.home}"
+ output="${cargo.log.dir}/cargo.${test.id}.server.log"
+ log="${cargo.log.dir}/cargo.${test.id}.start.log"
+ action="start"
+ wait="${cargo.wait}">
+ <sharedClasspath>
+
+ <path location="${dependency.log4j.jar}"/>
+ <path location="${dependency.concurrent.jar}"/>
+ <path location="${dependency.activation.jar}"/>
+ <path location="${dependency.jaxb-api.jar}"/>
+
+ <path refid="mc.jboss_common_logging_spi"/>
+ <path refid="mc.jboss_common_logging_jdk"/>
+
+ <path location="${dependency.portal-common.jar}"/>
+ <path location="${dependency.portal-common-portal.jar}"/>
+ <path location="${dependency.portal-portlet.jar}"/>
+ <path location="${dependency.portal-web.jar}"/>
+ <path location="${dependency.jsr168api.jar}"/>
+ <path location="${dependency.ccpp.jar}"/>
+
+ <path location="${dependency.jboss-unit.jar}"/>
+ <path location="${dependency.jboss-unit-remote.jar}"/>
+ <path location="${dependency.portal-test.jar}"/>
+
+ </sharedClasspath>
+ <configuration>
+ <property name="cargo.servlet.port" value="8080"/>
+ <property name="cargo.logging" value="high"/>
+ <!--<property name="cargo.jvmargs" value="-Xdebug
-Xnoagent -Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9000"/>-->
+ <deployable type="war"
file="${test.temp.lib}/manager.war"/>
+ <deployable type="war"
file="${test.temp.lib}/tomcat-6.0/portlet-test.war"/>
+ </configuration>
+ </cargo>
+ </target>
+
+ <target name="cargo.tomcat-6.stop" depends="cargo.setup">
+ <cargo
+ containerId="tomcat5x"
+ home="${test.tomcat-6.home}"
+ log="${cargo.log.dir}/cargo.${test.id}.shutdown.log"
+ action="stop">
+ <configuration/>
+ </cargo>
+ </target>
+
+ <target name="tests.tomcat-6.container-servlet"
if="${test.tomcat-6.home.variable-name}">
+ <echo message="Starting Tomcat 6 container-servlet tests with
${test.tomcat-6.home}"/>
+ <antcall target="cargo.tomcat-6.start">
+ <param name="cargo.wait" value="false"/>
+ </antcall>
+ <antcall target="tests.remote">
+ <param name="test.server.name"
value="RemoteTomcat_6_0"/>
+ </antcall>
+ <antcall target="cargo.tomcat-6.stop"/>
+ </target>
+
+ <target name="tests.tomcat-6">
+ <antcall target="tests.tomcat-6.container-servlet">
+ <param name="test.id"
value="Tomcat-6_0-container-servlet"/>
+ <param name="test.tomcat-6.name"
value="RemoteTomcat_6_0"/>
+ <param name="test.tomcat-6.home"
value="${TOMCAT_6_0_HOME}"/>
+ <param name="test.tomcat-6.home.variable-name"
value="TOMCAT_6_0_HOME"/>
+ </antcall>
+ </target>
+
+ <target name="tests.tomcat">
+ <antcall target="tests.tomcat-6"/>
+ </target>
+
+ <target name="tests.remote">
+
+ <taskdef name="jboss-unit"
classname="org.jboss.unit.tooling.ant.JBossUnitTask"
classpath="${plugin_classpath}"/>
+
+ <jboss-unit jpda="false" jpdaPort="9000"
jpdaSuspend="true" failOnError="false">
+
+ <tests
config="${target}/test-classes/test/remote-jboss-unit.xml">
+ <property name="archivePath"
value="${test.temp.lib}"/>
+ <property name="serverName"
value="${test.server.name}"/>
+ </tests>
+
+ <reports>
+ <xml
toDir="${target}/tests/reports/xml/${test.server.name}"/>
+ <html
toDir="${target}/tests/reports/html/${test.server.name}"/>
+ </reports>
+
+ <classpath>
+ <pathelement location="${target}/classes"/>
+ <pathelement location="${test.temp.lib}"/>
+ <!--<pathelement
location="${target}/test-classes"/>-->
+ <pathelement location="${target}/test-classes/test"/>
+ <pathelement path="${test_classpath}"/>
+ </classpath>
+
+ </jboss-unit>
+
+ </target>
+
+
+ <macrodef name="generic-package-simple-portal">
+ <attribute name="server"/>
+ <sequential>
+ <copy todir="@{server}/simple-portal" flatten="true">
+ <path>
+ <path location="${dependency.portal-common.jar}"/>
+ <path location="${dependency.portal-common-portal.jar}"/>
+ <path location="${dependency.portal-portlet.jar}"/>
+ <path location="${dependency.portal-web.jar}"/>
+ <path location="${dependency.jsr168api.jar}"/>
+ <path location="${dependency.ccpp.jar}"/>
+ <path refid="mc.portal-portlet-controller"/>
+ <path refid="mc.portal-portlet-mc"/>
+ </path>
+ </copy>
+
+ <copy todir="(a){server}/simple-portal/simple-portal.war">
+ <fileset dir="${test.temp.dir}/simple-portal-war"/>
+ </copy>
+ </sequential>
+ </macrodef>
+
+ <target name="package-tck-portal" depends="prepare_env">
+
+ <property name="tck" value="${target}/tck"/>
+ <property name="tck-jboss" value="${tck}/jboss42"/>
+ <property name="tck-tomcat" value="${tck}/tomcat6"/>
+
+
+ <mkdir dir="${tck}"/>
+ <mkdir dir="${tck-jboss}"/>
+ <mkdir dir="${tck-tomcat}"/>
+ <!--<mkdir dir="${tck}/tomcat6"/>-->
+
+
+ <jar jarfile="${target}/portlet-test-lib.jar">
+ <fileset dir="${target}/classes"
excludes="org/jboss/portal/portlet/portal/samples/**"/>
+ </jar>
+
+ <copy todir="${tck-jboss}/portlet-tck-war">
+ <fileset dir="${target}/test-classes/portlet-tck-war"/>
+ </copy>
+ <copy todir="${tck-jboss}/portlet-tck-war">
+ <fileset
dir="${target}/test-classes/jboss-4.2/portlet-tck-war"/>
+ </copy>
+
+ <copy todir="${tck-jboss}/portlet-tck-war/WEB-INF/lib"
flatten="true">
+
+ <!-- -->
+ <fileset dir="${target}"
includes="portlet-test-lib.jar"/>
+
+ <!-- -->
+ <path refid="mc.portal-common"/>
+
+ <path refid="mc.portal-portlet-controller"/>
+ <path refid="mc.portal-portlet-mc"/>
+
+ <!-- Remote plugin -->
+ <path refid="mc.jboss-remoting"/>
+ <path refid="mc.portal-test-generic"/>
+
+
+ <!-- MC 2.0.0.Beta4 -->
+ <path refid="mc.trove"/>
+ <path refid="mc.javassist"/>
+ <path refid="mc.jboss_common_core"/>
+ <path refid="mc.jboss_vfs"/>
+ <path refid="mc.jboss_xb"/>
+ <path refid="mc.jboss_aop"/>
+ <path refid="mc.jboss_microcontainer"/>
+
+
+ </copy>
+
+ <mkdir dir="${tck-jboss}/tck-portal"/>
+
+ <jar jarfile="${tck-jboss}/tck-portal/portlet-tck.war">
+ <fileset dir="${tck-jboss}/portlet-tck-war"/>
+ </jar>
+
+ <copy todir="${tck-jboss}/tck-portal" flatten="true">
+
+ <!--Stuff from shared classpath-->
+ <path location="${dependency.portal-common.jar}"/>
+ <path location="${dependency.portal-common-portal.jar}"/>
+ <path location="${dependency.portal-portlet.jar}"/>
+ <path location="${dependency.portal-web.jar}"/>
+ <path location="${dependency.jsr168api.jar}"/>
+ <path location="${dependency.ccpp.jar}"/>
+ <path location="${dependency.jaxb-api.jar}"/>
+
+ <path location="${dependency.jboss-unit.jar}"/>
+ <path location="${dependency.jboss-unit-remote.jar}"/>
+ <path location="${dependency.portal-test.jar}"/>
+
+ </copy>
+
+
+ <!--TOMCAT-->
+
+ <copy todir="${tck-tomcat}/portlet-tck-war">
+ <fileset dir="${target}/test-classes/portlet-tck-war"/>
+ </copy>
+ <copy todir="${tck-tomcat}/portlet-tck-war">
+ <fileset
dir="${target}/test-classes/tomcat-6.0/portlet-tck-war"/>
+ </copy>
+
+ <copy todir="${tck-tomcat}/portlet-tck-war/WEB-INF/lib"
flatten="true">
+
+ <!-- -->
+ <fileset dir="${target}"
includes="portlet-test-lib.jar"/>
+
+ <!-- -->
+ <path refid="mc.portal-common"/>
+
+ <path refid="mc.portal-portlet-controller"/>
+ <path refid="mc.portal-portlet-mc"/>
+
+ <!-- Remote plugin -->
+ <path refid="mc.jboss-remoting"/>
+ <path refid="mc.portal-test-generic"/>
+
+ <!-- MC 2.0.0.Beta4 -->
+ <path refid="mc.trove"/>
+ <path refid="mc.xerces"/>
+ <path refid="mc.javassist"/>
+ <path refid="mc.jboss_common_core"/>
+ <path refid="mc.jboss_vfs"/>
+ <path refid="mc.jboss_xb"/>
+ <path refid="mc.jboss_aop"/>
+ <path refid="mc.jboss_microcontainer"/>
+
+
+ </copy>
+
+ <mkdir dir="${tck-tomcat}/tck-portal"/>
+
+ <jar jarfile="${tck-tomcat}/tck-portal/portlet-tck.war">
+ <fileset dir="${tck-tomcat}/portlet-tck-war"/>
+ </jar>
+
+ <copy todir="${tck-tomcat}/tck-portal" flatten="true">
+
+ <!--Stuff from shared classpath-->
+ <path location="${dependency.log4j.jar}"/>
+ <path location="${dependency.concurrent.jar}"/>
+ <path location="${dependency.activation.jar}"/>
+ <path location="${dependency.jaxb-api.jar}"/>
+
+ <path refid="mc.jboss_common_logging_spi"/>
+ <path refid="mc.jboss_common_logging_jdk"/>
+
+ <path location="${dependency.portal-common.jar}"/>
+ <path location="${dependency.portal-common-portal.jar}"/>
+ <path location="${dependency.portal-portlet.jar}"/>
+ <path location="${dependency.portal-web.jar}"/>
+ <path location="${dependency.jsr168api.jar}"/>
+ <path location="${dependency.ccpp.jar}"/>
+
+ <path location="${dependency.jboss-unit.jar}"/>
+ <path location="${dependency.jboss-unit-remote.jar}"/>
+ <path location="${dependency.portal-test.jar}"/>
+
+ </copy>
+
+
+
+ <delete file="${target}/portlet-test-lib.jar"/>
+
+ </target>
+
+ <target name="package-simple-portal" depends="prepare_env">
+ <property name="portal.dir" value="${target}/portal"/>
+ <property name="simple.tomcat.dir"
value="${portal.dir}/tomcat"/>
+ <property name="simple.as42.dir"
value="${portal.dir}/as42"/>
+ <!--<property name="simple.as5.dir"
value="${portal.dir}/as5"/>-->
+
+ <delete dir="${portal.dir}"/>
+
+ <mkdir dir="${portal.dir}"/>
+ <mkdir dir="${simple.tomcat.dir}"/>
+ <mkdir dir="${simple.as42.dir}"/>
+ <!--<mkdir dir="${simple.as5.dir}"/>-->
+
+
+ <jar jarfile="${target}/portlet-test-lib.jar">
+ <fileset dir="${target}/classes"
excludes="org/jboss/portal/portlet/portal/samples/**"/>
+ </jar>
+
+ <copy todir="${test.temp.dir}/simple-portal-war">
+ <fileset dir="src/test/resources/simple-portal-war"/>
+ </copy>
+
+ <!-- simple-portal.war -->
+ <copy todir="${test.temp.dir}/simple-portal-war/WEB-INF/lib"
flatten="true">
+
+ <!-- -->
+ <fileset dir="${target}"
includes="portlet-test-lib.jar"/>
+
+
+ <path refid="mc.portal-common"/>
+
+ <!-- MC 2.0.0.Beta4 -->
+ <path refid="mc.trove"/>
+ <path refid="mc.xerces"/>
+ <path refid="mc.javassist"/>
+ <path refid="mc.jboss_common_logging_spi"/>
+ <path refid="mc.jboss_common_logging_jdk"/>
+ <path refid="mc.jboss_common_logging_log4j"/>
+ <path refid="mc.jboss_common_core"/>
+ <path refid="mc.jboss_vfs"/>
+ <path refid="mc.jboss_xb"/>
+ <path refid="mc.jboss_aop"/>
+ <path refid="mc.jboss_microcontainer"/>
+ </copy>
+
+ <!-- AS 4.2 -->
+ <generic-package-simple-portal server="${simple.as42.dir}"/>
+
+ <!-- Tomcat -->
+ <generic-package-simple-portal server="${simple.tomcat.dir}"/>
+ <copy todir="${simple.tomcat.dir}/simple-portal"
flatten="true">
+ <path>
+ <pathelement path="${dependency.log4j.jar}"/>
+ <pathelement path="${dependency.activation.jar}"/>
+ <pathelement path="${dependency.apache-jstl.jar}"/>
+ <pathelement path="${dependency.apache-standard.jar}"/>
+ <pathelement path="${dependency.concurrent.jar}"/>
+ <path refid="mc.jboss_common_logging_spi"/>
+ <path refid="mc.jaxb-api"/>
+ </path>
+ </copy>
+ <jar jarfile="${simple.tomcat.dir}/simple-portal.war">
+ <fileset
dir="${simple.tomcat.dir}/simple-portal/simple-portal.war"/>
+ </jar>
+ <delete
dir="${simple.tomcat.dir}/simple-portal/simple-portal.war"/>
+ <move todir="${simple.tomcat.dir}/copy-to-tomcat-lib">
+ <fileset dir="${simple.tomcat.dir}/simple-portal/"/>
+ </move>
+
+ <!-- AS 5 -->
+ <!--<generic-package-simple-portal
server="${simple.as5.dir}"/>-->
+
+ <delete file="${target}/portlet-test-lib.jar"/>
+
+ <antcall target="__package-demo-portlets"/>
+ </target>
+
+ <target name="__package-demo-portlets"
depends="prepare_env">
+
+ <property name="samples.target.dir"
value="${portal.dir}/samples"/>
+ <property name="samples.tmp.dir"
value="${test.temp.dir}/portal"/>
+
+ <mkdir dir="${samples.tmp.dir}"/>
+ <mkdir dir="${samples.target.dir}"/>
+
+ <copy todir="${samples.tmp.dir}/samples-google-map-portlet-war">
+ <fileset
dir="src/test/resources/portal/samples/google-map-portlet-war"/>
+ </copy>
+ <copy
todir="${samples.tmp.dir}/samples-google-map-portlet-war/WEB-INF/classes">
+ <fileset dir="${target}/classes"
+
includes="org/jboss/portal/portlet/portal/samples/GoogleClippingPortlet.class"/>
+ </copy>
+ <jar
jarfile="${samples.target.dir}/samples-google-map-portlet.war">
+ <fileset
dir="${samples.tmp.dir}/samples-google-map-portlet-war"/>
+ </jar>
+
+ <copy
todir="${samples.tmp.dir}/samples-google-weather-portlet-war">
+ <fileset
dir="src/test/resources/portal/samples/google-weather-portlet-war"/>
+ </copy>
+ <copy
todir="${samples.tmp.dir}/samples-google-weather-portlet-war/WEB-INF/classes">
+ <fileset dir="${target}/classes"
includes="org/jboss/portal/portlet/portal/samples/*.class"
+
excludes="org/jboss/portal/portlet/portal/samples/RemoteControlResourcePortlet.class"/>
+ </copy>
+ <jar
jarfile="${samples.target.dir}/samples-google-weather-portlet.war">
+ <fileset
dir="${samples.tmp.dir}/samples-google-weather-portlet-war"/>
+ </jar>
+
+ <copy
todir="${samples.tmp.dir}/samples-remotecontrol-portlet-war">
+ <fileset
dir="src/test/resources/portal/samples/remotecontrol-portlet-war"/>
+ </copy>
+ <copy
todir="${samples.tmp.dir}/samples-remotecontrol-portlet-war/WEB-INF/classes">
+ <fileset dir="${target}/classes"
+
includes="org/jboss/portal/portlet/portal/samples/RemoteControlResourcePortlet.class"/>
+ </copy>
+ <jar
jarfile="${samples.target.dir}/samples-remotecontrol-portlet.war">
+ <fileset
dir="${samples.tmp.dir}/samples-remotecontrol-portlet-war"/>
+ </jar>
+
+ <copy todir="${samples.tmp.dir}/samples-cart-event-portlet-war">
+ <fileset
dir="src/test/resources/portal/samples/cart-event-portlet-war"/>
+ </copy>
+ <copy
todir="${samples.tmp.dir}/samples-cart-event-portlet-war/WEB-INF/classes">
+ <fileset dir="${target}/classes"
includes="org/jboss/portal/portlet/portal/samples/event/*.class"/>
+ </copy>
+ <jar
jarfile="${samples.target.dir}/samples-cart-event-portlet.war">
+ <fileset
dir="${samples.tmp.dir}/samples-cart-event-portlet-war"/>
+ </jar>
+
+ <copy todir="${samples.tmp.dir}/samples-basic-war">
+ <fileset dir="src/test/resources/portal/samples/basic-war"/>
+ </copy>
+ <copy
todir="${samples.tmp.dir}/samples-basic-war/WEB-INF/classes">
+ <fileset dir="${target}/classes"
includes="org/jboss/portal/portlet/portal/samples/basic/**"/>
+ </copy>
+ <jar jarfile="${samples.target.dir}/samples-basic.war">
+ <fileset dir="${samples.tmp.dir}/samples-basic-war"/>
+ </jar>
+
+ </target>
+
+</project>
\ No newline at end of file
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/InterceptorStackFactoryImpl.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/InterceptorStackFactoryImpl.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/InterceptorStackFactoryImpl.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,84 @@
+/******************************************************************************
+ * 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;
+
+import org.jboss.portal.common.invocation.Interceptor;
+import org.jboss.portal.common.invocation.InterceptorStack;
+import org.jboss.portal.common.invocation.InterceptorStackFactory;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class InterceptorStackFactoryImpl implements InterceptorStackFactory
+{
+
+ /** . */
+ private volatile Interceptor[] interceptors;
+
+ /** . */
+ private final InterceptorStackImpl stack = new InterceptorStackImpl();
+
+ public Interceptor[] getInterceptors()
+ {
+ return interceptors;
+ }
+
+ public void setInterceptors(Interceptor[] interceptors)
+ {
+ this.interceptors = interceptors;
+ }
+
+ public InterceptorStack getInterceptorStack()
+ {
+ return stack;
+ }
+
+ private class InterceptorStackImpl implements InterceptorStack
+ {
+
+ public int getLength()
+ {
+ // Avoid dirty reads
+ Interceptor[] interceptors = InterceptorStackFactoryImpl.this.interceptors;
+
+ //
+ return interceptors != null ? interceptors.length : 0;
+ }
+
+ public Interceptor getInterceptor(int i) throws ArrayIndexOutOfBoundsException
+ {
+ // Avoid dirty reads
+ Interceptor[] interceptors = InterceptorStackFactoryImpl.this.interceptors;
+
+ //
+ if (interceptors == null)
+ {
+ throw new ArrayIndexOutOfBoundsException("No interceptors");
+ }
+
+ //
+ return interceptors[i];
+ }
+ }
+}
\ No newline at end of file
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/TestPortletInvoker.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/TestPortletInvoker.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/TestPortletInvoker.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,159 @@
+/******************************************************************************
+ * 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;
+
+import org.jboss.portal.common.invocation.InterceptorStackFactory;
+import org.jboss.portal.common.invocation.Invocation;
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.invocation.InvocationHandler;
+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.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.state.DestroyCloneFailure;
+import org.jboss.portal.portlet.state.PropertyChange;
+import org.jboss.portal.portlet.state.PropertyMap;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * A simple consumer.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 6712 $
+ */
+public class TestPortletInvoker implements PortletInvoker
+{
+
+ /** . */
+ private InterceptorStackFactory stackFactory;
+
+ /** . */
+ private PortletInvoker producer;
+
+ /** . */
+ private InvocationHandler handler = new InvocationHandler()
+ {
+ public Object invoke(Invocation invocation) throws Exception, InvocationException
+ {
+ PortletInvocation portletInvocation = (PortletInvocation)invocation;
+ try
+ {
+ portletInvocation.setHandler(null);
+ return producer.invoke(portletInvocation);
+ }
+ finally
+ {
+ portletInvocation.setHandler(this);
+ }
+ }
+ };
+
+ public InterceptorStackFactory getStackFactory()
+ {
+ return stackFactory;
+ }
+
+ public void setStackFactory(InterceptorStackFactory stackFactory)
+ {
+ this.stackFactory = stackFactory;
+ }
+
+ public PortletInvoker getProducer()
+ {
+ return producer;
+ }
+
+ public void setProducer(PortletInvoker producer)
+ {
+ this.producer = producer;
+ }
+
+ public Set<Portlet> getPortlets() throws PortletInvokerException
+ {
+ return producer.getPortlets();
+ }
+
+ public Portlet getPortlet(PortletContext portletContext) throws
IllegalArgumentException, PortletInvokerException
+ {
+ return producer.getPortlet(portletContext);
+ }
+
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws
PortletInvokerException
+ {
+ InvocationHandler prevHandler = invocation.getHandler();
+ try
+ {
+ invocation.setHandler(handler);
+ return
(PortletInvocationResponse)invocation.invoke(stackFactory.getInterceptorStack());
+ }
+ catch (Exception e)
+ {
+ if (e instanceof PortletInvokerException)
+ {
+ throw (PortletInvokerException)e;
+ }
+ else if (e instanceof RuntimeException)
+ {
+ throw (RuntimeException)e;
+ }
+ else
+ {
+ throw new PortletInvokerException(e);
+ }
+ }
+ finally
+ {
+ invocation.setHandler(prevHandler);
+ }
+ }
+
+ public PortletContext createClone(PortletContext portletContext) throws
IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public List<DestroyCloneFailure> destroyClones(List<PortletContext>
portletContexts) throws IllegalArgumentException, PortletInvokerException,
UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public PropertyMap getProperties(PortletContext portletContext, Set keys) throws
IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public PropertyMap getProperties(PortletContext portletContext) throws
IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public PortletContext setProperties(PortletContext portletContext, PropertyChange[]
changes) throws IllegalArgumentException, PortletInvokerException,
UnsupportedOperationException
+ {
+ throw new UnsupportedOperationException();
+ }
+}
\ No newline at end of file
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/admin/ui/AdminPortlet.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,172 @@
+/******************************************************************************
+ * 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.admin.ui;
+
+import org.jboss.portal.portlet.container.managed.PortletApplicationRegistry;
+import org.jboss.portal.portlet.container.managed.ManagedPortletApplication;
+import org.jboss.portal.portlet.container.managed.ManagedPortletContainer;
+import org.jboss.portal.portlet.container.managed.ManagedPortletFilter;
+import org.jboss.portal.portlet.container.managed.ManagedObject;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletURL;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class AdminPortlet extends GenericPortlet
+{
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws
PortletException, IOException
+ {
+
+ String lifeCycle = req.getParameter("lifecycle");
+
+ //
+ String applicationId = req.getParameter("application");
+
+ //
+ if (applicationId != null)
+ {
+ // Use an alias
+ PortletApplicationRegistry registry =
(PortletApplicationRegistry)getPortletContext().getAttribute("PortletApplicationDeployer");
+
+ //
+ ManagedPortletApplication application =
registry.getManagedPortletApplication(applicationId);
+ ManagedObject managedObject = application;
+
+ //
+ String containerId = req.getParameter("container");
+ if (containerId != null)
+ {
+ managedObject = application.getManagedPortletContainer(containerId);
+ }
+ else
+ {
+ String filterId = req.getParameter("filter");
+ if (filterId != null)
+ {
+ managedObject = application.getManagedPortletFilter(filterId);
+ }
+ }
+
+ //
+ final ManagedObject tmp = managedObject;
+ if (tmp != null)
+ {
+ if ("start".equals(lifeCycle))
+ {
+ tmp.managedStart();
+ }
+ else if ("stop".equals(lifeCycle))
+ {
+ // Async stop otherwise it is not possible to stop the admin portlet (self
deadlock)
+ new Thread()
+ {
+ public void run()
+ {
+ tmp.managedStop();
+ }
+ }.start();
+ }
+ }
+ }
+ }
+
+ protected void doView(RenderRequest req, RenderResponse resp) throws PortletException,
IOException
+ {
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ // Use an alias
+ PortletApplicationRegistry registry =
(PortletApplicationRegistry)getPortletContext().getAttribute("PortletApplicationDeployer");
+
+ //
+ for (ManagedPortletApplication application :
registry.getManagedPortletApplications())
+ {
+ PortletURL url = resp.createActionURL();
+ url.setParameter("application", application.getId());
+
+ //
+ url.setParameter("lifecycle", "stop");
+ String stopURL = url.toString();
+
+ //
+ url.setParameter("lifecycle", "start");
+ String startURL = url.toString();
+
+ //
+ writer.print("<ul><li>Application " + application.getId()
+ " " + application.getStatus() +
+ " <a href=\"" + startURL +
"\">Start</a> <a href=\"" + stopURL +
"\">Stop</a></li><ul>");
+
+ //
+ for (ManagedPortletFilter filter : application.getManagedPortletFilters())
+ {
+ url.setParameter("filter", filter.getId());
+
+ //
+ url.setParameter("lifecycle", "stop");
+ stopURL = url.toString();
+
+ //
+ url.setParameter("lifecycle", "start");
+ startURL = url.toString();
+
+ //
+ writer.print("<li>Filter " + filter.getId() + " " +
filter.getStatus() + " <a href=\"" +
+ startURL + "\">Start</a> <a href=\"" +
stopURL + "\">Stop</a></li>");
+ }
+
+ //
+ for (ManagedPortletContainer container :
application.getManagedPortletContainers())
+ {
+ url.setParameter("container", container.getId());
+
+ //
+ url.setParameter("lifecycle", "stop");
+ stopURL = url.toString();
+
+ //
+ url.setParameter("lifecycle", "start");
+ startURL = url.toString();
+
+ //
+ writer.print("<li>Container " + container.getId() + "
" + container.getStatus() + " <a href=\"" +
+ startURL + "\">Start</a> <a href=\"" +
stopURL + "\">Stop</a></li>");
+ }
+ writer.print("</ul></ul>");
+ }
+
+ //
+ writer.close();
+
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/ControllerFilter.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/ControllerFilter.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/ControllerFilter.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,273 @@
+/******************************************************************************
+ * 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.jsp;
+
+import org.jboss.portal.portlet.controller.impl.PortletURLRenderer;
+import org.jboss.portal.portlet.controller.impl.URLParameterConstants;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.URLFormat;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.ErrorResponse;
+import org.jboss.portal.portlet.invocation.response.ContentResponse;
+import org.jboss.portal.portlet.controller.PortletController;
+import org.jboss.portal.portlet.controller.request.PortletActionRequest;
+import org.jboss.portal.portlet.controller.impl.request.ControllerRequestFactory;
+import org.jboss.portal.portlet.controller.request.ControllerRequest;
+import org.jboss.portal.portlet.controller.impl.request.ControllerRequestParameterNames;
+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.portlet.controller.state.PageNavigationalStateSerialization;
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.common.io.SerializationFilter;
+import org.jboss.portal.common.util.Base64;
+import org.jboss.portal.web.WebRequest;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletContext;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ControllerFilter implements Filter
+{
+
+ /** . */
+ private FilterConfig config;
+
+ private ServletContext getServletContext()
+ {
+ return config.getServletContext();
+ }
+
+ public void init(FilterConfig config) throws ServletException
+ {
+ this.config = config;
+ }
+
+ public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain)
throws IOException, ServletException
+ {
+ 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, PortletInvokerException
+ {
+ PortletInvoker invoker =
(PortletInvoker)getServletContext().getAttribute("ConsumerPortletInvoker");
+
+ //
+ PortalPrepareResponse prepareResponse = new PortalPrepareResponse(req, resp);
+
+ // Discover existing portlets on the page (introspection phase)
+ chain.doFilter(req, prepareResponse);
+
+ // Now we can create a populated context
+ PagePortletControllerContext context = new PagePortletControllerContext(req, resp,
invoker, getServletContext(), prepareResponse);
+
+ // The type of invocation
+ String type = req.getParameter(URLParameterConstants.TYPE);
+
+ // Process only portlet type
+ // The request decoded if not null
+ PageNavigationalState pageNavigationalState = null;
+ if (URLParameterConstants.PORTLET_TYPE.equals(type))
+ {
+ WebRequest wr = new WebRequest(req);
+ ControllerRequestFactory factory = new
ControllerRequestFactory(context.getPageNavigationalStateSerialization());
+ ControllerRequest request = factory.createRequest(wr);
+
+ ControllerResponse controllerResponse;
+ try
+ {
+ controllerResponse = new PortletController().process(context, request);
+ }
+ catch (PortletInvokerException e)
+ {
+ throw new ServletException(e);
+ }
+
+ //
+ if (controllerResponse instanceof PageUpdateResponse)
+ {
+ PageUpdateResponse pageUpdate = (PageUpdateResponse)controllerResponse;
+
+ // We perform a send redirect on actions
+ if (request instanceof PortletActionRequest)
+ {
+ //
+ PortletURLRenderer renderer = new PortletURLRenderer(
+ pageUpdate.getPageNavigationalState(),
+ context.getClientRequest(),
+ context.getClientResponse(),
+ context.getPageNavigationalStateSerialization());
+
+ //
+ String url = renderer.renderURL(new URLFormat(null, null, true, null));
+
+ //
+ resp.sendRedirect(url);
+
+ //
+ return;
+ }
+ else
+ {
+ pageNavigationalState = pageUpdate.getPageNavigationalState();
+ }
+ }
+ else if (controllerResponse instanceof ResourceResponse)
+ {
+ ResourceResponse resourceResponse = (ResourceResponse)controllerResponse;
+ PortletInvocationResponse pir = resourceResponse.getResponse();
+
+ //
+ if (pir instanceof ContentResponse)
+ {
+ ContentResponse contentResponse = (ContentResponse)pir;
+
+ //
+ if (contentResponse.getType() == ContentResponse.TYPE_EMPTY)
+ {
+ resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
+ }
+ else
+ {
+ String contentType = contentResponse.getContentType();
+ if (contentType != null)
+ {
+ resp.setContentType(contentType);
+ }
+
+ //
+ if (contentResponse.getType() == ContentResponse.TYPE_BYTES)
+ {
+ ServletOutputStream out = null;
+ try
+ {
+ out = resp.getOutputStream();
+ out.write(contentResponse.getBytes());
+ }
+ finally
+ {
+ IOTools.safeClose(out);
+ }
+ }
+ else
+ {
+ Writer writer = null;
+ try
+ {
+ writer = resp.getWriter();
+ writer.write(contentResponse.getChars());
+ }
+ finally
+ {
+ writer.close();
+ }
+ }
+ }
+ }
+ else
+ {
+ // todo
+ }
+
+ //
+ return;
+ }
+ else if (controllerResponse instanceof PortletResponse)
+ {
+ PortletResponse portletResponse = (PortletResponse)controllerResponse;
+ PortletInvocationResponse pir = portletResponse.getResponse();
+
+ //
+ 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
+ }
+ }
+ else
+ {
+ PageNavigationalStateSerialization serialization = new
PageNavigationalStateSerialization(context.getStateControllerContext());
+ // The nav state provided with the request
+ // Unmarshall portal navigational state if it is provided
+ pageNavigationalState = null;
+ String blah =
req.getParameter(ControllerRequestParameterNames.PAGE_NAVIGATIONAL_STATE);
+ if (blah != null)
+ {
+ byte[] bytes = Base64.decode(blah, true);
+ pageNavigationalState = IOTools.unserialize(serialization,
SerializationFilter.COMPRESSOR, bytes);
+ }
+ }
+
+ //
+ PortalRenderResponse renderResponse = new PortalRenderResponse(req, resp, context,
pageNavigationalState, prepareResponse);
+
+ //
+ chain.doFilter(req, renderResponse);
+ }
+
+ public void destroy()
+ {
+ this.config = null;
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageEventControllerContext.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,88 @@
+/******************************************************************************
+ * 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.jsp;
+
+import org.jboss.portal.portlet.controller.event.EventControllerContext;
+import org.jboss.portal.portlet.controller.event.Event;
+import org.jboss.portal.portlet.controller.event.EventPhaseSession;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.info.PortletInfo;
+
+/**
+ * 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 $
+ */
+public class PageEventControllerContext implements EventControllerContext
+{
+
+ /** . */
+ private final PortalPrepareResponse prepareResponse;
+
+ /** . */
+ private final PagePortletControllerContext context;
+
+ public PageEventControllerContext(
+ PagePortletControllerContext context,
+ PortalPrepareResponse prepareResponse)
+ {
+ this.context = context;
+ this.prepareResponse = prepareResponse;
+ }
+
+ public void eventProduced(EventPhaseSession session, Event sourceEvent, Event
producedEvent)
+ {
+ for (String windowId : prepareResponse.getWindowIds())
+ {
+ try
+ {
+ Portlet portlet = context.getPortlet(windowId);
+
+ //
+ if (portlet != null)
+ {
+ PortletInfo portletInfo = portlet.getInfo();
+
+ //
+ if
(portletInfo.getEventing().getConsumedEvents().containsKey(producedEvent.getName()))
+ {
+ Event distributedEvent = new Event(producedEvent.getName(),
producedEvent.getPayload(), windowId);
+ session.queueEvent(distributedEvent);
+ }
+ }
+ }
+ catch (PortletInvokerException e)
+ {
+ e.printStackTrace();
+ session.interrupt();
+ }
+ }
+ }
+
+ public void eventConsumed(EventPhaseSession session, Event sourceEvent, Event
consumedEvent)
+ {
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageParameterDef.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageParameterDef.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PageParameterDef.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * 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.jsp;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PageParameterDef
+{
+
+ /** . */
+ private QName name;
+
+ /** . */
+ private String value;
+
+ /** . */
+ private boolean frozen;
+
+ public PageParameterDef(QName name, String value, boolean frozen)
+ {
+ this.name = name;
+ this.value = value;
+ this.frozen = frozen;
+ }
+
+ public QName getName()
+ {
+ return name;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public boolean isFrozen()
+ {
+ return frozen;
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PagePortletControllerContext.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PagePortletControllerContext.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PagePortletControllerContext.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,169 @@
+/******************************************************************************
+ * 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.jsp;
+
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.controller.state.StateControllerContext;
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.controller.state.PageNavigationalStateSerialization;
+import org.jboss.portal.portlet.controller.impl.state.StateControllerContextImpl;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.controller.impl.AbstractPortletControllerContext;
+import org.jboss.portal.web.IllegalRequestException;
+import org.jboss.portal.common.io.Serialization;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PagePortletControllerContext extends AbstractPortletControllerContext
+{
+
+ /** . */
+ private final PageEventControllerContext eventControllerContext;
+
+ /** . */
+ private final StateControllerContext stateControllerContext;
+
+ /** . */
+ private final Serialization<PageNavigationalState> serialization;
+
+ /** . */
+ private final PortalPrepareResponse prepareResponse;
+
+ /** . */
+ private final Map<Key, Portlet> portlets;
+
+ /** . */
+ private final PortletInvoker invoker;
+
+ public PagePortletControllerContext(
+ HttpServletRequest req,
+ HttpServletResponse resp,
+ PortletInvoker invoker,
+ ServletContext servletContext,
+ PortalPrepareResponse prepareResponse)
+ throws IllegalRequestException, IOException, ServletException,
PortletInvokerException
+ {
+ super(req, resp);
+
+ //
+ 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.invoker = invoker;
+ this.portlets = portlets;
+ this.prepareResponse = prepareResponse;
+ this.stateControllerContext = new StateControllerContextImpl(this);
+ this.eventControllerContext = new PageEventControllerContext(this,
prepareResponse);
+ this.serialization = new
PageNavigationalStateSerialization(stateControllerContext);
+ }
+
+ public Portlet findPortlet(String applicationName, String portletName)
+ {
+ return portlets.get(new Key(applicationName, portletName));
+ }
+
+ protected Portlet getPortlet(String windowId) throws PortletInvokerException
+ {
+ WindowDef windowDef = prepareResponse.getWindowDef(windowId);
+
+ //
+ return findPortlet(windowDef.getApplicationName(), windowDef.getPortletName());
+ }
+
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws
PortletInvokerException
+ {
+ return invoker.invoke(invocation);
+ }
+
+ public PageEventControllerContext getEventControllerContext()
+ {
+ return eventControllerContext;
+ }
+
+ public StateControllerContext getStateControllerContext()
+ {
+ return stateControllerContext;
+ }
+
+ public Serialization<PageNavigationalState>
getPageNavigationalStateSerialization()
+ {
+ return serialization;
+ }
+
+ 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/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalPrepareResponse.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalPrepareResponse.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalPrepareResponse.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,261 @@
+/******************************************************************************
+ * 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.jsp;
+
+import org.jboss.portal.portlet.PortletInvokerException;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.ServletOutputStream;
+import javax.xml.namespace.QName;
+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 PortalPrepareResponse extends PortalResponse
+{
+
+ /** . */
+ private String contentType;
+
+ /** . */
+ private Locale locale;
+
+ /** . */
+ private String characterEncoding;
+
+ /** . */
+ private int bufferSize;
+
+ /** . */
+ private ServletOutputStream outputStream;
+
+ /** . */
+ private PrintWriter writer;
+
+ /** . */
+ private Map<String, WindowDef> windowDefs;
+
+ /** . */
+ private Map<QName, PageParameterDef> paramDefs;
+
+ public PortalPrepareResponse(HttpServletRequest request, HttpServletResponse response)
throws PortletInvokerException
+ {
+ super(request, response);
+
+ //
+ this.windowDefs = new HashMap<String, WindowDef>();
+ this.paramDefs = new HashMap<QName, PageParameterDef>();
+ }
+
+ public Set<String> getWindowIds()
+ {
+ return windowDefs.keySet();
+ }
+
+ public WindowDef getWindowDef(String windowId)
+ {
+ return windowDefs.get(windowId);
+ }
+
+ public void addWindowDef(String windowId, WindowDef portlet)
+ {
+ windowDefs.put(windowId, portlet);
+ }
+
+ public Set<QName> getPageParameterNames()
+ {
+ return paramDefs.keySet();
+ }
+
+ public PageParameterDef getPageParameterDef(QName name)
+ {
+ return paramDefs.get(name);
+ }
+
+ public void setPageParameterDef(PageParameterDef parameterDef)
+ {
+ paramDefs.put(parameterDef.getName(), parameterDef);
+ }
+
+ 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;
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalRenderResponse.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalRenderResponse.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalRenderResponse.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,246 @@
+/******************************************************************************
+ * 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.jsp;
+
+import org.jboss.portal.portlet.controller.impl.AbstractPortletControllerContext;
+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.impl.spi.AbstractInstanceContext;
+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.HttpServletRequest;
+import javax.xml.namespace.QName;
+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 PortalRenderResponse extends PortalResponse
+{
+
+ /** . */
+ private PageNavigationalState pageNavigationalState;
+
+ /** . */
+ private PagePortletControllerContext portletControllerContext;
+
+ /** . */
+ private Map<String, WindowResult> windowResults;
+
+ public PortalRenderResponse(
+ HttpServletRequest request,
+ HttpServletResponse response,
+ PagePortletControllerContext portletControllerContext,
+ PageNavigationalState pageNavigationalState,
+ PortalPrepareResponse prepareResponse) throws PortletInvokerException
+ {
+ super(request, response);
+
+ //
+ Set<QName> pageParameterNames = prepareResponse.getPageParameterNames();
+ if (pageParameterNames.size() > 0)
+ {
+ if (pageNavigationalState == null)
+ {
+ pageNavigationalState =
portletControllerContext.getStateControllerContext().createPageNavigationalState(true);
+ }
+ for (QName parameterName : pageParameterNames)
+ {
+ PageParameterDef parameterDef =
prepareResponse.getPageParameterDef(parameterName);
+ boolean update = parameterDef.isFrozen() ? true :
pageNavigationalState.getPublicNavigationalState(parameterName) == null;
+ if (update)
+ {
+ pageNavigationalState.setPublicNavigationalState(parameterName, new
String[]{parameterDef.getValue()});
+ }
+ }
+ }
+
+ //
+ this.portletControllerContext = portletControllerContext;
+ this.windowResults = new HashMap<String, WindowResult>();
+ this.pageNavigationalState = pageNavigationalState;
+
+ //
+ render(prepareResponse);
+ }
+
+ /**
+ * The page state for the rendering.
+ *
+ * @return the page state
+ */
+ public PageNavigationalState getPageNavigationalState()
+ {
+ return pageNavigationalState;
+ }
+
+ public Set<String> getWindowIds()
+ {
+ return windowResults.keySet();
+ }
+
+ public WindowResult getWindowResult(String windowId)
+ {
+ return windowResults.get(windowId);
+ }
+
+ public PagePortletControllerContext getPortletControllerContext()
+ {
+ return portletControllerContext;
+ }
+
+ private PortletInvocationResponse render(Portlet portlet, String windowId) throws
PortletInvokerException
+ {
+ WindowNavigationalState windowNS = null;
+ if (pageNavigationalState != null)
+ {
+ windowNS = pageNavigationalState.getWindowNavigationalState(windowId);
+ }
+
+ //
+ ParameterMap publicNS = null;
+ if (pageNavigationalState != null)
+ {
+ publicNS = pageNavigationalState.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, pageNavigationalState);
+ RenderInvocation render = new RenderInvocation(renderContext);
+ render.setClientContext(new
AbstractClientContext(portletControllerContext.getClientRequest()));
+ render.setServerContext(new
AbstractServerContext(portletControllerContext.getClientRequest(),
portletControllerContext.getClientResponse()));
+ render.setInstanceContext(new
AbstractInstanceContext(portlet.getContext().getId()));
+ render.setUserContext(new
AbstractUserContext(portletControllerContext.getClientRequest()));
+ render.setWindowContext(new AbstractWindowContext(windowId));
+ render.setPortalContext(AbstractPortletControllerContext.PORTAL_CONTEXT);
+ render.setSecurityContext(new
AbstractSecurityContext(portletControllerContext.getClientRequest()));
+ render.setTarget(portlet.getContext());
+ render.setMode(mode);
+ render.setWindowState(windowState);
+ render.setNavigationalState(portletNS);
+ render.setPublicNavigationalState(publicNS);
+
+ //
+ return portletControllerContext.invoke(render);
+ }
+
+ private void render(PortalPrepareResponse prepareResponse)
+ {
+ for (String windowId : prepareResponse.getWindowIds())
+ {
+ WindowDef windowDef = prepareResponse.getWindowDef(windowId);
+
+ //
+ try
+ {
+ Portlet portlet = portletControllerContext.getPortlet(windowId);
+
+ //
+ if (portlet != null)
+ {
+ PortletInvocationResponse portletResponse = render(portlet, windowId);
+
+ //
+ WindowResult result = new WindowResult(windowDef, portletResponse);
+
+ //
+ windowResults.put(windowId, result);
+ }
+ else
+ {
+ // log
+ }
+ }
+ catch (PortletInvokerException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public boolean isMaximizedWindow(String windowId)
+ {
+ if (windowId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return windowId.equals(getMaximizedWindowId());
+ }
+
+ public String getMaximizedWindowId()
+ {
+ if (pageNavigationalState != null)
+ {
+ for (String windowId : pageNavigationalState.getWindowIds())
+ {
+ WindowNavigationalState windowNS =
pageNavigationalState.getWindowNavigationalState(windowId);
+ if (WindowState.MAXIMIZED.equals(windowNS.getWindowState()))
+ {
+ return windowId;
+ }
+ }
+ }
+
+ //
+ return null;
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalResponse.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalResponse.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/PortalResponse.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,66 @@
+/******************************************************************************
+ * 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.jsp;
+
+import org.jboss.portal.portlet.PortletInvokerException;
+
+import javax.servlet.http.HttpServletResponseWrapper;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * Expose stuff common to action and render response.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortalResponse extends HttpServletResponseWrapper
+{
+
+ /** . */
+ private int count = 0;
+
+ /** . */
+ private final String pageId;
+
+ public PortalResponse(HttpServletRequest request, HttpServletResponse response) throws
PortletInvokerException
+ {
+ super(response);
+
+ // We don't keep a ref to the request since this will be used mainly during in
a dispatch to a JSP
+ // and the info returned by a request after a dispatch are not the same than before
(like the path info).
+ String pageId = request.getRequestURI();
+
+ //
+ this.pageId = pageId;
+ }
+
+ /**
+ * 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 pageId + "/" + count++;
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/WindowDef.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/WindowDef.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/WindowDef.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,103 @@
+/******************************************************************************
+ * 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.jsp;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+
+import java.util.Set;
+
+/**
+ * Combines the invocation of a portlet and the info on the portlet JSP tag. It does
+ * not need to be exposed out of this package.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class WindowDef
+{
+
+ /** . */
+ private final String portletName;
+
+ /** . */
+ private final String applicationName;
+
+ /** . */
+ private final String windowId;
+
+ /** . */
+ private final Mode initialMode;
+
+ /** . */
+ private final Set<Mode> supportedModes;
+
+ /** . */
+ private final Set<WindowState> supportedWindowStates;
+
+ public WindowDef(
+ String portletName,
+ String applicationName,
+ String windowId,
+ Mode initialMode,
+ Set<Mode> supportedModes,
+ Set<WindowState> supportedWindowStates)
+ {
+ this.portletName = portletName;
+ this.applicationName = applicationName;
+ this.windowId = windowId;
+ this.initialMode = initialMode;
+ this.supportedModes = supportedModes;
+ this.supportedWindowStates = supportedWindowStates;
+ }
+
+ public String getPortletName()
+ {
+ return portletName;
+ }
+
+ public String getApplicationName()
+ {
+ return applicationName;
+ }
+
+ public String getWindowId()
+ {
+ return windowId;
+ }
+
+ public Mode getInitialMode()
+ {
+ return initialMode;
+ }
+
+ public Set<Mode> getSupportedModes()
+ {
+ return supportedModes;
+ }
+
+ public Set<WindowState> getSupportedWindowStates()
+ {
+ return supportedWindowStates;
+ }
+}
\ No newline at end of file
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/WindowResult.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/WindowResult.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/WindowResult.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * 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.jsp;
+
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.portal.jsp.WindowDef;
+
+/**
+ * Combines the invocation of a portlet and the info on the portlet JSP tag. It does
+ * not need to be exposed out of this package.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class WindowResult
+{
+
+ /** . */
+ private final WindowDef windowDef;
+
+ /** . */
+ private final PortletInvocationResponse response;
+
+ public WindowResult(WindowDef windowDef, PortletInvocationResponse response)
+ {
+ this.windowDef = windowDef;
+ this.response = response;
+ }
+
+ public WindowDef getWindowDef()
+ {
+ return windowDef;
+ }
+
+ public PortletInvocationResponse getResponse()
+ {
+ return response;
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/AbstractURLTag.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/AbstractURLTag.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/AbstractURLTag.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * 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.jsp.taglib;
+
+import javax.servlet.jsp.JspException;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class AbstractURLTag extends PortalBodyTagSupport
+{
+
+ /** . */
+ protected Map<String, String[]> params = new HashMap<String, String[]>();
+
+ public void setParam(String name, String value)
+ {
+ params.put(name, new String[]{value});
+ }
+
+ public void doInitBody() throws JspException
+ {
+ params.clear();
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/Constants.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/Constants.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/Constants.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * 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.jsp.taglib;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+final class Constants
+{
+
+ private Constants()
+ {
+ }
+
+ /** . */
+ public static final String ERROR_STATUS =
"org.jboss.portal.portlet.portal.error.status";
+
+ /** . */
+ public static final String ERROR_CAUSE =
"org.jboss.portal.portlet.portal.error.cause";
+
+ /** . */
+ public static final String ERROR_MESSAGE =
"org.jboss.portal.portlet.portal.error.message";
+
+ /** . */
+ public static final String ERROR_PORTLET_NAME =
"org.jboss.portal.portlet.portal.error.portlet_name";
+
+ /** . */
+ public static final String ERROR_APPLICATION_NAME =
"org.jboss.portal.portlet.portal.error.application_name";
+
+ /** . */
+ public static final String ERROR_WINDOW_ID =
"org.jboss.portal.portlet.portal.error.window_id";
+
+ /** . */
+ public static final String NOT_FOUND = "not_found";
+
+ /** . */
+ public static final String PORTLET_ERROR = "portlet_error";
+
+ /** . */
+ public static final String INTERNAL_ERROR = "internal_error";
+
+ /** . */
+ public static final String UNAVAILABLE = "unavailable";
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/HeadersTag.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/HeadersTag.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/HeadersTag.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,105 @@
+/******************************************************************************
+ * 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.jsp.taglib;
+
+import org.jboss.portal.portlet.portal.jsp.PortalRenderResponse;
+import org.jboss.portal.portlet.portal.jsp.WindowResult;
+import org.jboss.portal.portlet.portal.jsp.PortalPrepareResponse;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.ResponseProperties;
+import org.jboss.portal.portlet.invocation.response.ContentResponse;
+import org.jboss.portal.common.util.MultiValuedPropertyMap;
+import org.jboss.portal.common.xml.XMLTools;
+import org.w3c.dom.Element;
+
+import javax.servlet.jsp.JspException;
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class HeadersTag extends PortalSimpleTagSupport
+{
+
+ public HeadersTag()
+ {
+ super(false);
+ }
+
+ public void doTag(PortalPrepareResponse prepareResponse) throws JspException,
IOException
+ {
+ }
+
+ public void doTag(PortalRenderResponse renderResponse) throws JspException,
IOException
+ {
+ String maxmizedWindowId = renderResponse.getMaximizedWindowId();
+
+ //
+ for (String windowId : renderResponse.getWindowIds())
+ {
+ if (maxmizedWindowId == null || maxmizedWindowId.equals(windowId))
+ {
+ WindowResult result = renderResponse.getWindowResult(windowId);
+
+ //
+ if (result != null)
+ {
+ PortletInvocationResponse response = result.getResponse();
+
+ //
+ if (response instanceof ContentResponse)
+ {
+ ContentResponse fragmentResponse = (ContentResponse)response;
+
+ //
+ ResponseProperties properties = fragmentResponse.getProperties();
+
+ //
+ if (properties != null)
+ {
+ MultiValuedPropertyMap<Element> markupHeaders =
properties.getMarkupHeaders();
+ for (String key : markupHeaders.keySet())
+ {
+ List<Element> headElement = markupHeaders.getValues(key);
+ for (Element headerValue : headElement)
+ {
+ try
+ {
+ String serializedElement = XMLTools.toString(headerValue);
+ getJspContext().getOut().print(serializedElement);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/JspWriterResponse.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/JspWriterResponse.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/JspWriterResponse.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * 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.jsp.taglib;
+
+import org.jboss.portal.portlet.portal.jsp.PortalRenderResponse;
+
+import javax.servlet.http.HttpServletResponseWrapper;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.ServletOutputStream;
+import java.io.PrintWriter;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+class JspWriterResponse extends HttpServletResponseWrapper
+{
+
+ /** . */
+ private final JspWriter delegate;
+
+ /** . */
+ private final PrintWriter writer;
+
+ public JspWriterResponse(PortalRenderResponse renderResponse, JspWriter delegate)
+ {
+ super(renderResponse);
+
+ //
+ this.delegate = delegate;
+ this.writer = new PrintWriter(delegate);
+ }
+
+ public PrintWriter getWriter() throws IOException
+ {
+ return writer;
+ }
+
+ public ServletOutputStream getOutputStream() throws IOException
+ {
+ throw new IllegalArgumentException();
+ }
+
+ public void resetBuffer()
+ {
+ try
+ {
+ delegate.clearBuffer();
+ }
+ catch (IOException ignore)
+ {
+ }
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PageParamTag.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PageParamTag.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PageParamTag.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,103 @@
+/******************************************************************************
+ * 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.jsp.taglib;
+
+import org.jboss.portal.portlet.portal.jsp.PortalRenderResponse;
+import org.jboss.portal.portlet.portal.jsp.PortalPrepareResponse;
+import org.jboss.portal.portlet.portal.jsp.PageParameterDef;
+
+import javax.servlet.jsp.JspException;
+import javax.xml.namespace.QName;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PageParamTag extends PortalSimpleTagSupport
+{
+
+ /** . */
+ private String namespaceURIAttr;
+
+ /** . */
+ private String localNameAttr;
+
+ /** . */
+ private String valueAttr;
+
+ /** . */
+ private String frozenAttr;
+
+ public String getNamespaceURI()
+ {
+ return namespaceURIAttr;
+ }
+
+ public void setNamespaceURI(String namespaceURI)
+ {
+ this.namespaceURIAttr = namespaceURI;
+ }
+
+ public String getLocalName()
+ {
+ return localNameAttr;
+ }
+
+ public void setLocalName(String localName)
+ {
+ this.localNameAttr = localName;
+ }
+
+ public String getValue()
+ {
+ return valueAttr;
+ }
+
+ public void setValue(String value)
+ {
+ this.valueAttr = value;
+ }
+
+ public String getFrozen()
+ {
+ return frozenAttr;
+ }
+
+ public void setFrozen(String frozen)
+ {
+ this.frozenAttr = frozen;
+ }
+
+ public void doTag(PortalRenderResponse renderResponse) throws JspException,
IOException
+ {
+ }
+
+ public void doTag(PortalPrepareResponse prepareResponse) throws JspException,
IOException
+ {
+ QName name = new QName(namespaceURIAttr, localNameAttr);
+ boolean frozen = "true".equals(frozenAttr);
+ PageParameterDef parameterDef = new PageParameterDef(name, valueAttr, frozen);
+ prepareResponse.setPageParameterDef(parameterDef);
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PageTag.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PageTag.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PageTag.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,99 @@
+/******************************************************************************
+ * 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.jsp.taglib;
+
+import org.jboss.portal.portlet.portal.jsp.PortalRenderResponse;
+import org.jboss.portal.portlet.portal.jsp.PortalPrepareResponse;
+
+import javax.servlet.jsp.JspException;
+import javax.xml.namespace.QName;
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PageTag extends PortalBodyTagSupport
+{
+
+ enum Status
+ {
+ ACTIVE, SUSPENDED
+ }
+
+ /** . */
+ Map<QName, String> params;
+
+ /** . */
+ String maximizedId;
+
+ /** . */
+ String content;
+
+ /** . */
+ Status status = Status.ACTIVE;
+
+ public int doStartTag(PortalRenderResponse renderResponse) throws JspException
+ {
+ maximizedId = renderResponse.getMaximizedWindowId();
+
+ //
+ if (maximizedId != null)
+ {
+ return EVAL_BODY_BUFFERED;
+ }
+ else
+ {
+ return EVAL_BODY_INCLUDE;
+ }
+ }
+
+ public int doEndTag(PortalRenderResponse renderResponse) throws JspException
+ {
+ if (maximizedId != null)
+ {
+ try
+ {
+ pageContext.getOut().write(content);
+ }
+ catch (IOException e)
+ {
+ throw new JspException(e);
+ }
+ }
+
+ //
+ return EVAL_PAGE;
+ }
+
+ public int doStartTag(PortalPrepareResponse portalResponse) throws JspException
+ {
+ return EVAL_BODY_INCLUDE;
+ }
+
+ public int doEndTag(PortalPrepareResponse portalResponse) throws JspException
+ {
+ return EVAL_PAGE;
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/ParamTag.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/ParamTag.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/ParamTag.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,69 @@
+/******************************************************************************
+ * 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.jsp.taglib;
+
+import org.jboss.portal.portlet.portal.jsp.PortalRenderResponse;
+
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+import javax.servlet.jsp.JspException;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ParamTag extends PortalSimpleTagSupport
+{
+
+ /** . */
+ private String name;
+
+ /** . */
+ private String value;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+ public void doTag(PortalRenderResponse renderResponse) throws JspException,
IOException
+ {
+ AbstractURLTag urlTag =
(AbstractURLTag)SimpleTagSupport.findAncestorWithClass(this, AbstractURLTag.class);
+ urlTag.setParam(name, value);
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortalBodyTagSupport.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortalBodyTagSupport.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortalBodyTagSupport.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,133 @@
+/******************************************************************************
+ * 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.jsp.taglib;
+
+import org.jboss.portal.portlet.portal.jsp.PortalRenderResponse;
+import org.jboss.portal.portlet.portal.jsp.PortalPrepareResponse;
+import org.jboss.portal.portlet.portal.jsp.PortalResponse;
+import org.jboss.portal.common.NotYetImplemented;
+
+import javax.servlet.jsp.tagext.BodyTagSupport;
+import javax.servlet.jsp.JspException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortalBodyTagSupport extends BodyTagSupport
+{
+
+ private PortalResponse getPortalResponse()
+ {
+ return (PortalResponse)pageContext.getResponse();
+ }
+
+ 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
+ {
+ if (portalResponse instanceof PortalPrepareResponse)
+ {
+ return doStartTag((PortalPrepareResponse)portalResponse);
+ }
+ else
+ {
+ return doStartTag((PortalRenderResponse)portalResponse);
+ }
+ }
+ }
+
+ 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)
+ {
+ if (portalResponse instanceof PortalPrepareResponse)
+ {
+ return doEndTag((PortalPrepareResponse)portalResponse);
+ }
+ else
+ {
+ return doEndTag((PortalRenderResponse)portalResponse);
+ }
+ }
+ else
+ {
+ return EVAL_PAGE;
+ }
+ }
+
+ public int doStartTag(PortalPrepareResponse prepareResponse) throws JspException
+ {
+ throw new NotYetImplemented();
+ }
+
+ public int doEndTag(PortalPrepareResponse prepareResponse) throws JspException
+ {
+ throw new NotYetImplemented();
+ }
+
+ public int doStartTag(PortalRenderResponse renderResponse) throws JspException
+ {
+ throw new NotYetImplemented();
+ }
+
+ public int doEndTag(PortalRenderResponse renderResponse) throws JspException
+ {
+ throw new NotYetImplemented();
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortalSimpleTagSupport.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortalSimpleTagSupport.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortalSimpleTagSupport.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,107 @@
+/******************************************************************************
+ * 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.jsp.taglib;
+
+import org.jboss.portal.portlet.portal.jsp.PortalRenderResponse;
+import org.jboss.portal.portlet.portal.jsp.PortalResponse;
+import org.jboss.portal.portlet.portal.jsp.PortalPrepareResponse;
+import org.jboss.portal.common.NotYetImplemented;
+
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.JspException;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortalSimpleTagSupport extends SimpleTagSupport
+{
+
+ private final boolean pageScoped;
+
+ public PortalSimpleTagSupport()
+ {
+ this(true);
+ }
+
+ public PortalSimpleTagSupport(boolean pageScoped)
+ {
+ this.pageScoped = pageScoped;
+ }
+
+ public boolean isPageScoped()
+ {
+ return pageScoped;
+ }
+
+ private PortalResponse getPortalResponse()
+ {
+ PageContext pageContext = (PageContext)getJspContext();
+ return (PortalResponse)pageContext.getResponse();
+ }
+
+ protected final boolean isActive()
+ {
+ if (pageScoped)
+ {
+ PageTag pageTag = (PageTag)findAncestorWithClass(this, PageTag.class);
+
+ //
+ return pageTag != null && pageTag.status == PageTag.Status.ACTIVE;
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+ public final void doTag() throws JspException, IOException
+ {
+ if (isActive())
+ {
+ PortalResponse portalResponse = getPortalResponse();
+
+ //
+ if (portalResponse instanceof PortalPrepareResponse)
+ {
+ doTag((PortalPrepareResponse)portalResponse);
+ }
+ else
+ {
+ doTag((PortalRenderResponse)portalResponse);
+ }
+ }
+ }
+
+ public void doTag(PortalPrepareResponse prepareResponse) throws JspException,
IOException
+ {
+ throw new NotYetImplemented();
+ }
+
+ public void doTag(PortalRenderResponse renderResponse) throws JspException,
IOException
+ {
+ throw new NotYetImplemented();
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletMarkupTag.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletMarkupTag.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletMarkupTag.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,90 @@
+/******************************************************************************
+ * 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.jsp.taglib;
+
+import org.jboss.portal.portlet.portal.jsp.PortalRenderResponse;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.ContentResponse;
+import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
+import org.jboss.portal.WindowState;
+
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletMarkupTag extends PortalSimpleTagSupport
+{
+ public void doTag(PortalRenderResponse renderResponse) throws JspException,
IOException
+ {
+ PortletTag portletTag = (PortletTag)SimpleTagSupport.findAncestorWithClass(this,
PortletTag.class);
+
+ PortletInvocationResponse portletResp = portletTag.result.getResponse();
+
+ JspWriter out = getJspContext().getOut();
+
+ if (portletResp != null)
+ {
+ if (portletResp instanceof ContentResponse)
+ {
+ ContentResponse fragment = (ContentResponse)portletResp;
+ WindowNavigationalState windowNS = null;
+ if (renderResponse.getPageNavigationalState() != null)
+ {
+ windowNS =
renderResponse.getPageNavigationalState().getWindowNavigationalState(portletTag.result.getWindowDef().getWindowId());
+ }
+ if (windowNS == null ||
!windowNS.getWindowState().equals(WindowState.MINIMIZED))
+ {
+ if (fragment.getType() != ContentResponse.TYPE_EMPTY)
+ {
+ String frag;
+ if (fragment.getType() == ContentResponse.TYPE_BYTES)
+ {
+ frag = fragment.getBytes().toString();
+ }
+ else
+ {
+ frag = fragment.getChars();
+ }
+
+ out.write(frag);
+ }
+ }
+ }
+ else
+ {
+ out.write(portletResp.getClass().getSimpleName() + "[" +
portletTag.result.getWindowDef().getPortletName() + "," +
portletTag.result.getWindowDef().getApplicationName() + "]");
+ out.flush();
+ }
+ }
+ else
+ {
+ out.write("Empty[" + portletTag.result.getWindowDef().getPortletName()
+ "," + portletTag.result.getWindowDef().getApplicationName() + "]");
+ out.flush();
+ }
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletTag.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletTag.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletTag.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,360 @@
+/******************************************************************************
+ * 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.jsp.taglib;
+
+import org.jboss.portal.portlet.portal.jsp.PortalRenderResponse;
+import org.jboss.portal.portlet.portal.jsp.PortalPrepareResponse;
+import org.jboss.portal.portlet.portal.jsp.PortalResponse;
+import org.jboss.portal.portlet.portal.jsp.WindowDef;
+import org.jboss.portal.portlet.portal.jsp.WindowResult;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.ErrorResponse;
+import org.jboss.portal.portlet.invocation.response.UnavailableResponse;
+import org.jboss.portal.portlet.invocation.response.ContentResponse;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.util.Tools;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import java.util.Collections;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletTag extends PortalBodyTagSupport
+{
+
+ /** . */
+ private static final Set<Mode> DEFAULT_MODES =
Collections.unmodifiableSet(Tools.toSet(Mode.VIEW, Mode.EDIT, Mode.HELP));
+
+ /** . */
+ private static final Set<WindowState> DEFAULT_WINDOW_STATES =
Collections.unmodifiableSet(Tools.toSet(WindowState.NORMAL, WindowState.MAXIMIZED,
WindowState.MINIMIZED));
+
+ /** . */
+ private String nameAttr;
+
+ /** . */
+ private String applicationNameAttr;
+
+ /** . */
+ private String supportedWindowStatesAttr;
+
+ /** . */
+ private String supportedModesAttr;
+
+ /** . */
+ private String initialModeAttr;
+
+ /** . */
+ private String errorPageAttr;
+
+ private Set<WindowState> supportedWindowStates;
+ private Set<Mode> supportedModes;
+ private Mode initialMode;
+ private PageTag pageTag;
+ private String windowId;
+
+ WindowResult result;
+
+ public String getName()
+ {
+ return nameAttr;
+ }
+
+ public void setName(String name)
+ {
+ this.nameAttr = name;
+ }
+
+ public String getApplicationName()
+ {
+ return applicationNameAttr;
+ }
+
+ public void setApplicationName(String applicationName)
+ {
+ this.applicationNameAttr = applicationName;
+ }
+
+ public String getSupportedWindowStates()
+ {
+ return supportedWindowStatesAttr;
+ }
+
+ public void setSupportedWindowStates(String supportedWindowStates)
+ {
+ this.supportedWindowStatesAttr = supportedWindowStates;
+ }
+
+ public String getSupportedModes()
+ {
+ return supportedModesAttr;
+ }
+
+ public void setSupportedModes(String supportedModes)
+ {
+ this.supportedModesAttr = supportedModes;
+ }
+
+ public String getInitialMode()
+ {
+ return initialModeAttr;
+ }
+
+ public void setInitialMode(String initialMode)
+ {
+ this.initialModeAttr = initialMode;
+ }
+
+ public String getErrorPage()
+ {
+ return errorPageAttr;
+ }
+
+ public void setErrorPage(String errorPage)
+ {
+ this.errorPageAttr = errorPage;
+ }
+
+ private void initState(PortalResponse portalResponse)
+ {
+ //
+ Set<Mode> supportedModes = new LinkedHashSet<Mode>();
+ if (supportedModesAttr != null)
+ {
+ for (String supportedModeValue : supportedModesAttr.split(","))
+ {
+ Mode mode = Mode.create(supportedModeValue.trim());
+ supportedModes.add(mode);
+ }
+ }
+ else
+ {
+ supportedModes = DEFAULT_MODES;
+ }
+
+ //
+ Set<WindowState> supportedWindowStates = new
LinkedHashSet<WindowState>();
+ if (supportedWindowStatesAttr != null)
+ {
+ for (String supportedWindowStateValue :
supportedWindowStatesAttr.split(","))
+ {
+ WindowState windowState =
WindowState.create(supportedWindowStateValue.trim());
+ supportedWindowStates.add(windowState);
+ }
+ }
+ else
+ {
+ supportedWindowStates = DEFAULT_WINDOW_STATES;
+ }
+
+ //
+ Mode initialMode = Mode.VIEW;
+ if (initialModeAttr != null)
+ {
+ initialMode = Mode.create(initialModeAttr.trim());
+ }
+
+ //
+ String windowId = portalResponse.nextId();
+
+ //
+ this.initialMode = initialMode;
+ this.supportedModes = supportedModes;
+ this.supportedWindowStates = supportedWindowStates;
+ this.pageTag = (PageTag)findAncestorWithClass(this, PageTag.class);
+ this.windowId = windowId;
+ }
+
+ private void destroyState()
+ {
+ this.initialMode = null;
+ this.supportedModes = null;
+ this.supportedWindowStates = null;
+ this.pageTag = null;
+ this.windowId = null;
+ }
+
+ public int doStartTag(PortalPrepareResponse prepareResponse) throws JspException
+ {
+ initState(prepareResponse);
+
+ //
+ WindowDef windowDef = new WindowDef(nameAttr, applicationNameAttr, windowId,
initialMode, supportedModes, supportedWindowStates);
+
+ //
+ prepareResponse.addWindowDef(windowId, windowDef);
+
+ //
+ return SKIP_BODY;
+ }
+
+ public int doEndTag(PortalPrepareResponse prepareResponse) throws JspException
+ {
+ destroyState();
+
+ //
+ return EVAL_PAGE;
+ }
+
+ public int doStartTag(PortalRenderResponse renderResponse) throws JspException
+ {
+ initState(renderResponse);
+
+ //
+ WindowResult result = renderResponse.getWindowResult(windowId);
+
+ //
+ if (result == null || result.getResponse() == null)
+ {
+ handleError(renderResponse, Constants.NOT_FOUND, null, null);
+
+ // We cannot show an absent portlet, no meta data
+ return SKIP_BODY;
+ }
+ else
+ {
+ if (pageTag.maximizedId != null)
+ {
+ if (windowId.equals(pageTag.maximizedId))
+ {
+ return render(renderResponse, result, EVAL_BODY_BUFFERED);
+ }
+ else
+ {
+ return SKIP_BODY;
+ }
+ }
+ else
+ {
+ return render(renderResponse, result, EVAL_BODY_INCLUDE);
+ }
+ }
+ }
+
+ public int doEndTag(PortalRenderResponse renderResponse) throws JspException
+ {
+ if (bodyContent != null)
+ {
+ pageTag.content = bodyContent.getString();
+ }
+
+ //
+ destroyState();
+
+ //
+ return EVAL_PAGE;
+ }
+
+ public int render(PortalRenderResponse renderResponse, WindowResult result, int rt)
+ {
+ PortletInvocationResponse portletResponse = result.getResponse();
+
+ //
+ if (portletResponse instanceof ContentResponse)
+ {
+ this.result = result;
+ //
+ return rt;
+ }
+ else if (portletResponse instanceof ErrorResponse)
+ {
+ ErrorResponse error = (ErrorResponse)portletResponse;
+
+ //
+ handleError(renderResponse, Constants.PORTLET_ERROR, error.getCause(),
error.getMessage());
+
+ //
+ return SKIP_BODY;
+ }
+ else if (portletResponse instanceof UnavailableResponse)
+ {
+ handleError(renderResponse, Constants.UNAVAILABLE, null, null);
+
+ //
+ return SKIP_BODY;
+ }
+ else
+ {
+ handleError(renderResponse, Constants.INTERNAL_ERROR, null, null);
+
+ //
+ return SKIP_BODY;
+ }
+ }
+
+ private void handleError(PortalRenderResponse renderResponse, String errorStatus,
Throwable cause, String message)
+ {
+ if (errorPageAttr != null)
+ {
+ RequestDispatcher rd =
pageContext.getServletContext().getRequestDispatcher(errorPageAttr);
+ if (rd != null)
+ {
+ ServletRequest request= pageContext.getRequest();
+
+ //
+ try
+ {
+ pageTag.status = PageTag.Status.SUSPENDED;
+ request.setAttribute(Constants.ERROR_STATUS, errorStatus);
+ request.setAttribute(Constants.ERROR_CAUSE, cause);
+ request.setAttribute(Constants.ERROR_MESSAGE, message);
+ request.setAttribute(Constants.ERROR_WINDOW_ID, windowId);
+ request.setAttribute(Constants.ERROR_APPLICATION_NAME,
applicationNameAttr);
+ request.setAttribute(Constants.ERROR_PORTLET_NAME, nameAttr);
+
+ //
+ rd.include(pageContext.getRequest(), new JspWriterResponse(renderResponse,
pageContext.getOut()));
+ }
+ catch (ServletException e)
+ {
+ // Shall we do smth else ?
+ e.printStackTrace();
+ }
+ catch (IOException e)
+ {
+ // Shall we do smth else ?
+ e.printStackTrace();
+ }
+ finally
+ {
+ pageTag.status = PageTag.Status.ACTIVE;
+ request.removeAttribute(Constants.ERROR_STATUS);
+ request.removeAttribute(Constants.ERROR_CAUSE);
+ request.removeAttribute(Constants.ERROR_MESSAGE);
+ request.removeAttribute(Constants.ERROR_WINDOW_ID);
+ request.removeAttribute(Constants.ERROR_APPLICATION_NAME);
+ request.removeAttribute(Constants.ERROR_PORTLET_NAME);
+ }
+ }
+ }
+ }
+
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletTitleTag.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletTitleTag.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletTitleTag.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * 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.jsp.taglib;
+
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.portal.jsp.PortalRenderResponse;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletTitleTag extends PortalSimpleTagSupport
+{
+
+ public void doTag(PortalRenderResponse renderResponse) throws JspException,
IOException
+ {
+
+ PortletTag portletTag = (PortletTag)SimpleTagSupport.findAncestorWithClass(this,
PortletTag.class);
+
+ PortletInvocationResponse portletResp = portletTag.result.getResponse();
+
+ JspWriter out = getJspContext().getOut();
+
+ if (portletResp instanceof FragmentResponse)
+ {
+ FragmentResponse fragment = (FragmentResponse)portletResp;
+ out.write(fragment.getTitle());
+ }
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletURLTag.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletURLTag.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/taglib/PortletURLTag.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,145 @@
+/******************************************************************************
+ * 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.jsp.taglib;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.portlet.portal.jsp.PortalRenderResponse;
+import org.jboss.portal.portlet.portal.jsp.PagePortletControllerContext;
+import org.jboss.portal.portlet.controller.impl.PortletURLRenderer;
+import org.jboss.portal.portlet.RenderURL;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.URLFormat;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+import java.util.Map;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletURLTag extends AbstractURLTag
+{
+
+ /** . */
+ private String modeValue;
+
+ /** . */
+ private String windowStateValue;
+
+ public String getMode()
+ {
+ return modeValue;
+ }
+
+ public void setMode(String mode)
+ {
+ this.modeValue = mode;
+ }
+
+ public String getWindowState()
+ {
+ return windowStateValue;
+ }
+
+ public void setWindowState(String windowState)
+ {
+ this.windowStateValue = windowState;
+ }
+
+ public int doStartTag(PortalRenderResponse renderResponse) throws JspException
+ {
+ return EVAL_BODY_BUFFERED;
+ }
+
+ public int doEndTag(PortalRenderResponse renderResponse) throws JspException
+ {
+ PagePortletControllerContext context =
renderResponse.getPortletControllerContext();
+ PortletTag portletTag = (PortletTag)SimpleTagSupport.findAncestorWithClass(this,
PortletTag.class);
+
+ Mode mode = null;
+ if (modeValue != null)
+ {
+ mode = Mode.create(modeValue.trim());
+ }
+
+ //
+ WindowState windowState = null;
+ if (windowStateValue != null)
+ {
+ windowState = WindowState.create(windowStateValue.trim());
+ }
+
+ PortletURLRenderer renderer = new PortletURLRenderer(
+ renderResponse.getPageNavigationalState(),
+ context.getClientRequest(),
+ context.getClientResponse(),
+ context.getPageNavigationalStateSerialization());
+
+ final WindowState ws = windowState;
+ final Mode md = mode;
+
+ RenderURL url = new RenderURL()
+ {
+
+
+ public StateString getNavigationalState()
+ {
+ return null;
+ }
+
+ public Map<String, String[]> getPublicNavigationalStateChanges()
+ {
+ return params;
+ }
+
+ public Mode getMode()
+ {
+ return md;
+ }
+
+ public WindowState getWindowState()
+ {
+ return ws;
+ }
+ };
+
+ try
+ {
+ JspWriter out = pageContext.getOut();
+ String renderedURL =
renderer.renderURL(portletTag.result.getWindowDef().getWindowId(), url, new
URLFormat(null, null, true, null));
+ out.write(renderedURL);
+ }
+ catch (IOException e)
+ {
+ throw new JspException(e);
+ }
+
+ //
+ return EVAL_PAGE;
+ }
+
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleClippingPortlet.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleClippingPortlet.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleClippingPortlet.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,178 @@
+/******************************************************************************
+ * 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;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletPreferences;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.net.URL;
+import java.net.URLConnection;
+
+/**
+ * A simple portlet using Google's search services to extract interesting information
(weather, map, ...) from first
+ * result.
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 9912 $
+ */
+public class GoogleClippingPortlet extends GenericPortlet
+{
+ protected static final String A = "<a";
+ private static final String A_TARGET_BLANK = "<a
target='_blank'";
+ private static final String ZIP = "zipcode";
+ private static final String SAN_FRAN = "94102";
+ private static final String GOOGLE = "http://www.google.com/search?q=";
+
+ @Override
+ protected void doView(RenderRequest renderRequest, RenderResponse renderResponse)
throws PortletException, IOException
+ {
+ String zip = getZipCode(renderRequest);
+
+ String query = getQueryString(zip);
+
+ URL url = new URL(query);
+
+ URLConnection connection = url.openConnection();
+ connection.setRequestProperty("User-Agent", "Mozilla/5.0");
+
+ BufferedInputStream in = new BufferedInputStream(connection.getInputStream());
+ String html = new String(getBytes(in, 16384), "UTF-8");
+ in.close();
+
+ String beg = "<div class=e>";
+ String end = "</table>";
+ int begIndex = html.indexOf(beg);
+ if (begIndex != -1)
+ {
+ // extract table containing specific first result
+ int endIndex = html.indexOf(end, begIndex);
+ html = html.substring(begIndex + beg.length(), endIndex + end.length());
+
+ html = postProcessHTML(html);
+
+ renderResponse.setContentType("text/html");
+ PrintWriter printWriter = renderResponse.getWriter();
+ printWriter.print(html);
+ }
+ }
+
+ protected String getZipCode(RenderRequest renderRequest)
+ {
+ String zip = renderRequest.getParameter(ZIP);
+ if (zip == null)
+ {
+ zip = renderRequest.getPreferences().getValue(ZIP, SAN_FRAN);
+ }
+ return zip;
+ }
+
+ @Override
+ protected void doEdit(RenderRequest renderRequest, RenderResponse renderResponse)
throws PortletException, IOException
+ {
+ renderResponse.setContentType("text/html");
+ renderResponse.getWriter().print(
+ "<div align='center'>\n" +
+ " <br/>\n" +
+ " <font class='portlet-font'>Change
Location:</font>\n" +
+ "\n" +
+ " <form method='post' action='" +
renderResponse.createActionURL() + "'\n" +
+ " <font class='portlet-font'>Zip
Code:</font><br/>\n" +
+ " <input class='portlet-form-input-field'
type='text' value='' size='12' name='" + ZIP +
"'/>\n" +
+ " <br/>\n" +
+ " <input class='portlet-form-input-field'
type='submit' name='submit' value='submit'>\n" +
+ " </form>\n" +
+ "</div>");
+ }
+
+ @Override
+ public void processAction(ActionRequest actionRequest, ActionResponse actionResponse)
throws PortletException, IOException
+ {
+ String zip = actionRequest.getParameter(ZIP);
+
+ if (null != zip)
+ {
+ PortletPreferences prefs = actionRequest.getPreferences();
+ prefs.setValue(ZIP, zip);
+ prefs.store();
+ }
+
+ // set zip as render parameter
+ actionResponse.setRenderParameter(ZIP, zip);
+
+ // request view
+ actionResponse.setPortletMode(PortletMode.VIEW);
+ }
+
+ protected String postProcessHTML(String html)
+ {
+ // links should open in new windows
+ html = html.replaceAll(A, A_TARGET_BLANK);
+
+ // src attributes should be absolute
+ html = html.replaceAll("src=/", "src=http://google.com/");
+ html = html.replaceAll("src=\"/",
"src=\"http://google.com/");
+
+ // forms should open in new windows and have an absolute action URL
+ html = html.replaceAll("action=\"/", "target='_blank'
action=\"http://google.com/");
+
+ return html;
+ }
+
+ protected String getQueryString(String zip)
+ {
+ return GOOGLE + zip;
+ }
+
+ private byte[] getBytes(InputStream in, int bufferSize) throws IOException,
IllegalArgumentException
+ {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ byte[] buffer = new byte[bufferSize];
+ while (true)
+ {
+ int i = in.read(buffer);
+ if (i == 0)
+ {
+ continue;
+ }
+ if (i == -1)
+ {
+ break;
+ }
+ out.write(buffer, 0, i);
+ }
+ return out.toByteArray();
+ }
+
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleWeatherClippingPortlet.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleWeatherClippingPortlet.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/GoogleWeatherClippingPortlet.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * 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;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 9912 $
+ */
+public class GoogleWeatherClippingPortlet extends GoogleClippingPortlet
+{
+ private final static String WEATHER_URL =
"http://www.google.com/search?q=weather+";
+ private static final String A_END = "</a>";
+
+ protected String getQueryString(String zip)
+ {
+ return WEATHER_URL + zip;
+ }
+
+ protected String postProcessHTML(String html)
+ {
+ int begIndex;
+ int endIndex;
+
+ // remove add to iGoogle link
+ begIndex = html.indexOf(A);
+ if (begIndex != -1)
+ {
+ endIndex = html.indexOf(A_END, begIndex);
+ html = html.substring(0, begIndex) + html.substring(endIndex + A_END.length());
+ }
+
+ return super.postProcessHTML(html);
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/RemoteControlResourcePortlet.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/RemoteControlResourcePortlet.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/RemoteControlResourcePortlet.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2008, Your Corporation. All Rights Reserved.
+ */
+
+package org.jboss.portal.portlet.portal.samples;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.portlet.ResourceURL;
+import javax.portlet.WindowState;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 9979 $
+ */
+public class RemoteControlResourcePortlet extends GenericPortlet
+{
+ private static final String ZIPCODE = "zipcode";
+
+ @Override
+ protected void doView(RenderRequest renderRequest, RenderResponse renderResponse)
throws PortletException, IOException
+ {
+ renderResponse.setContentType("text/html");
+ PrintWriter printWriter = renderResponse.getWriter();
+ String namespace = renderResponse.getNamespace();
+ printWriter.print("<script type='text/javascript'>function
" + namespace
+ + "_openRemote(url){window.name='" + namespace +
"_parent';window.open(url, '" + namespace
+ + "_remote',
'width=400,height=200,scrollable=yes')}</script>");
+ printWriter.print("<p><a href='#' onclick=\"" +
namespace + "_openRemote('");
+ ResourceURL resource = renderResponse.createResourceURL();
+ printWriter.print(resource);
+ printWriter.print("')\">Open remote
control!</a></p>");
+ }
+
+ @Override
+ public void serveResource(ResourceRequest resourceRequest, ResourceResponse
resourceResponse) throws PortletException, IOException
+ {
+ resourceResponse.setContentType("text/html");
+ PrintWriter writer = resourceResponse.getWriter();
+ String namespace = resourceResponse.getNamespace();
+ writer.print("<html><head><script
type='text/javascript'>function
openLinkInParent(url){window.open(url,'"
+ + namespace + "_parent');}</script>\n<link
rel=\"stylesheet\" href='/simple-portal/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=\"/simple-portal/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=\"/simple-portal/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=\"/simple-portal/images/icon-normal.gif\" alt=\"\"/> make
parent portlet normal</a></li></ul>");
+
writer.print("<br/><ul><li><b>'zipcode'</b>
public render parameter value: " + resourceRequest.getParameter(ZIPCODE) +
"<br/>");
+ 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>");
+ }
+
+ private String createParentURL(PortletURL url)
+ {
+ return "openLinkInParent('" + url + "')";
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/ExceptionPortlet.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/ExceptionPortlet.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/ExceptionPortlet.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -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();
+ }
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/FailDuringInitPortlet.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/FailDuringInitPortlet.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/FailDuringInitPortlet.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * 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.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * A portlet that will fail only one time during startup (so it is possible to restart
it).
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class FailDuringInitPortlet extends GenericPortlet
+{
+
+ private static int initCount = 0;
+
+ public void init() throws PortletException
+ {
+ if (initCount == 0)
+ {
+ initCount = 1;
+
+ //
+ throw new PortletException();
+ }
+ else
+ {
+ // Nothing
+ }
+ }
+
+ protected void doView(RenderRequest renderRequest, RenderResponse renderResponse)
throws PortletException, IOException
+ {
+ renderResponse.setContentType("text/html");
+ PrintWriter writer = renderResponse.getWriter();
+ writer.print("A portlet that may fail during init");
+ writer.close();
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/HeaderPortlet.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/HeaderPortlet.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/HeaderPortlet.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,189 @@
+/******************************************************************************
+ * 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 org.w3c.dom.Element;
+import org.jboss.portal.portlet.ActionURL;
+import org.jboss.portal.portlet.RenderURL;
+
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import javax.portlet.ResourceURL;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletURL;
+import javax.portlet.PortletPreferences;
+import javax.portlet.PortletMode;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class HeaderPortlet extends GenericPortlet
+{
+ public final static int TITANIUM = 0;
+ public final static int PLATINUM = 1;
+ public final static int GOLD = 2;
+ public final static int SILVER = 3;
+ public final static int TIN = 4;
+
+ public void processAction(ActionRequest req, ActionResponse resp) throws
PortletException, PortletSecurityException, IOException
+ {
+
+ String repeatText = req.getParameter("repeat");
+ // set zip as render parameter
+ if (repeatText != null){
+ resp.setRenderParameter("repeat", repeatText);
+ }
+ // request view
+ resp.setPortletMode(PortletMode.VIEW);
+
+ }
+ public void render(RenderRequest req, RenderResponse resp) throws PortletException,
IOException
+ {
+ ResourceURL resourceURL = resp.createResourceURL();
+ PortletURL actionURL = resp.createActionURL();
+ //
+// Element elt = resp.createElement("script");
+// elt.setAttribute("type", "text/javascript");
+// elt.setAttribute("src", resourceURL.toString());
+// elt.appendChild(elt.getOwnerDocument().createTextNode(""));
+// resp.addProperty("script", elt);
+
+ //
+
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+ writer.print("" +
+ "<script type=\"text/javascript\">" +
+ "" +
+ // "function init(){\n" +
+ //" Event.observe('repeat', 'keyup', repeat(),
false);\n" +
+ // "}" +
+ "" +
+ "function browse(id) {" +
+ "var url = id;\n" +
+ "var pars = 'foo=bar';\n" +
+ "var target = 'output-div';\n" +
+ "var myAjax = new Ajax.Updater(target, url, {method: 'GET',
parameters: pars});" +
+ "}" +
+
+ "</script>");
+
+ writer.print("" +
+ "<div class='full-width'
style='padding:5px'>" +
+ "<h4>Partial Refresh Repeater Demo</h4>");
+ writer.print("" +
+ " <div class='half-width float-left'>" +
+ " <form method='post' id=\"testrepeatform\"
name=\"testrepeatform\" action=\"" + actionURL + "\"
onsubmit=\"new Ajax.Updater('repeat-div', '" + resourceURL +
"', {asynchronous:true, parameters:Form.serialize(this)}); return
false;\">\n" +
+ " <font class='portlet-font'>Repeat
Demo:</font><br/>\n" +
+ " <input class='portlet-form-input-field'
type='text' value='' size='12' name=\"repeat\"
id=\"repeat\" onkeyup=\"this.form.submit2.click();new
Effect.Highlight(document.getElementById('repeat-div'));\"/>\n" +
+ " <input class='portlet-form-input-field hidden'
type='submit' name='submit2' value='submit'
style=\"display:hidden;\">\n" +
+ " </form>\n" +
+ "</div>" +
+ "");
+ writer.print("<div id=\"repeat-container\"><div
id=\"repeat-div\" class='half-width float-left'
style='height:50px'></div></div>");
+// "<input type=\"text\" id=\"hidden-input\"
value=\"" + resourceURL.toString() + "\" />" +
+// "<a href='javascript:" + resp.getNamespace() +
"_handle()'>Click me to trigger script</a>" +
+ writer.print("<br class='clear'/><br
class='clear'/><hr/>" +
+ "<h4>Partial Refresh Product Catalog</h4>" +
+ "<div class='full-width'>" +
+ "");
+ writer.print("<div class='float-left third-width'>");
+ resourceURL.setParameter("prodId","1");
+ writer.print("<a href=\"javascript: browse(\'" +
resourceURL + "\');\">Product 1</a><br/>");
+
+ resourceURL.setParameter("prodId","2");
+ writer.print("<a href=\"javascript: browse(\'" +
resourceURL + "\');\">Product 2</a><br/>");
+
+ resourceURL.setParameter("prodId","3");
+ writer.print("<a href=\"javascript: browse(\'" +
resourceURL + "\');\">Product 3</a><br/>");
+
+ writer.print("<br class='clear'/></div>");
+ writer.print("<div class='float-left two-third-width'>"
+
+ "<h4 class='zero'>Product Details</h4>" +
+ "<div id=\"output-div\"></div>" +
+ "");
+ writer.print("<br class='clear'/></div>");
+ writer.print("<br class='clear'/></div>");
+ writer.print("<br class='clear'/></div>");
+
+
+
+ // writer.print("</div>");
+ }
+
+ public void serveResource(ResourceRequest req, ResourceResponse resp) throws
PortletException, IOException
+ {
+ String repeatText = req.getParameter("repeat");
+ String prodId = req.getParameter("prodId");
+
+ String namespace =resp.getNamespace();
+ //resp.setContentType("application/json");
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+ if (repeatText != null){
+ writer.print("<div id=\"repeat-text\">"+
req.getPrivateParameterMap().get("repeat")[0] +"</div>");
+ }
+ if (prodId != null){
+ if (prodId.equals("1")){
+ writer.print("<div id=\"product-text\">Product ID:
"+ prodId +"" +
+ "<br/>" +
+ " B BY BURTON ALPHA<br/>" +
+ "Sale Price: $314.96 " +
+ "</div>");
+ }
+ if (prodId.equals("2")){
+ writer.print("<div id=\"product-text\">Product ID:
"+ prodId +"" +
+ "<br/>" +
+ "FORUM DESTROYER LTD<br/>" +
+ "$319.99 " +
+ "</div>");
+ }
+ if (prodId.equals("3")){
+ writer.print("<div id=\"product-text\">Product ID:
"+ prodId +"" +
+ "<br/>" +
+ "\n" +
+ "SANTA CRUZ ALLSTAR<br/>" +
+ "$256.00 " +
+ "</div>");
+ }
+
+ }
+
+
+
+
+ writer.close();
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/NullFilter.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/NullFilter.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/basic/NullFilter.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * 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.filter.RenderFilter;
+import javax.portlet.filter.ActionFilter;
+import javax.portlet.filter.EventFilter;
+import javax.portlet.filter.ResourceFilter;
+import javax.portlet.filter.FilterChain;
+import javax.portlet.filter.FilterConfig;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class NullFilter implements RenderFilter, ActionFilter, EventFilter,
ResourceFilter
+{
+ public void init(FilterConfig config) throws PortletException
+ {
+ }
+
+ public void doFilter(RenderRequest req, RenderResponse resp, FilterChain chain) throws
IOException, PortletException
+ {
+ chain.doFilter(req, resp);
+ }
+
+ public void doFilter(ActionRequest req, ActionResponse resp, FilterChain chain) throws
IOException, PortletException
+ {
+ chain.doFilter(req, resp);
+ }
+
+ public void doFilter(EventRequest req, EventResponse resp, FilterChain chain) throws
IOException, PortletException
+ {
+ chain.doFilter(req, resp);
+ }
+
+ public void doFilter(ResourceRequest req, ResourceResponse resp, FilterChain chain)
throws IOException, PortletException
+ {
+ chain.doFilter(req, resp);
+ }
+
+ public void destroy()
+ {
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartEvent.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartEvent.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartEvent.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * 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.event;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.namespace.QName;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 9912 $
+ */
+@XmlRootElement
+public class CartEvent implements Serializable
+{
+ private String id;
+
+ public static final QName QNAME = new
QName("urn:jboss:portal:samples:event", "CartEvent");
+
+ public CartEvent(String id)
+ {
+ this.id = id;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartPortlet.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartPortlet.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CartPortlet.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,83 @@
+/******************************************************************************
+ * 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.event;
+
+import javax.portlet.Event;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 9932 $
+ */
+public class CartPortlet extends GenericPortlet
+{
+ List<CatalogItem> items = new ArrayList<CatalogItem>(7);
+
+ @Override
+ protected void doView(RenderRequest renderRequest, RenderResponse renderResponse)
throws PortletException, IOException
+ {
+ renderResponse.setContentType("text/html");
+ Writer writer = renderResponse.getWriter();
+
+
+ if (!items.isEmpty())
+ {
+ writer.append("<table width='95%'
id=\"cart-table\"><thead><tr align='left'><th
width='66%'>Description</th><th
align='right'>Price</th></tr></thead><tbody>");
+ int total = 0;
+ for (CatalogItem item : items)
+ {
+ int price = item.getPrice();
+ total += price;
+
writer.append("<tr><td>").append(item.getDescription()).append("</td><td
align='right'>$").append("" + price)
+ .append("</td></tr>");
+ }
+
writer.append("<tr><td><b>Total:</b></td><td
align='right' style='border-top: 2px solid #000;'>")
+ .append("$" +
total).append("</td></tr></tbody></table>");
+ }
+ else
+ {
+ writer.append("Cart is empty.");
+ }
+ }
+
+ @Override
+ public void processEvent(EventRequest eventRequest, EventResponse eventResponse)
throws PortletException, IOException
+ {
+ Event event = eventRequest.getEvent();
+ if (event.getName().equals("CartEvent"))
+ {
+ CartEvent cartEvent = (CartEvent)event.getValue();
+ items.add(Catalog.get(cartEvent.getId()));
+ }
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/Catalog.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/Catalog.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/Catalog.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * 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.event;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 9912 $
+ */
+public class Catalog
+{
+ private static Map<String, CatalogItem> items;
+
+ static
+ {
+ items = new HashMap<String, CatalogItem>(7);
+ items.put("1", new CatalogItem("1", 800, "Bike"));
+ items.put("2", new CatalogItem("2", 450,
"Snowboard"));
+ items.put("3", new CatalogItem("3", 225, "Tent"));
+ items.put("4", new CatalogItem("4", 75,
"Backpack"));
+ items.put("5", new CatalogItem("5", 119,
"Skateboard"));
+ items.put("6", new CatalogItem("6", 333,
"Surfboard"));
+ items.put("7", new CatalogItem("7", 90,
"Sneakers"));
+ }
+
+ private Catalog()
+ {
+ }
+
+ public static CatalogItem get(String id)
+ {
+ return items.get(id);
+ }
+
+ public static Collection<CatalogItem> getAll()
+ {
+ return items.values();
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogItem.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogItem.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogItem.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * 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.event;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 9912 $
+ */
+public class CatalogItem
+{
+ private String id;
+ private int price;
+ private String description;
+
+ public CatalogItem(String id, int price, String description)
+ {
+ this.id = id;
+ this.price = price;
+ this.description = description;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public int getPrice()
+ {
+ return price;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+}
Added:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogPortlet.java
===================================================================
---
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogPortlet.java
(rev 0)
+++
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/samples/event/CatalogPortlet.java 2008-02-29
23:47:01 UTC (rev 10161)
@@ -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.portal.samples.event;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 9932 $
+ */
+public class CatalogPortlet extends GenericPortlet
+{
+ @Override
+ protected void doView(RenderRequest renderRequest, RenderResponse renderResponse)
throws PortletException, IOException
+ {
+ renderResponse.setContentType("text/html");
+ Writer writer = renderResponse.getWriter();
+
+ writer.append("<table width='95%'><thead><tr
align='left'><th width='50%'>Description</th><th
width='25%'>Price</th><th>Actions</th></tr></thead><tbody>");
+
+ PortletURL addURL = renderResponse.createActionURL();
+ addURL.setParameter("op", "add");
+
+ Collection<CatalogItem> items = Catalog.getAll();
+ for (CatalogItem item : items)
+ {
+ addURL.setParameter("id", item.getId());
+
writer.append("<tr><td>").append(item.getDescription()).append("</td><td>$").append(""
+ item.getPrice())
+ .append("</td><td><a
href='").append(addURL.toString()).append("' onclick=\"new
Effect.Highlight(document.getElementById('cart-table'))\">Add to
cart</a></td></tr>");
+ }
+
+ writer.append("</tbody></table>");
+ }
+
+ @Override
+ public void processAction(ActionRequest actionRequest, ActionResponse actionResponse)
throws PortletException, IOException
+ {
+ String value = actionRequest.getParameter("id");
+ actionResponse.setEvent(CartEvent.QNAME, new CartEvent(value));
+ }
+}
Copied: modules/portlet/trunk/portal/src/main/resources/samples (from rev 10138,
modules/portlet/trunk/test/src/test/resources/portal/samples)
Copied: modules/portlet/trunk/portal/src/main/resources/samples/basic-war (from rev 10160,
modules/portlet/trunk/test/src/test/resources/portal/samples/basic-war)
Copied: modules/portlet/trunk/portal/src/main/resources/samples/cart-event-portlet-war
(from rev 10160,
modules/portlet/trunk/test/src/test/resources/portal/samples/cart-event-portlet-war)
Copied: modules/portlet/trunk/portal/src/main/resources/samples/google-map-portlet-war
(from rev 10160,
modules/portlet/trunk/test/src/test/resources/portal/samples/google-map-portlet-war)
Copied: modules/portlet/trunk/portal/src/main/resources/samples/google-weather-portlet-war
(from rev 10160,
modules/portlet/trunk/test/src/test/resources/portal/samples/google-weather-portlet-war)
Copied: modules/portlet/trunk/portal/src/main/resources/samples/remotecontrol-portlet-war
(from rev 10160,
modules/portlet/trunk/test/src/test/resources/portal/samples/remotecontrol-portlet-war)
Copied: modules/portlet/trunk/portal/src/main/resources/simple-portal-war (from rev 10138,
modules/portlet/trunk/test/src/test/resources/simple-portal-war)
Copied: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/META-INF (from
rev 10160, modules/portlet/trunk/test/src/test/resources/simple-portal-war/META-INF)
Copied: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF (from
rev 10160, modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF)
Modified:
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-beans.xml
===================================================================
---
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/jboss-beans.xml 2008-02-29
17:41:05 UTC (rev 10160)
+++
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-beans.xml 2008-02-29
23:47:01 UTC (rev 10161)
@@ -45,7 +45,7 @@
</bean>
<bean name="PortletCustomizationInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.PortletCustomizationInterceptor">
</bean>
- <bean name="ConsumerStackFactory"
class="org.jboss.portal.portlet.test.InterceptorStackFactoryImpl">
+ <bean name="ConsumerStackFactory"
class="org.jboss.portal.portlet.portal.InterceptorStackFactoryImpl">
<property name="interceptors">
<array>
<inject bean="ConsumerCacheInterceptor"/>
@@ -55,7 +55,7 @@
</bean>
<!-- The consumer portlet invoker -->
- <bean name="ConsumerPortletInvoker"
class="org.jboss.portal.portlet.test.controller.TestPortletInvoker">
+ <bean name="ConsumerPortletInvoker"
class="org.jboss.portal.portlet.portal.TestPortletInvoker">
<property name="producer"><inject
bean="ProducerPortletInvoker"/></property>
<property name="stackFactory"><inject
bean="ConsumerStackFactory"/></property>
</bean>
@@ -70,7 +70,7 @@
<bean name="ProducerCacheInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.ProducerCacheInterceptor"/>
<bean name="CCPPInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.CCPPInterceptor"/>
<bean name="RequestAttributeConversationInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.RequestAttributeConversationInterceptor"/>
- <bean name="ContainerStackFactory"
class="org.jboss.portal.portlet.test.InterceptorStackFactoryImpl">
+ <bean name="ContainerStackFactory"
class="org.jboss.portal.portlet.portal.InterceptorStackFactoryImpl">
<property name="interceptors">
<array>
<inject bean="ValveInterceptor"/>
Added:
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-web.xml
===================================================================
---
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-web.xml
(rev 0)
+++
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/jboss-web.xml 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<!DOCTYPE jboss-web PUBLIC
+ "-//JBoss//DTD Web Application 4.2//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd">
+<jboss-web>
+ <class-loading java2ClassLoadingCompliance="false">
+ <loader-repository>test:loader=portlet</loader-repository>
+ </class-loading>
+</jboss-web>
\ No newline at end of file
Modified:
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/portal.tld
===================================================================
---
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/portal.tld 2008-02-29
17:41:05 UTC (rev 10160)
+++
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/portal.tld 2008-02-29
23:47:01 UTC (rev 10161)
@@ -10,13 +10,13 @@
<tag>
<name>page</name>
-
<tag-class>org.jboss.portal.portlet.test.jsp.taglib.PageTag</tag-class>
+
<tag-class>org.jboss.portal.portlet.portal.jsp.taglib.PageTag</tag-class>
<body-content>JSP</body-content>
</tag>
<tag>
<name>portlet</name>
-
<tag-class>org.jboss.portal.portlet.test.jsp.taglib.PortletTag</tag-class>
+
<tag-class>org.jboss.portal.portlet.portal.jsp.taglib.PortletTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>name</name>
@@ -54,19 +54,19 @@
<tag>
<name>portletmarkup</name>
-
<tag-class>org.jboss.portal.portlet.test.jsp.taglib.PortletMarkupTag</tag-class>
+
<tag-class>org.jboss.portal.portlet.portal.jsp.taglib.PortletMarkupTag</tag-class>
<body-content>empty</body-content>
</tag>
<tag>
<name>portlettitle</name>
-
<tag-class>org.jboss.portal.portlet.test.jsp.taglib.PortletTitleTag</tag-class>
+
<tag-class>org.jboss.portal.portlet.portal.jsp.taglib.PortletTitleTag</tag-class>
<body-content>empty</body-content>
</tag>
<tag>
<name>portleturl</name>
-
<tag-class>org.jboss.portal.portlet.test.jsp.taglib.PortletURLTag</tag-class>
+
<tag-class>org.jboss.portal.portlet.portal.jsp.taglib.PortletURLTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>mode</name>
@@ -82,7 +82,7 @@
<tag>
<name>param</name>
-
<tag-class>org.jboss.portal.portlet.test.jsp.taglib.ParamTag</tag-class>
+
<tag-class>org.jboss.portal.portlet.portal.jsp.taglib.ParamTag</tag-class>
<body-content>empty</body-content>
<attribute>
<name>name</name>
@@ -100,7 +100,7 @@
<tag>
<name>pageparam</name>
-
<tag-class>org.jboss.portal.portlet.test.jsp.taglib.PageParamTag</tag-class>
+
<tag-class>org.jboss.portal.portlet.portal.jsp.taglib.PageParamTag</tag-class>
<body-content>empty</body-content>
<attribute>
<name>namespaceURI</name>
@@ -129,7 +129,7 @@
<tag>
<name>headers</name>
-
<tag-class>org.jboss.portal.portlet.test.jsp.taglib.HeadersTag</tag-class>
+
<tag-class>org.jboss.portal.portlet.portal.jsp.taglib.HeadersTag</tag-class>
<body-content>empty</body-content>
</tag>
Modified:
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/web.xml
===================================================================
---
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/web.xml 2008-02-29
17:41:05 UTC (rev 10160)
+++
modules/portlet/trunk/portal/src/main/resources/simple-portal-war/WEB-INF/web.xml 2008-02-29
23:47:01 UTC (rev 10161)
@@ -28,7 +28,7 @@
version="2.5">
<filter>
<filter-name>ControllerFilter</filter-name>
-
<filter-class>org.jboss.portal.portlet.test.jsp.ControllerFilter</filter-class>
+
<filter-class>org.jboss.portal.portlet.portal.jsp.ControllerFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ControllerFilter</filter-name>
Copied: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/css (from rev
10160, modules/portlet/trunk/test/src/test/resources/simple-portal-war/css)
Copied: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/demo (from rev
10160, modules/portlet/trunk/test/src/test/resources/simple-portal-war/demo)
Copied: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/images (from rev
10160, modules/portlet/trunk/test/src/test/resources/simple-portal-war/images)
Deleted: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/index.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp 2008-02-27
20:42:50 UTC (rev 10138)
+++ modules/portlet/trunk/portal/src/main/resources/simple-portal-war/index.jsp 2008-02-29
23:47:01 UTC (rev 10161)
@@ -1,8 +0,0 @@
-<%@ page language="java" %>
-<%@ taglib uri="/WEB-INF/portal.tld" prefix="portal" %>
-<%@ page isELIgnored="false" %>
-<html>
-<body>
-<jsp:forward page="demo/home.jsp"/>
-</body>
-</html>
Copied: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/index.jsp (from
rev 10160, modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp)
===================================================================
--- modules/portlet/trunk/portal/src/main/resources/simple-portal-war/index.jsp
(rev 0)
+++ modules/portlet/trunk/portal/src/main/resources/simple-portal-war/index.jsp 2008-02-29
23:47:01 UTC (rev 10161)
@@ -0,0 +1,8 @@
+<%@ page language="java" %>
+<%@ taglib uri="/WEB-INF/portal.tld" prefix="portal" %>
+<%@ page isELIgnored="false" %>
+<html>
+<body>
+<jsp:forward page="demo/home.jsp"/>
+</body>
+</html>
Copied: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/js (from rev
10160, modules/portlet/trunk/test/src/test/resources/simple-portal-war/js)
Copied: modules/portlet/trunk/portal/src/main/resources/simple-portal-war/layouts (from
rev 10160, modules/portlet/trunk/test/src/test/resources/simple-portal-war/layouts)
Modified: modules/portlet/trunk/test/pom.xml
===================================================================
--- modules/portlet/trunk/test/pom.xml 2008-02-29 17:41:05 UTC (rev 10160)
+++ modules/portlet/trunk/test/pom.xml 2008-02-29 23:47:01 UTC (rev 10161)
@@ -367,7 +367,6 @@
<ant antfile="${basedir}/src/test/build.xml">
<target name="tests"/>
- <target name="package-simple-portal"/>
<target name="package-tck-portal"/>
</ant>
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-02-29 17:41:05 UTC (rev 10160)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-02-29 23:47:01 UTC (rev 10161)
@@ -699,29 +699,6 @@
</target>
-
- <macrodef name="generic-package-simple-portal">
- <attribute name="server"/>
- <sequential>
- <copy todir="@{server}/simple-portal" flatten="true">
- <path>
- <path location="${dependency.portal-common.jar}"/>
- <path location="${dependency.portal-common-portal.jar}"/>
- <path location="${dependency.portal-portlet.jar}"/>
- <path location="${dependency.portal-web.jar}"/>
- <path location="${dependency.jsr168api.jar}"/>
- <path location="${dependency.ccpp.jar}"/>
- <path refid="mc.portal-portlet-controller"/>
- <path refid="mc.portal-portlet-mc"/>
- </path>
- </copy>
-
- <copy todir="(a){server}/simple-portal/simple-portal.war">
- <fileset dir="${test.temp.dir}/simple-portal-war"/>
- </copy>
- </sequential>
- </macrodef>
-
<target name="package-tck-portal" depends="prepare_env">
<property name="tck" value="${target}/tck"/>
@@ -871,83 +848,7 @@
</target>
- <target name="package-simple-portal" depends="prepare_env">
- <property name="portal.dir" value="${target}/portal"/>
- <property name="simple.tomcat.dir"
value="${portal.dir}/tomcat"/>
- <property name="simple.as42.dir"
value="${portal.dir}/as42"/>
- <!--<property name="simple.as5.dir"
value="${portal.dir}/as5"/>-->
-
- <delete dir="${portal.dir}"/>
-
- <mkdir dir="${portal.dir}"/>
- <mkdir dir="${simple.tomcat.dir}"/>
- <mkdir dir="${simple.as42.dir}"/>
- <!--<mkdir dir="${simple.as5.dir}"/>-->
-
-
- <jar jarfile="${target}/portlet-test-lib.jar">
- <fileset dir="${target}/classes"
excludes="org/jboss/portal/portlet/portal/samples/**"/>
- </jar>
-
- <copy todir="${test.temp.dir}/simple-portal-war">
- <fileset dir="src/test/resources/simple-portal-war"/>
- </copy>
-
- <!-- simple-portal.war -->
- <copy todir="${test.temp.dir}/simple-portal-war/WEB-INF/lib"
flatten="true">
-
- <!-- -->
- <fileset dir="${target}"
includes="portlet-test-lib.jar"/>
-
-
- <path refid="mc.portal-common"/>
-
- <!-- MC 2.0.0.Beta4 -->
- <path refid="mc.trove"/>
- <path refid="mc.xerces"/>
- <path refid="mc.javassist"/>
- <path refid="mc.jboss_common_logging_spi"/>
- <path refid="mc.jboss_common_logging_jdk"/>
- <path refid="mc.jboss_common_logging_log4j"/>
- <path refid="mc.jboss_common_core"/>
- <path refid="mc.jboss_vfs"/>
- <path refid="mc.jboss_xb"/>
- <path refid="mc.jboss_aop"/>
- <path refid="mc.jboss_microcontainer"/>
- </copy>
-
- <!-- AS 4.2 -->
- <generic-package-simple-portal server="${simple.as42.dir}"/>
-
- <!-- Tomcat -->
- <generic-package-simple-portal server="${simple.tomcat.dir}"/>
- <copy todir="${simple.tomcat.dir}/simple-portal"
flatten="true">
- <path>
- <pathelement path="${dependency.log4j.jar}"/>
- <pathelement path="${dependency.activation.jar}"/>
- <pathelement path="${dependency.apache-jstl.jar}"/>
- <pathelement path="${dependency.apache-standard.jar}"/>
- <pathelement path="${dependency.concurrent.jar}"/>
- <path refid="mc.jboss_common_logging_spi"/>
- <path refid="mc.jaxb-api"/>
- </path>
- </copy>
- <jar jarfile="${simple.tomcat.dir}/simple-portal.war">
- <fileset
dir="${simple.tomcat.dir}/simple-portal/simple-portal.war"/>
- </jar>
- <delete
dir="${simple.tomcat.dir}/simple-portal/simple-portal.war"/>
- <move todir="${simple.tomcat.dir}/copy-to-tomcat-lib">
- <fileset dir="${simple.tomcat.dir}/simple-portal/"/>
- </move>
-
- <!-- AS 5 -->
- <!--<generic-package-simple-portal
server="${simple.as5.dir}"/>-->
-
- <delete file="${target}/portlet-test-lib.jar"/>
-
- <antcall target="__package-demo-portlets"/>
- </target>
-
+<!--
<target name="__package-demo-portlets"
depends="prepare_env">
<property name="samples.target.dir"
value="${portal.dir}/samples"/>
@@ -1010,5 +911,6 @@
</jar>
</target>
+-->
</project>
\ No newline at end of file