You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by cd...@apache.org on 2007/08/04 16:41:49 UTC
svn commit: r562725 [22/33] - in
/portals/pluto/branches/1.1-286-trunk-merge: ./ assembly/ assembly/src/
assembly/src/main/ assembly/src/main/assembly/ assembly/src/main/resources/
maven-pluto-plugin/ maven-pluto-plugin/src/ maven-pluto-plugin/src/main...
Added: portals/pluto/branches/1.1-286-trunk-merge/pluto-site/src/site/xdoc/v11/deploying.xml
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-site/src/site/xdoc/v11/deploying.xml?view=auto&rev=562725
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-site/src/site/xdoc/v11/deploying.xml (added)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-site/src/site/xdoc/v11/deploying.xml Sat Aug 4 07:41:23 2007
@@ -0,0 +1,308 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright 2004-2006 The Apache Software Foundation
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied.
+
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<document>
+
+ <properties>
+ <title>Deploying Portlet to Pluto Portal</title>
+ <author email="zheng.at.apache.D0T.org">ZHENG Zhong</author>
+ <author email="ddewolf@apache.org">David DeWolf</author>
+ <author email="cdoremus@apache.org">Craig Doremus</author>
+ </properties>
+
+ <body>
+
+ <section name="Deploying Portlet to Pluto Portal">
+
+ <p>
+ There are 3 steps to deploy a portlet to Pluto 1.1:
+ <ul>
+ <li>
+ <b>Assembly</b>: All portlet applications must be run through the
+ pluto assembler before being deployed. The assembly process injects
+ pluto specific information for deployment. Specifically, a servlet
+ and servlet mapping are added to the deployment descriptor (web.xml).
+ This servlet (<code>org.apache.pluto.core.PortletServlet</code>) will be
+ used to dispatch portlet requests to the portlet application.
+ </li>
+ <li>
+ <b>Deployment</b>: After portlet applications are assembled properly
+ they must be deployed to the servlet engine within which the portal
+ application is running. The current binary distribution uses
+ Tomcat 5.5 as the servlet engine.
+ </li>
+ <li>
+ <b>Publishing</b>: All portlet applications that are to be used
+ within the Pluto Portal must be published to the Portal. Publishing
+ notifies the Portal Application that a portlet application is bound
+ (deployed) to a certain context within the appserver. This is done
+ by adding records to <code>pluto-portal-driver-config.xml</code>.
+ </li>
+ </ul>
+ </p>
+
+ <subsection name="Portlet Assembly and Deployment using Maven 2">
+ <p>
+ As of the second beta release of Pluto 1.1, the Maven 2 plugins for assembly and
+ deployment are partially completed.
+ Right now the maven-pluto-plugin correctly assembles the war with
+ the proper <code>PortletServlet</code> records to web.xml, but the
+ deployment plugin is not yet completed. We have created an example
+ <!-- TODO: Review use of the word deploys -->
+ Maven 2 pom.xml below that correctly assembles and deploys the portlet.
+ </p>
+ <p>
+ The custom Maven 2 build shown below also deploys
+ a Tomcat context deployment descriptor that has the same name as your
+ artifactId with an xml extension (e.g. HelloWorldPortlet.xml).
+ </p>
+ <p>
+ To properly assemble and deploy your portlet using the Maven 2 script (pom.xml) below,
+ your project's directory structure and artifact placement must conform to Maven's standard:
+ </p>
+ <p>
+ <source><![CDATA[
+ HelloWorldPortlet (top level directory)
+ |- pom.xml (the pom file)
+ |- src (Subdir containing main subdirectory)
+ |- main (Subdir containing java, resources and webapp subdirs)
+ |- java (java source code goes under here)
+ | `- com
+ | `- mycompany
+ | `- portlet
+ | `- HelloWorldPortlet.java (portlet source)
+ |- resources
+ | `- HelloWorldPortlet.xml (Tomcat context deployment descriptor)
+ |- webapp (webapp resources (jsp, css, images) go under here)
+ `- jsp
+ `- HelloWorldPortletView.jsp (for view mode)
+ `- HelloWorldPortletEdit.jsp (for edit mode)
+ `- WEB-INF
+ `- portlet.xml (JSR-168 deployment descriptor)
+ `- web.xml (This will be modified by maven-pluto-plugin)
+ ]]></source>
+ </p>
+
+ <p>
+ This is an example of what the Tomcat context deployment descriptor will contain:
+ <source><![CDATA[
+ <Context path="HelloWorldPortlet"
+ docBase="../PlutoDomain/HelloWorldPortlet.war"
+ crossContext="true"/>
+ ]]></source>
+ </p>
+ <p>
+ The Maven 2 pom file (pom.xml) is what defines the build. Our example overrides
+ the integration-test lifecycle phase in addition to using the maven-pluto-plugin
+ to assemble the war. Use this as you pom file, changing the groupId, artifactId and version
+ to values appropriate to your custom portlet.
+ <source><![CDATA[
+<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">
+
+ <!-- Change this to something akin to your java package structure -->
+ <groupId>com.mycompany.portlet</groupId>
+ <modelVersion>4.0.0</modelVersion>
+ <!-- Version of this app -->
+ <version>0.1-alpha1</version>
+ <!-- Base name of the war file without .war ext -->
+ <artifactId>HelloWorldPortlet</artifactId>
+ <packaging>war</packaging>
+ <name>${pom.artifactId}</name>
+ <!-- Dependency Version Properties ======================================= -->
+ <properties>
+ <!-- Change this for a new Pluto version -->
+ <pluto.version>1.1.0-beta2</pluto.version>
+ <portlet-api.version>1.0</portlet-api.version>
+ <servlet-api.version>2.3</servlet-api.version>
+ <jsp-api.version>2.0</jsp-api.version>
+ <junit.version>3.8.1</junit.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>javax.portlet</groupId>
+ <artifactId>portlet-api</artifactId>
+ <version>${portlet-api.version}</version>
+ <scope>provided</scope><!-- Prevents addition to war file -->
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>${servlet-api.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.pluto</groupId>
+ <artifactId>pluto-util</artifactId>
+ <version>${pluto.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <!-- Any other build or deployment dependancies go here -->
+ </dependencies>
+ <build>
+ <finalName>${pom.name}</finalName>
+ <plugins>
+ <!-- configure maven-war-plugin to use updated web.xml -->
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
+ </configuration>
+ </plugin>
+ <!-- bind 'pluto:assemble' goal to 'process-resources' lifecycle -->
+ <plugin>
+ <groupId>org.apache.pluto</groupId>
+ <artifactId>maven-pluto-plugin</artifactId>
+ <version>${pluto.version}</version>
+ <executions>
+ <execution>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>assemble</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <!-- Override the 'integration-test' lifecycle phase
+ with a custom one that runs a simple Ant script -->
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- Set tomcat.home to CATALINA_HOME environmental variable
+ Use this to skip -Dpluto.home=/path/to/pluto on command line -->
+ <property environment="env"/>
+ <property name="pluto.home" value="${env.CATALINA_HOME}"/>
+ <echo message="pluto.home=${pluto.home}"/>
+ <!-- Remove former deployment because sometimes
+ tomcat does not fully redeploy a war -->
+ <delete
+ dir="${pluto.home}/webapps/${pom.name}"
+ failonerror="true"
+ />
+ <!-- Deploy war file -->
+ <copy
+ file="${project.build.directory}/${pom.name}.war"
+ todir="${pluto.home}/PlutoDomain"
+ overwrite="true"
+ />
+ <!-- Deploy context deployment descriptor for Tomcat -->
+ <copy
+ file="${basedir}/src/main/resources/${pom.name}.xml"
+ todir="${pluto.home}/conf/Catalina/localhost"
+ overwrite="false"
+ />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
+ ]]></source>
+ </p>
+ <p>
+ Run the Maven 2 pom.xml script using 'mvn integration-test -Dpluto.home=/path/to/pluto1.1install'
+ from the command line to create the war with web.xml modified for deployment to
+ Pluto-1.1 and deploy it to a local install of Pluto-1.1.
+ The embedded Ant script in the pom.xml was created to use the environmental variable
+ CATALINA_HOME as the value of pluto.home.
+ If you have set CATALINA_HOME to your Pluto-1.1 install, then you can just run
+ the command 'mvn integration-test'.
+ </p>
+ <p>
+ If you prefer to manually deploy the war to Tomcat, run 'mvn package' which will
+ create the war file in the <code>target/</code> directory. Then manually deploy
+ the war file and Tomcat context deployment descriptor to your Pluto-1.1 install.
+ </p>
+ </subsection>
+
+ <subsection name="Portlet Publishing">
+ <p>
+ Currently, as of Pluto-1.1-beta2, the only way to publish an application to the portal
+ is to manually update the Portal's configuration file <code>pluto-portal-driver-config.xml</code>
+ located in the WEB-INF directory of the pluto webapp.
+ Here's how to do it:
+ </p>
+
+ <p><b>Step 1: Portlet App Config</b></p>
+ <p>
+ First, add a <code>portlet-app</code> config element to
+ notify the Portal which portlet application is deployed to the
+ appserver (Tomcat). In this element, you should specify the context path of
+ your portlet app, as well as the names of portlets deployed. Here is
+ an example:
+ <source><![CDATA[
+<portlet-app>
+ <context-path>/your_portlet_app_context_path</context-path>
+ <portlets>
+ <portlet name="your_portlet_1"/>
+ <portlet name="your_portlet_2"/>
+ ... ...
+ </portlets>
+</portlet-app>
+ ]]></source>
+ </p>
+
+ <p><b>Step 2: Portal Page Config</b></p>
+ <p>
+ You should then configure a portal page to display your portlets.
+ Do this by adding a <code>page</code> element in the <code>render-config</code>
+ element, like this:
+ <source><![CDATA[
+<render-config default="Test Page">
+ ... ...
+ <page name="Your Portal Page Name" uri="/WEB-INF/fragments/portlet.jsp">
+ <portlet context="/your_portlet_app_context_path"
+ name="your_portlet_1"/>
+ <portlet context="/your_portlet_app_context_path"
+ name="your_portlet_2"/>
+ </page>
+</render-config>
+ ]]></source>
+ </p>
+ <p>
+ The <code>uri</code> attribute defines the theme of your portal page.
+ If you use <code>/WEB-INF/fragments/portlet.jsp</code> (which is the
+ default theme of Pluto Testsuite portlet app), your portlets will be
+ displayed in two columns. You can clone this file to customize your layout.
+ If you do so, make sure the <code>uri</code> attribute points to the new file.
+ </p>
+ </subsection>
+
+ </section>
+
+ </body>
+
+</document>
+
Added: portals/pluto/branches/1.1-286-trunk-merge/pluto-site/src/site/xdoc/v11/getting-started.xml
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-site/src/site/xdoc/v11/getting-started.xml?view=auto&rev=562725
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-site/src/site/xdoc/v11/getting-started.xml (added)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-site/src/site/xdoc/v11/getting-started.xml Sat Aug 4 07:41:23 2007
@@ -0,0 +1,241 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright 2004 The Apache Software Foundation
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied.
+
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<document>
+
+ <properties>
+ <title>Getting Started With Pluto</title>
+ <author email="ddewolf@apache.org">David DeWolf</author>
+ <author email="zheng.at.apache.D0T.org">ZHENG Zhong</author>
+ <author email="cdoremus@apache.org">Craig Doremus</author>
+ </properties>
+
+ <body>
+
+ <section name="Installing the Pluto 1.1 Binary Build">
+
+ <ol>
+ <li>Download a Pluto 1.1 binary distribution from
+ a <a href="http://cvs.apache.org/dist/portals/pluto/v1.1.0-beta2/">distribution site</a>.</li>
+ <li>Unzip the binary distribution into a directory.</li>
+ <ol>
+ <li><PLUTO-1.1-HOME> will be the top level directory.</li>
+ </ol>
+ <li>Execute startup.bat (Windows) or startup.sh (Unix)
+in <PLUTO-1.1-HOME>/bin.</li>
+ <ol>
+ <li>Use shutdown.bat/shutdown.sh to stop the portal</li>
+ </ol>
+ <li>Browse to <a href="http://localhost:8080/pluto/portal">http://localhost:8080/pluto/portal</a></li>
+ <li>Login as the user pluto (password=pluto).</li>
+ </ol>
+
+ </section>
+
+ <section name="Building Pluto from Source">
+
+ <p>
+ Maven 2 is utilized as the project management and build system for
+ Pluto 1.1. Pluto currently provides Maven plugins which can be used to
+ install the Pluto Portal, assemble portlet applications, deploy
+ applications, and publish portlet applications to the Pluto Portal.
+ </p>
+
+ <subsection name="Obtaining Pluto 1.1 Source Code">
+ <p>The Pluto project uses the
+ <a href="http://subversion.tigris.org/">Subversion</a> version control
+ system. If you're new to Subversion, you can check out the
+ <a href="http://svnbook.red-bean.com/">online book</a> about Subversion.
+ Note that we are currently using Subversion 1.3.x (there are separate
+ versions of the book covering the different versions of Subversion).
+ </p>
+
+ <p><b>Web Access to Subversion</b></p>
+
+ <p>
+ To browse the Pluto 1.1 source code, you can use the
+ <a href="http://svn.apache.org/viewcvs.cgi/portals/pluto/trunk?root=Apache-SVN">ViewCVS
+ web interface</a> to Subversion. This is current at all times.
+ </p>
+
+ <p><b>Normal Subversion Access</b></p>
+ <p>Anyone can check code out of Subversion anonymously. However, you need to specify a
+ username and password in order to update the Subversion repository, and only
+ Pluto committers have the permissions to do that. We run Subversion
+ over standard HTTPS, so hopefully you won't have problems with intervening
+ firewalls.</p>
+
+ <h3>Check out from Subversion</h3>
+
+ <p>Again, anyone can do this. To check out the latest distribution of Pluto 1.1 (trunk) to a directory
+ called 'pluto' use this command:
+ <pre>svn checkout https://svn.apache.org/repos/asf/portals/pluto/trunk/ pluto</pre>
+ </p>
+
+ <p>To check out Pluto 1.1.0-beta2 source to the 'pluto' directory use this command:
+ <pre>svn checkout https://svn.apache.org/repos/asf/portals/pluto/tags/release-1.1.0-beta2/ pluto</pre>
+ </p>
+
+ <p>
+ Zipped up Pluto source distributions can also be downloaded from
+ a <a href="http://www.apache.org/dyn/closer.cgi/portals/pluto/">distribution mirror</a>.
+ </p>
+
+ </subsection>
+
+ <subsection name="Building Pluto with Maven 2">
+ <p>
+ <code><PLUTO-1.1-SRCHOME></code> is the local directory where the
+ Pluto 1.1 source distribution has been checked out or unzipped into.
+ </p>
+ <p>
+ <source><![CDATA[
+$> cd <PLUTO-1.1-SRCHOME>
+$> mvn install
+$> mvn pluto:install -DinstallDir=path/to/appserver
+ ]]></source>
+ </p>
+ <p>
+ The <code>install</code> goal is a built in Maven 2 lifecycle
+ which builds the project artifacts and installs them into the Maven
+ repository.
+ </p>
+ <p>
+ The <code>pluto:install</code> goal will take the resulting artifacts
+ and properly deploy them within the configured Tomcat installation.
+ Currently, the Pluto 1.1 install has been tested on Tomcat 5.5.9 and Tomcat 5.5.17.
+ The Tomcat 5 archive can be found <a href="http://archive.apache.org/dist/tomcat/tomcat-5/archive">here</a>.
+ </p>
+ <p>
+ If installing to a directory that contains spaces, <code>installDir</code>
+ needs to be enclosed within quotes:
+ </p>
+ <p>
+ <source><![CDATA[
+C:\pluto> mvn pluto:install -DinstallDir="C:\Program Files\Apache Software Foundation\Tomcat 5.5"
+ ]]></source>
+ </p>
+
+ </subsection>
+
+ <subsection name="Installing Pluto Manually">
+ <p>
+ This section documents the manual installation of Pluto into Tomcat. It replaces
+ the pluto:install goal, but requires that the built-in Maven 2 install goal
+ (<code>mvn install</code>) be run from <code><PLUTO-1.1-SRCHOME></code>.
+ </p>
+ <p>
+ <b>Step 1:</b>
+ <source><![CDATA[
+$> cd <PLUTO-1.1-SRCHOME>
+$> mvn install
+ ]]></source>
+ </p>
+ <p>
+ <b>Step 2:</b> Copy the following to
+ <code><TOMCAT_HOME>/shared/lib</code>:
+ <ul>
+ <li>castor-1.0.jar</li>
+ <li>portlet-api-1.0.jar</li>
+ <li>pluto-container-1.1-beta2.jar</li>
+ <li>pluto-descriptor-api-1.1-beta2.jar</li>
+ <li>pluto-descriptor-impl-1.1-beta2.jar</li>
+ <li>pluto-taglib-1.1.0-beta2.jar</li>
+ </ul>
+ </p>
+ <p>
+ <b>Step 3:</b> Copy the following to
+ <code><TOMCAT_HOME>/common/endorsed</code>:
+ <ul>
+ <li>xercesImpl-2.6.2.jar</li>
+ <li>xmlParserAPIs-2.6.2.jar</li>
+ </ul>
+ </p>
+ <p>
+ <b>Step 4:</b> Copy the following to
+ <code><TOMCAT_HOME>/conf/Catalina/localhost</code>:
+ <ul>
+ <li><PLUTO_SRCHOME>/pluto-portal/src/main/resources/pluto.xml</li>
+ <li><PLUTO_SRCHOME>/pluto-testsuite/src/main/resources/testsuite.xml</li>
+ </ul>
+ </p>
+ <p>
+ <b>Step 5:</b> Copy the following to
+ <code><TOMCAT_HOME>/webapps</code>:
+ <ul>
+ <li><PLUTO_SRCHOME>/pluto-portal/target/pluto-portal.war</li>
+ <li><PLUTO_SRCHOME>/pluto-testsuite/target/pluto-testsuite.war</li>
+ </ul>
+ </p>
+ </subsection>
+
+ <subsection name="Installing Pluto with a Windows EXE">
+ <p>
+ The NSIS Installer is not yet complete, but we hope to have a fully
+ functional one soon. Anyone is more than welcome to assist us in
+ this process.
+ </p>
+ </subsection>
+
+ <subsection name="Configuring Source-Built Pluto for Application Scope PortletSession Attributes">
+ <p>To be able to use application-scoped <code>PortletSession</code> attributes in Pluto, modify
+ the Connector element for port 8080 in <code><TOMCAT_HOME>/conf/server.xml</code> by
+ adding the following attribute and value: emptySessionPath="true".
+ </p>
+ </subsection>
+ <subsection name="Configuring User and Role in the Pluto Source Build">
+ <p>
+ The Pluto Testsuite portlet application needs the role '<code>pluto</code>'
+ to run the Security Mapping Test. So before starting tomcat, you should
+ edit <code><TOMCAT_HOME>/conf/tomcat-users.xml</code>, add the
+ role '<code>pluto</code>', and add a user in that role. The simplest way
+ to do this is to edit add the '<code>pluto</code>' role to the
+ '<code>tomcat</code>' user's record. Here is a sample
+ <code>tomcat-users.xml</code> file:
+ <source><![CDATA[
+<?xml version="1.0" encoding="utf-8"?>
+<tomcat-users>
+ <role rolename="pluto"/>
+ <role rolename="tomcat"/>
+ <role rolename="role1"/>
+ <user username="tomcat" password="tomcat" roles="tomcat,pluto"/>
+ <user username="role1" password="tomcat" roles="role1"/>
+ <user username="both" password="tomcat" roles="tomcat,role1"/>
+</tomcat-users>
+ ]]></source>
+ </p>
+ </subsection>
+
+
+ <subsection name="Starting the Portal">
+ <p>
+ Now you are ready to use the Pluto Portal built from source. Start up tomcat by running
+ <code>startup.bat</code> (for windows) or <code>startup.sh</code> (for
+ *nix) in <code><TOMCAT_HOME>/bin</code>, and browse to
+ <code>http://localhost:8080/pluto/portal</code>. Login to Pluto using
+ the user and password you just created in <code>tomcat-users.xml</code>.
+ If you added the 'pluto' role to the 'tomcat' user's record, you can
+ login as 'tomcat/tomcat'.
+ </p>
+ </subsection>
+ </section>
+
+ </body>
+
+</document>
+
Added: portals/pluto/branches/1.1-286-trunk-merge/pluto-site/src/site/xdoc/v11/resources.xml
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-site/src/site/xdoc/v11/resources.xml?view=auto&rev=562725
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-site/src/site/xdoc/v11/resources.xml (added)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-site/src/site/xdoc/v11/resources.xml Sat Aug 4 07:41:23 2007
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright 2004 The Apache Software Foundation
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied.
+
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<document>
+
+ <properties>
+ <title>Pluto and Portlet Resources</title>
+ <author email="ddewolf@apache.org">David DeWolf</author>
+ </properties>
+
+ <body>
+
+ <section name="The Java Portlet Specifications">
+ <p>
+ <ul>
+ <li><a href="http://jcp.org/en/jsr/detail?id=168">JSR-168: Portlet Specification 1.0</a></li>
+ <li><a href="http://jcp.org/en/jsr/detail?id=286">JSR-286: Portlet Specification 2.0</a></li>
+ </ul>
+ </p>
+ </section>
+
+ <section name="Additional Pluto Documentation">
+ <p>
+ <ul>
+ <li>
+ <a href="http://wiki.apache.org/portals/Pluto">Official Pluto Wiki</a>
+ </li>
+ <li>
+ <a href="http://people.apache.org/~zheng/pluto/chinese/">Pluto
+ Website, Chinese Translation</a> maintained by ZHENG Zhong
+ </li>
+ </ul>
+ </p>
+ </section>
+
+ <section name="Articles, Whitepapers, and Presentations">
+ <p>
+ <ul>
+ <li>
+ <a href="http://www.developer.com/java/web/article.php/3547186">Introduction to the Portlet Specification</a>
+ by David H. DeWolf, September 2005
+ </li>
+ <li>
+ <a href="http://www.developer.com/java/web/article.php/3554396">Developing Portlets with Apache Pluto 1.1</a>
+ by David H. DeWolf, October 2005
+ </li>
+ <li>
+ <a href="http://www.developer.com/java/web/article.php/3563411">Embedding Apache Pluto 1.1</a>
+ by David H. DeWolf, September 2005
+ </li>
+ </ul>
+ </p>
+ </section>
+
+ </body>
+
+</document>
+
Added: portals/pluto/branches/1.1-286-trunk-merge/pluto-site/src/site/xdoc/v11/subprojects.xml
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-site/src/site/xdoc/v11/subprojects.xml?view=auto&rev=562725
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-site/src/site/xdoc/v11/subprojects.xml (added)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-site/src/site/xdoc/v11/subprojects.xml Sat Aug 4 07:41:23 2007
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright 2004 The Apache Software Foundation
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied.
+
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<document>
+
+ <properties>
+ <title>Pluto Subprojects</title>
+ <author email="ddewolf@apache.org">David DeWolf</author>
+ </properties>
+
+ <body>
+ <section name="Pluto Subprojects">
+
+ <p>
+ Pluto 1.1 utilizes Maven 2 as it's project management and build
+ automation tool. Pluto follows maven's best practices and is organized
+ into modules or subprojects.
+ </p>
+
+ <subsection name="Container Subprojects">
+ <p>
+ <ul>
+ <li>
+ <b>Pluto Container:</b>
+ The Pluto Container is the core compontent of the Apache Pluto
+ project. All other modules either support the development. The
+ Pluto Container is the reference implementation of the Portlet
+ Specification.
+ </li>
+ <li>
+ <b>Pluto Tags:</b>
+ The Java Portlet Tag Library implementation which is provided
+ with the container.
+ </li>
+ </ul>
+ </p>
+ </subsection>
+
+ <subsection name="Portal/Testing Subprojects">
+ <p>
+ <ul>
+ <li>
+ <b>Pluto Portal Driver:</b>
+ A driver library for the Pluto Portlet Container. Provides service
+ implementations and utilities for implementing a portal which
+ utilizes the container.
+ </li>
+ <li>
+ <b>Pluto Portal:</b>
+ The user interface components (web application) of the Pluto
+ Portal. The pluto portal is a simple portal application which
+ embeds the portal. The portal is not meant to be a full enterprise
+ portal, but instead is meant to be an example of how to embed the
+ container and a lightweight environment for developing and testing
+ portlets.
+ </li>
+ <li>
+ <b>Pluto Testsuite:</b>
+ A test portlet which can be used to exercise and test any portlet
+ container.
+ </li>
+ </ul>
+ </p>
+ </subsection>
+
+ <subsection name="Libraries and Supporting Subprojects">
+ <p>
+ <ul>
+ <li>
+ <b>Pluto Descriptor API:</b>
+ A domain model which represents the deployment descriptors read
+ by the portlet container. Contains service interfaces for reading
+ and writing portlet.xml and web.xml.
+ </li>
+ <li>
+ <b>Pluto Descriptor Impl:</b>
+ The default implementation of the Pluto Descriptor API Subproject.
+ The default implementation utilzes castor for reading and writing
+ portlet and web application descriptors.
+ </li>
+ <li>
+ <b>Pluto Optional Services:</b>
+ Provides optional implementations of the Pluto Container Services.
+ Includes database implementations of the PortletPreferencesService
+ and the UserAttributeService.
+ </li>
+ </ul>
+ </p>
+ </subsection>
+
+ <subsection name="Utilities and Tools (for working with the Pluto Portal)">
+ <p>
+ <ul>
+ <li>
+ <b>Pluto Util:</b>
+ Utilities for working with the Pluto Portal. Includes libraries
+ for installing pluto, assembling portlet applications for
+ deployment in pluto, deploying to pluto, and publishing portlets
+ to pluto.
+ </li>
+ <li>
+ <b>Maven Plugin:</b>
+ Provides Maven goals for utilizing the Pluto utilities. Install
+ the portal within a servlet container, assemble portlets, deploy
+ portlets, and publish portlets to th Pluto Portal.
+ </li>
+ <li>
+ <b>Ant Tasks:</b>
+ Ant tasks which allow developers to utilize the Pluto utilities
+ within ant. Currently supports assembling wars for deployment
+ within pluto.
+ </li>
+ </ul>
+ </p>
+ </subsection>
+
+ </section>
+ </body>
+
+</document>
+
Added: portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/pom.xml
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/pom.xml?view=auto&rev=562725
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/pom.xml (added)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/pom.xml Sat Aug 4 07:41:23 2007
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<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.apache.pluto</groupId>
+ <artifactId>pluto</artifactId>
+ <version>1.1.0-286-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>pluto-taglib</artifactId>
+ <packaging>jar</packaging>
+ <name>Pluto Portlet Tag Library</name>
+ <description>Pluto's Java Portlet Specification Tag Library implementation</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.portlet</groupId>
+ <artifactId>portlet-api</artifactId>
+ <version>${portlet-api.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>${servlet-api.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>${jsp-api.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+
+ <build>
+ <plugins>
+ <!-- Assembly Plugin - Create Distributions -->
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptor>src/assemble/bin.xml</descriptor>
+ <finalName>pluto-taglib-${pom.currentVersion}</finalName>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <configuration>
+ <resourcesDirectory>${basedir}/../pluto-site/src/site/resources</resourcesDirectory>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ActionURLTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ActionURLTag.java?view=auto&rev=562725
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ActionURLTag.java (added)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ActionURLTag.java Sat Aug 4 07:41:23 2007
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+
+ */
+
+/*
+ * Created on Feb 21, 2003
+ *
+ * To change this generated comment go to
+ * Window>Preferences>Java>Code Generation>Code Template
+ */
+package org.apache.pluto.tags;
+
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletURL;
+
+/**
+ *
+ * A tag handler for the <CODE>actionURL</CODE> tag,which creates a url that
+ * points to the current Portlet and triggers an action request with the
+ * supplied parameters.
+ *
+ * @author <a href="mailto:olisp_jena@yahoo.de">Oliver Spindler</a> (since Nov 01, 2006)
+ * @version 2.0
+ */
+public class ActionURLTag extends PortletURLTag {
+
+ /**
+ * Creates an actionURL
+ * @param portletResponse PortletResponse
+ * @return PortletURL
+ */
+ protected PortletURL createPortletUrl(PortletResponse portletResponse)
+ {
+ return portletResponse.createActionURL();
+ }
+
+
+}
+
Added: portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/BaseURLTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/BaseURLTag.java?view=auto&rev=562725
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/BaseURLTag.java (added)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/BaseURLTag.java Sat Aug 4 07:41:23 2007
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.tags;
+
+import java.util.*;
+
+import javax.servlet.jsp.tagext.TagData;
+import javax.servlet.jsp.tagext.TagExtraInfo;
+import javax.servlet.jsp.tagext.TagSupport;
+import javax.servlet.jsp.tagext.VariableInfo;
+import javax.servlet.jsp.JspException;
+
+import javax.portlet.BaseURL;
+
+
+/**
+ * Abstract supporting class for actionURL tag, renderURL tag and resourceURL tag.
+ *
+ * @author <a href="mailto:olisp_jena@yahoo.de">Oliver Spindler</a> (since Nov 01, 2006)
+ * @version 2.0
+ *
+ */
+
+public abstract class BaseURLTag extends TagSupport {
+
+ /**
+ * TagExtraInfo class for BaseUrlTag.
+ */
+ public static class TEI extends TagExtraInfo {
+
+ public VariableInfo[] getVariableInfo(TagData tagData) {
+ VariableInfo vi[] = null;
+ String var = tagData.getAttributeString("var");
+ if (var != null) {
+ vi = new VariableInfo[1];
+ vi[0] =
+ new VariableInfo(var, "java.lang.String", true,
+ VariableInfo.AT_BEGIN);
+ }
+ return vi;
+ }
+
+ }
+
+ protected String secure;
+ protected Boolean secureBoolean;
+ protected String var;
+ //TODO: not the default value (should be true)
+ protected Boolean escapeXml=false;
+
+ protected Map<String,List<String>> parameters=new HashMap<String,List<String>> ();
+
+
+ /**
+ * Process the start tag for this instance.
+ * @throws JspException
+ * @return int
+ */
+ public abstract int doStartTag() throws JspException;
+
+
+ /**
+ * Process the end tag for this instance.
+ * @throws JspException
+ * @return int
+ */
+ public abstract int doEndTag() throws JspException;
+
+
+ /**
+ * Releases state of the tag handler.
+ * @return void
+ */
+ //Called at the end of the lifecycle.
+ public void release()
+ {
+ super.release();
+ parameters=null;
+ secureBoolean=null;
+ }
+
+
+ /**
+ * Returns secure property as String.
+ * @return String
+ */
+ public String getSecure() {
+ return secure;
+ }
+
+
+ /**
+ * Returns secure property as Boolean.
+ * @return boolean
+ */
+ public boolean getSecureBoolean() {
+ return this.secureBoolean.booleanValue();
+ }
+
+
+ /**
+ * Returns the var property.
+ * @return String
+ */
+ public String getVar() {
+ return var;
+ }
+
+
+ /**
+ * Returns escapeXml property.
+ * @return Boolean
+ */
+ public Boolean getEscapeXml() {
+ return escapeXml;
+ }
+
+
+ /**
+ * Sets secure property to boolean value of the string.
+ * @param secure
+ * @return void
+ */
+ public void setSecure(String secure) {
+ this.secure = secure;
+ this.secureBoolean = new Boolean(secure);
+ }
+
+
+ /**
+ * Sets the var property.
+ * @param var The var to set
+ * @return void
+ */
+ public void setVar(String var) {
+ this.var = var;
+ }
+
+
+ /**
+ * Sets the escapeXml property.
+ * @param escapeXml
+ * @return void
+ */
+ public void setEscapeXml(Boolean escapeXml) {
+ this.escapeXml = escapeXml;
+ }
+
+
+ /**
+ * Adds a key,value pair to the parameter map.
+ * @param key String
+ * @param value String
+ * @return void
+ */
+ public void addParameter(String key,String value)
+ {
+ /*if (escapeXml)
+ {
+ value=escapeXml(value);
+ }*/
+ List<String> values;
+ if(parameters.containsKey(key))
+ {
+ values=(List<String>)parameters.get(key);//get old value list
+ }
+ else
+ {
+ values=new ArrayList<String>();// create new value list
+ }
+ values.add(value);
+ parameters.put(key, values);
+ }
+
+
+ /**
+ * Copies parameters from map to url.
+ * @param url BaseURL
+ * @return void
+ */
+ protected void setUrlParameters(BaseURL url)
+ {
+ Set<String> keys=parameters.keySet();
+ Iterator i=keys.iterator();
+ while(i.hasNext())
+ {
+ String key=(String) i.next();
+ List<String> values=parameters.get(key);
+ String[] valarr=values.toArray(new String[0]);
+ url.setParameter(key, valarr);
+ }
+ }
+
+
+ /**
+ * Replaces in String str the characters &,>,<,",'
+ * with their corresponding character entity codes.
+ * @param str - the String where to replace
+ * @return String
+ */
+ protected String doEscapeXml(String str) {
+ str = replace(str,"&","&");
+ str = replace(str,"<","<");
+ str = replace(str,">",">");
+ str = replace(str,"\"",""");
+ str = replace(str,"'","'");
+ return str;
+ }
+
+
+ /**
+ * Checks if string is empty.
+ * This method has been copied from <code>org.apache.commons.lang.StringUtils</code> class.
+ * @param str String
+ * @return boolean
+ */
+ private boolean isEmpty(String str) {
+ return str == null || str.length() == 0;
+ }
+
+
+ /**
+ * Replaces String repl with String with in String text.
+ * This method has been copied from <code>org.apache.commons.lang.StringUtils</code> class.
+ * @param text - the String where to replace
+ * @param repl - the sub-String what to replace
+ * @param with - the sub-String what to replace repl with
+ * @return String
+ */
+ private String replace(String text, String repl, String with) {
+ int max=-1;
+ if (isEmpty(text) || isEmpty(repl) || with == null || max == 0) {
+ return text;
+ }
+ int start = 0;
+ int end = text.indexOf(repl, start);
+ if (end == -1) {
+ return text;
+ }
+ int replLength = repl.length();
+ int increase = with.length() - replLength;
+ increase = (increase < 0 ? 0 : increase);
+ increase *= (max < 0 ? 16 : (max > 64 ? 64 : max));
+ StringBuffer buf = new StringBuffer(text.length() + increase);
+ while (end != -1) {
+ buf.append(text.substring(start, end)).append(with);
+ start = end + replLength;
+ if (--max == 0) {
+ break;
+ }
+ end = text.indexOf(repl, start);
+ }
+ buf.append(text.substring(start));
+ return buf.toString();
+ }
+
+}
Added: portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/Constants.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/Constants.java?view=auto&rev=562725
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/Constants.java (added)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/Constants.java Sat Aug 4 07:41:23 2007
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.tags;
+
+/**
+ * Constant values as defined by the specification
+ * typically to a request.
+ * @version 1.0
+ */
+public class Constants {
+
+ /**
+ * The key used to bind the <code>PortletRequest</code> to the underlying
+ * <code>HttpServletRequest</code>.
+ */
+ public final static String PORTLET_REQUEST = "javax.portlet.request";
+
+ /**
+ * The key used to bind the <code>PortletResponse</code> to the underlying
+ * <code>HttpServletRequest</code>.
+ */
+ public final static String PORTLET_RESPONSE = "javax.portlet.response";
+
+ /**
+ * The key used to bind the <code>PortletConfig</code> to the underlying
+ * PortletConfig.
+ */
+ public final static String PORTLET_CONFIG = "javax.portlet.config";
+
+}
Added: portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag.java?view=auto&rev=562725
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag.java (added)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag.java Sat Aug 4 07:41:23 2007
@@ -0,0 +1,191 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.tags;
+
+import javax.portlet.*;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.tagext.TagData;
+import javax.servlet.jsp.tagext.TagExtraInfo;
+import javax.servlet.jsp.tagext.TagSupport;
+import javax.servlet.jsp.tagext.VariableInfo;
+
+/**
+ * A tag handler for the <CODE>defineObjects</CODE> tag. Creates the
+ * following variables to be used in the JSP:
+ * <UL>
+ * <LI><CODE>{@link RenderRequest} renderRequest</CODE>, when included from within the <CODE>render</CODE> method
+ * <LI><CODE>{@link ResourceRequest} resourceRequest</CODE>, when included from within the <CODE>serveResource</CODE> method
+ * <LI><CODE>{@link ActionRequest} actionRequest</CODE>, when included from within the <CODE>processAction</CODE> method
+ * <LI><CODE>{@link EventRequest} eventRequest</CODE>, when included from within the <CODE>processEvent</CODE> method
+ * <LI><CODE>{@link RenderResponse} renderResponse</CODE>, when included from within the <CODE>render</CODE> method
+ * <LI><CODE>{@link ResourceResponse} resourceResponse</CODE>, when included from within the <CODE>serveResource</CODE> method
+ * <LI><CODE>{@link ActionResponse} actionResponse</CODE>, when included from within the <CODE>processAction</CODE> method
+ * <LI><CODE>{@link EventResponse} eventResponse</CODE>, when included from within the <CODE>processEvent</CODE> method
+ * <LI><CODE>{@link PortletConfig} portletConfig</CODE>
+ * <LI><CODE>{@link PortletSession} portletSession</CODE>
+ * <LI><CODE>{@link PortletPreferences} portletPreferences</CODE>
+ * </UL>
+ *
+ * @version 2.0
+ */
+public class DefineObjectsTag extends TagSupport {
+
+ /**
+ * Helper method.
+ * <p>
+ * Sets an pageContext attribute with <CODE>PAGE_SCOPE</CODE>.
+ *
+ * @param attribute - the attribute object to set
+ * @param attributeName - the name of the attribute object
+ *
+ * @return void
+ */
+ private void setAttribute(Object attribute, String attributeName)
+ {
+ if (pageContext.getAttribute(attributeName) == null) //Set attributes only once
+ {
+ pageContext.setAttribute(attributeName,
+ attribute,
+ PageContext.PAGE_SCOPE);
+ }
+ }
+
+ /**
+ * Helper method.
+ * <p>
+ * Sets render and request attribute with the names described in the
+ * JSR 286 - PLT 25.1 (defineObjects Tag).
+ * @param request PortletRequest
+ * @param response PortletResponse
+ * @return void
+ */
+ private void setReqRes(PortletRequest request,PortletResponse response )
+ {
+ //check where request and response where included from
+ if(request instanceof RenderRequest)
+ {
+ setAttribute(request,"renderRequest");
+ setAttribute(response,"renderResponse");
+ }
+
+ else if(request instanceof ResourceRequest)
+ {
+ setAttribute(request,"resourceRequest");
+ setAttribute(response,"resourceResponse");
+ }
+
+ else if(request instanceof ActionRequest)
+ {
+ setAttribute(request,"actionRequest");
+ setAttribute(response,"actionResponse");
+ }
+
+ else if(request instanceof EventRequest)
+ {
+ setAttribute(request,"eventRequest");
+ setAttribute(response,"eventResponse");
+ }
+ }
+
+
+ /**
+ * Processes the <CODE>defineObjects</CODE> tag.
+ * @return <CODE>SKIP_BODY</CODE>
+ */
+ public int doStartTag() throws JspException {
+ PortletRequest request = (PortletRequest) pageContext.getRequest()
+ .getAttribute(Constants.PORTLET_REQUEST);
+ PortletResponse response = (PortletResponse) pageContext.getRequest()
+ .getAttribute(Constants.PORTLET_RESPONSE);
+ PortletConfig portletConfig = (PortletConfig) pageContext.getRequest()
+ .getAttribute(Constants.PORTLET_CONFIG);
+
+ PortletSession portletSession=request.getPortletSession();
+
+ PortletPreferences portletPreferences = request.getPreferences();
+
+ // set attributes render and request
+ setReqRes(request,response);
+
+ // set attribute portletConfig
+ setAttribute(portletConfig,"portletConfig");
+
+ // set attribute portletSession
+ setAttribute(portletSession,"portletSession");
+
+ // set attribute portletPreferences
+ setAttribute(portletPreferences,"portletPreferences");
+
+ return SKIP_BODY;
+ }
+
+ public static class TEI extends TagExtraInfo {
+
+ public VariableInfo[] getVariableInfo(TagData tagData) {
+ VariableInfo[] info = new VariableInfo[]{
+ new VariableInfo("renderRequest",
+ "javax.portlet.RenderRequest",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("renderResponse",
+ "javax.portlet.RenderResponse",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("resourceRequest",
+ "javax.portlet.ResourceRequest",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("resourceResponse",
+ "javax.portlet.ResourceResponse",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("actionRequest",
+ "javax.portlet.ActionRequest",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("actionResponse",
+ "javax.portlet.ActionResponse",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("eventRequest",
+ "javax.portlet.EventRequest",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("eventResponse",
+ "javax.portlet.EventResponse",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("portletConfig",
+ "javax.portlet.PortletConfig",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("portletPreferences",
+ "javax.portlet.PortletPreferences",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("portletSession",
+ "javax.portlet.PortletSession",
+ true,
+ VariableInfo.AT_BEGIN)
+ };
+
+ return info;
+ }
+ }
+}
+
Added: portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/NamespaceTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/NamespaceTag.java?view=auto&rev=562725
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/NamespaceTag.java (added)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/NamespaceTag.java Sat Aug 4 07:41:23 2007
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.tags;
+
+import javax.portlet.PortletResponse;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.tagext.TagSupport;
+import java.io.IOException;
+
+/**
+ * This tag produces a unique value for the current portlet.
+ * <p/>
+ * <p/>
+ * A tag handler for the <CODE>namespace</CODE> tag. writes a unique value
+ * for the current portlet <BR>This tag has no attributes
+ */
+public class NamespaceTag extends TagSupport {
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.tagext.Tag#doStartTag()
+ */
+ public int doStartTag() throws JspException {
+ PortletResponse portletResponse = (PortletResponse) pageContext.getRequest()
+ .getAttribute(Constants.PORTLET_RESPONSE);
+ String namespace = portletResponse.getNamespace();
+ JspWriter writer = pageContext.getOut();
+ try {
+ writer.print(namespace);
+ } catch (IOException ioe) {
+ throw new JspException(
+ "Unable to write namespace", ioe
+ );
+ }
+ return SKIP_BODY;
+ }
+}
Added: portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java?view=auto&rev=562725
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java (added)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java Sat Aug 4 07:41:23 2007
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.tags;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.TagSupport;
+
+
+/**
+ * A tag handler for the <CODE>param</CODE> tag. Defines a parameter that
+ * can be added to a <CODE>actionURL</CODE>, a <CODE>resourceURL</CODE> or a <CODE>renderURL</CODE>
+ * <BR>The following attributes are mandatory:
+ * <UL>
+ * <LI><CODE>name</CODE>
+ * <LI><CODE>value</CODE>
+ * </UL>
+ *
+ * @version 2.0
+ */
+public class ParamTag extends TagSupport {
+
+ private String name;
+ private String value;
+
+ /**
+ * Processes the <CODE>param</CODE> tag.
+ * @return <CODE>SKIP_BODY</CODE>
+ */
+ public int doStartTag() throws JspException {
+ BaseURLTag urlTag = (BaseURLTag)
+ findAncestorWithClass(this, BaseURLTag.class);
+
+ if (urlTag == null) {
+ throw new JspException(
+ "the 'param' Tag must have actionURL, renderURL or resourceURL as a parent");
+ }
+
+ urlTag.addParameter(getName(), getValue());
+
+ return SKIP_BODY;
+ }
+
+ /**
+ * Returns the name.
+ * @return String
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns the value.
+ * @return String
+ */
+ public String getValue() throws JspException {
+ if (value == null) {
+ value = "";
+ }
+ return value;
+ }
+
+ /**
+ * Sets the name.
+ * @param name The name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets the value.
+ * @param value The value to set
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+}
Added: portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/PortletURLTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/PortletURLTag.java?view=auto&rev=562725
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/PortletURLTag.java (added)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/PortletURLTag.java Sat Aug 4 07:41:23 2007
@@ -0,0 +1,325 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.tags;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.Map;
+
+import javax.portlet.PortletModeException;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletURL;
+import javax.portlet.PortletMode;
+import javax.portlet.WindowState;
+import javax.portlet.WindowStateException;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Abstract supporting class for actionURL tag and renderURL tag.
+ *
+ * @version 2.0
+ */
+
+public abstract class PortletURLTag extends BaseURLTag {
+
+ /**
+ * TagExtraInfo class for PortletURLTag.
+ */
+ public static class TEI extends BaseURLTag.TEI {
+ public final static Hashtable definedWindowStates = getDefinedWindowStates();
+ public final static Hashtable portletModes = getDefinedPortletModes();
+
+ /**
+ * Provides a list of all static PortletMode available in the
+ * specifications by using introspection
+ * @return Hashtable
+ */
+ private static Hashtable getDefinedPortletModes() {
+ Hashtable<String,Object> portletModes = new Hashtable<String,Object>();
+ Field[] f = PortletMode.class.getDeclaredFields();
+
+ for (int i = 0; i < f.length; i++) {
+ if (f[i].getType().isAssignableFrom(
+ javax.portlet.PortletMode.class)) {
+ try {
+ portletModes.put(
+ f[i].get(f[i]).toString().toUpperCase(),
+ f[i].get(f[i]));
+ } catch (IllegalAccessException e) {
+ }
+ }
+ }
+
+ return portletModes;
+ }
+
+ /**
+ * Provides a list of all static WindowsStates available in the
+ * specifications by using introspection
+ * @return Hashtable
+ */
+ private static Hashtable getDefinedWindowStates() {
+ Hashtable<String,Object> definedWindowStates = new Hashtable<String,Object>();
+ Field[] f = WindowState.class.getDeclaredFields();
+
+ for (int i = 0; i < f.length; i++) {
+ if (f[i].getType().isAssignableFrom(
+ javax.portlet.WindowState.class)) {
+ try {
+ definedWindowStates.put(
+ f[i].get(f[i]).toString().toUpperCase(),
+ f[i].get(f[i]));
+ } catch (IllegalAccessException e) {
+
+ }
+ }
+ }
+ return definedWindowStates;
+ }
+
+ }
+
+ protected String portletMode;
+ protected String windowState;
+ protected Boolean copyCurrentRenderParameters=false;
+ protected PortletURL url;
+
+
+ /**
+ * Process the start tag for this instance.
+ * @throws JspException
+ * @return EVAL_BODY_INCLUDE
+ */
+ public int doStartTag() throws JspException {
+
+ //parameters= new HashMap<String,List<String>> ();
+
+ if(copyCurrentRenderParameters)
+ {
+ doCopyCurrentRenderParameters();
+ }
+
+ if (var != null) {
+ pageContext.removeAttribute(var, PageContext.PAGE_SCOPE);
+ }
+ PortletResponse portletResponse = (PortletResponse) pageContext.getRequest()
+ .getAttribute(Constants.PORTLET_RESPONSE);
+
+ if (portletResponse != null) {
+
+ setUrl(createPortletUrl(portletResponse));
+
+ if (portletMode != null) {
+ try {
+ PortletMode mode = (PortletMode)
+ TEI.portletModes.get(portletMode.toUpperCase());
+
+ if (mode == null) {
+ mode = new PortletMode(portletMode);// support for custom portlet modes PLUTO-258
+ }
+ url.setPortletMode(mode);
+ } catch (PortletModeException e) {
+ throw new JspException(e);
+ }
+ }
+
+ if (windowState != null) {
+ try {
+ WindowState state = (WindowState)
+ TEI.definedWindowStates.get(windowState.toUpperCase());
+ if (state == null) {
+ state = new WindowState(windowState);//support for custom window states PLUTO-258
+ }
+ url.setWindowState(state);
+ } catch (WindowStateException e) {
+ throw new JspException(e);
+ }
+ }
+
+ if (secure != null) {
+ try {
+ url.setSecure(getSecureBoolean());
+ } catch (PortletSecurityException e) {
+ throw new JspException(e);
+ }
+ }
+ }
+ return EVAL_BODY_INCLUDE;
+ }
+
+
+ /**
+ * Process the end tag for this instance.
+ * @throws JspException
+ * @return EVAL_PAGE
+ */
+ public int doEndTag() throws JspException{
+
+ setUrlParameters(url);
+
+
+ HttpServletResponse response=(HttpServletResponse) pageContext.getResponse();
+ // properly encoding urls to allow non-cookie enabled sessions - PLUTO-252
+ String urlString=response.encodeURL(url.toString());
+
+ if(escapeXml){
+ urlString=doEscapeXml(urlString);
+ }
+
+ if (var == null) {
+ try {
+ JspWriter writer = pageContext.getOut();
+ writer.print(urlString);
+ } catch (IOException ioe) {
+ throw new JspException(
+ "actionURL/renderURL Tag Exception: cannot write to the output writer.");
+ }
+ }
+ else {
+ pageContext.setAttribute(var, urlString,
+ PageContext.PAGE_SCOPE);
+ }
+
+ parameters.clear();//cleanup
+
+ return EVAL_PAGE;
+ }
+
+
+ /**
+ * Returns the url property.
+ * @return PortletURL
+ */
+ public PortletURL getUrl() {
+ return url;
+ }
+
+
+ /**
+ * Returns the portletMode property.
+ * @return String
+ */
+ public String getPortletMode() {
+ return portletMode;
+ }
+
+
+ /**
+ * Returns the windowState property.
+ * @return String
+ */
+ public String getWindowState() {
+ return windowState;
+ }
+
+
+ /**
+ * Returns the copyCurrentRenderParameters property.
+ * @return Boolean
+ */
+ public Boolean getCopyCurrentRenderParameters() {
+ return copyCurrentRenderParameters;
+ }
+
+
+ /**
+ * Sets the url property.
+ * @param url The url to set
+ * @return void
+ */
+ public void setUrl(PortletURL url) {
+ this.url = url;
+ }
+
+
+ /**
+ * Sets the portletMode property.
+ * @param portletMode - the portlet mode to set
+ * @return void
+ */
+ public void setPortletMode(String portletMode) {
+ this.portletMode = portletMode;
+ }
+
+
+ /**
+ * Sets the windowState property.
+ * @param windowState - the portlet window state to set
+ * @return void
+ */
+ public void setWindowState(String windowState) {
+ this.windowState = windowState;
+ }
+
+
+ /**
+ * Sets copyCurrentRenderParameters property.
+ * @param copyCurrentRenderParameters
+ * @return void
+ */
+ public void setCopyCurrentRenderParameters(Boolean copyCurrentRenderParameters) {
+ this.copyCurrentRenderParameters = copyCurrentRenderParameters;
+ }
+
+
+ /**
+ * Copies the current render parameters to the parameter map.
+ * @return void
+ */
+ protected void doCopyCurrentRenderParameters()
+ {
+ PortletRequest request = (PortletRequest) pageContext.getRequest()
+ .getAttribute(Constants.PORTLET_REQUEST);
+ if(request!=null)
+ {
+ Map<String,String[]> renderParamsMap=request.getParameterMap();
+ Set<String> keys=renderParamsMap.keySet();
+ Iterator i=keys.iterator();
+ while(i.hasNext())
+ {
+ String key=(String) i.next();
+ String[] values=renderParamsMap.get(key);
+ List<String> valuesList=new ArrayList<String>();
+ int index=0;
+ while(index<values.length){
+ valuesList.add(values[index]);
+ index++;
+ }
+ parameters.put(key,valuesList);
+ }
+ }
+ }
+
+
+ /**
+ * Creates an actionURL or a renderURL
+ * @param portletResponse PortletResponse
+ * @return PortletURL
+ */
+ protected abstract PortletURL createPortletUrl(PortletResponse portletResponse);
+
+}
Added: portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/RenderURLTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/RenderURLTag.java?view=auto&rev=562725
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/RenderURLTag.java (added)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/RenderURLTag.java Sat Aug 4 07:41:23 2007
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.tags;
+
+
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletURL;
+
+
+/**
+ * A tag handler for the <CODE>renderURL</CODE> tag,which creates a url that
+ * points to the current Portlet and triggers a render request with the
+ * supplied parameters.
+ *
+ * @version 2.0
+ */
+public class RenderURLTag extends PortletURLTag {
+
+
+ /**
+ * Creates a renderURL
+ * @param portletResponse PortletResponse
+ * @return PortletURL
+ */
+ protected PortletURL createPortletUrl(PortletResponse portletResponse)
+ {
+ return portletResponse.createRenderURL();
+ }
+
+}
+
Added: portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ResourceURLTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ResourceURLTag.java?view=auto&rev=562725
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ResourceURLTag.java (added)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ResourceURLTag.java Sat Aug 4 07:41:23 2007
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.tags;
+
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.portlet.BaseURL;
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletSecurityException;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.PageContext;
+
+
+/**
+ * A tag handler for the <CODE>resourceURL</CODE> tag,which creates a url that
+ * points to the current Portlet and triggers a resource request with the
+ * supplied parameters.
+ *
+ * @version 2.0
+ */
+
+public class ResourceURLTag extends BaseURLTag {
+
+ protected BaseURL url;
+
+ /**
+ * Process the start tag for this instance.
+ * @throws JspException
+ * @return EVAL_BODY_INCLUDE
+ */
+ public int doStartTag() throws JspException {
+ parameters= new HashMap<String,List<String>> ();
+ if (var != null) {
+ pageContext.removeAttribute(var, PageContext.PAGE_SCOPE);
+ }
+ PortletResponse portletResponse = (PortletResponse) pageContext.getRequest()
+ .getAttribute(Constants.PORTLET_RESPONSE);
+
+ if (portletResponse != null) {
+ setUrl(portletResponse.createResourceURL());
+ if (secure != null) {
+ try {
+ url.setSecure(getSecureBoolean());
+ } catch (PortletSecurityException e) {
+ throw new JspException(e);
+ }
+ }
+ }
+ return EVAL_BODY_INCLUDE;
+ }
+
+ /**
+ * Process the end tag for this instance.
+ * @throws JspException
+ * @return EVAL_PAGE
+ */
+ public int doEndTag() throws JspException{
+
+ setUrlParameters(url);
+
+ HttpServletResponse response=(HttpServletResponse) pageContext.getResponse();
+
+ String urlString=response.encodeURL(url.toString());
+
+ if(escapeXml)
+ {
+ urlString=doEscapeXml(urlString);
+ }
+
+ if (var == null) {
+ try {
+ JspWriter writer = pageContext.getOut();
+ writer.print(urlString);
+ } catch (IOException ioe) {
+ throw new JspException(
+ "resourceURL Tag Exception: cannot write to the output writer.");
+ }
+ } else {
+ pageContext.setAttribute(var, urlString,
+ PageContext.PAGE_SCOPE);
+ }
+
+ parameters.clear();//cleanup
+
+ return EVAL_PAGE;
+ }
+
+ /**
+ * Gets the url property.
+ * @return BaseURL
+ */
+ public BaseURL getUrl() {
+ return url;
+ }
+
+ /**
+ * Sets the url porperty.
+ * @param url BaseUrl - The url to set.
+ * @return void
+ */
+ public void setUrl(BaseURL url) {
+ this.url = url;
+ }
+}
Added: portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/el/ParamTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/el/ParamTag.java?view=auto&rev=562725
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/el/ParamTag.java (added)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/el/ParamTag.java Sat Aug 4 07:41:23 2007
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pluto.tags.el;
+
+import javax.servlet.jsp.el.ExpressionEvaluator;
+import javax.servlet.jsp.el.ELException;
+import javax.servlet.jsp.JspException;
+
+
+public class ParamTag extends org.apache.pluto.tags.ParamTag {
+
+ public String getValue() throws JspException {
+ String string = super.getValue();
+
+ ExpressionEvaluator eval = pageContext.getExpressionEvaluator();
+
+ try {
+ Object evaluated = eval.evaluate(
+ string,
+ Object.class,
+ pageContext.getVariableResolver(),
+ null
+ );
+
+ if(evaluated != null) {
+ string = evaluated.toString();
+ }
+
+ }
+ catch(ELException el) {
+ throw new JspException(el);
+ }
+ return string;
+ }
+
+}