JBoss Portal SVN: r9728 - docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: mmcallis
Date: 2008-02-04 02:32:17 -0500 (Mon, 04 Feb 2008)
New Revision: 9728
Modified:
docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/installation.xml
Log:
adding para on jboss_home, changing all
jboss_install_directories to $JBOSS_HOME
Modified: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/installation.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/installation.xml 2008-02-04 06:49:33 UTC (rev 9727)
+++ docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/installation.xml 2008-02-04 07:32:17 UTC (rev 9728)
@@ -2,8 +2,11 @@
<chapter id="installation">
<title>Installation</title>
<para>Depending on your needs, there are several different methods to install JBoss Portal. Pre-configured clustered versions (<computeroutput>JBoss Portal Binary (Clustered)</computeroutput>) are available from the
- <ulink url="http://labs.jboss.com/portal/jbossportal/download/index.html">JBoss Portal Downloads</ulink> page. Clustered versions of JBoss Portal must be deployed in the <filename>JBOSS_INSTALLATION_DIRECTORY/server/all/deploy/</filename> directory. All JBoss AS instances must reference the same datasource. See <xref linkend="clustering"/> for details on how to configure JBoss Portal for clustering.
+ <ulink url="http://labs.jboss.com/portal/jbossportal/download/index.html">JBoss Portal Downloads</ulink> page. Clustered versions of JBoss Portal must be deployed in the <filename>JBOSS_INSTALLATION_DIRECTORY/server/all/deploy/</filename> directory. All JBoss AS instances must reference the same datasource. See <xref linkend="install_source_env"/> for details on how to configure JBoss Portal for clustering.
</para>
+ <para>
+ An environment variable, <computeroutput>JBOSS_HOME</computeroutput>, is configured in <xref linkend="install_source_env"/>. References to <computeroutput>$JBOSS_HOME</computeroutput> assume this to be your <replaceable>JBOSS_INSTALLATION_DIRECTORY</replaceable>.
+ </para>
<sect1 id="install_bundle">
<title>The JBoss Portal and JBoss AS Bundle</title>
<para>This is the easiest and fastest way to get JBoss Portal installed and running. The JBoss Portal and JBoss AS bundle contains JBoss AS, JBoss Portal, and the embedded Hypersonic SQL database. To install the JBoss Portal and JBoss AS bundle:
@@ -105,7 +108,7 @@
</listitem>
<listitem>
<para>
- <emphasis role="bold">Deploy a RDBMS JDBC connector:</emphasis> a RDBMS JDBC connector is required for JBoss Portal to communicate with a database. Copy the connector into the <filename>JBOSS_INSTALL_DIRECTORY/server/default/lib/</filename> directory. For example, a RDBMS JDBC connector for MySQL can be download from <ulink url="http://www.mysql.com/products/connector/j/"></ulink>. For the correct RDMBS JDBC connector, please refer to the database documentation.
+ <emphasis role="bold">Deploy a RDBMS JDBC connector:</emphasis> a RDBMS JDBC connector is required for JBoss Portal to communicate with a database. Copy the connector into the <filename>$JBOSS_HOME/server/default/lib/</filename> directory. For example, a RDBMS JDBC connector for MySQL can be download from <ulink url="http://www.mysql.com/products/connector/j/"></ulink>. For the correct RDMBS JDBC connector, please refer to the database documentation.
</para>
</listitem>
</orderedlist>
@@ -122,7 +125,7 @@
</imageobject>
</mediaobject>
<para>
- Copy the Datasource descriptor that matches your database into the <filename>JBOSS_INSTALLATION_DIRECTORY/server/<replaceable>configuration</replaceable>/deploy/</filename> directory, where <replaceable>configuration</replaceable> is either all, default, minimal, or production. For example, if you are using the production configuration, copy the Datasource descriptor into the <filename>JBOSS_INSTALLATION_DIRECTORY/server/production/deploy/</filename> directory.
+ Copy the Datasource descriptor that matches your database into the <filename>$JBOSS_HOME/server/<replaceable>configuration</replaceable>/deploy/</filename> directory, where <replaceable>configuration</replaceable> is either all, default, minimal, or production. For example, if you are using the production configuration, copy the Datasource descriptor into the <filename>$JBOSS_HOME/server/production/deploy/</filename> directory.
</para>
<para>
After the Datasource descriptor has been copied into the <filename>deploy</filename> directory, make sure the username, password, connection-url, and driver-class are correct for your chosen database. Datasource descriptor files can be deployed to test before being used in production. The following is an example Datasource descriptor for the PostgreSQL database:
@@ -153,12 +156,12 @@
<orderedlist>
<listitem>
<para>
- <emphasis role="bold">Datasource descriptor:</emphasis> if you have not done so already, change into the <filename>setup</filename> subdirectory where the JBoss Portal binary was extracted to. Copy the correct Datasource descriptor file (<filename>*-ds.xml</filename>) you modified in the previous steps into the <filename>JBOSS_INSTALLATION_DIRECTORY/server/<replaceable>configuration</replaceable>/deploy/</filename> directory.
+ <emphasis role="bold">Datasource descriptor:</emphasis> if you have not done so already, change into the <filename>setup</filename> subdirectory where the JBoss Portal binary was extracted to. Copy the correct Datasource descriptor file (<filename>*-ds.xml</filename>) you modified in the previous steps into the <filename>$JBOSS_HOME/server/<replaceable>configuration</replaceable>/deploy/</filename> directory.
</para>
</listitem>
<listitem>
<para>
- <emphasis role="bold">Start the server:</emphasis> change into the <filename>JBOSS_INSTALLATION_DIRECTORY/bin/</filename> directory. On Microsoft Windows, execute <command>run.bat</command>. On Linux, run the <command>./run.sh</command> command.
+ <emphasis role="bold">Start the server:</emphasis> change into the <filename>$JBOSS_HOME/bin/</filename> directory. On Microsoft Windows, execute <command>run.bat</command>. On Linux, run the <command>./run.sh</command> command.
</para>
</listitem>
<listitem>
@@ -327,7 +330,7 @@
<title>Building and Deploying from the Sources</title>
<para>
During the first build, third-party libraries will be obtained from an online
- repository, so you must be connected to the Internet, and if you are behind a proxy server, you need to define your proxy server address and proxy server port number. If you are running Linux, add the following line to the <filename>JBOSS_INSTALLATION_DIRECTORY/bin/run.sh</filename> file:
+ repository, so you must be connected to the Internet, and if you are behind a proxy server, you need to define your proxy server address and proxy server port number. If you are running Linux, add the following line to the <filename>$JBOSS_HOME/bin/run.sh</filename> file:
</para>
<para>
<screen>
@@ -335,7 +338,7 @@
</screen>
</para>
<para>
- Replace <replaceable>proxy-hostname</replaceable> with the proxy server's hostname, and <replaceable>proxy-port</replaceable> with the correct proxy server port number. If you are running Microsoft Windows, add the following line to the <filename>JBOSS_INSTALLATION_DIRECTORY/bin/run.bat</filename> file:
+ Replace <replaceable>proxy-hostname</replaceable> with the proxy server's hostname, and <replaceable>proxy-port</replaceable> with the correct proxy server port number. If you are running Microsoft Windows, add the following line to the <filename>$JBOSS_HOME/bin/run.bat</filename> file:
</para>
<para>
<screen>
@@ -348,7 +351,7 @@
<para>To build and deploy JBoss Portal from the sources, change into the <filename>JBOSS_PORTAL_HOME_DIRECTORY/build/</filename> directory. Then, Microsoft Windows users need to run the <command>build.bat deploy</command> command, and Linux users need to run the <command>./build.sh deploy</command> command.
</para>
<para>
- At the end of the build process, the <filename>jboss-portal.sar</filename> file is copied into the <filename>JBOSS_HOME/server/default/deploy/</filename> directory:
+ At the end of the build process, the <filename>jboss-portal.sar</filename> file is copied into the <filename>$JBOSS_HOME/server/default/deploy/</filename> directory:
</para>
<para>
<mediaobject>
@@ -390,7 +393,7 @@
</screen>
</para>
<para>
- After the <command>./build.sh deploy-ha</command> command completes, the <filename>jboss-portal-ha.sar</filename> file is copied into the <filename>JBOSS_HOME/server/all/deploy/</filename> directory.
+ After the <command>./build.sh deploy-ha</command> command completes, the <filename>jboss-portal-ha.sar</filename> file is copied into the <filename>$JBOSS_HOME/server/all/deploy/</filename> directory.
</para>
</listitem>
</orderedlist>
@@ -421,7 +424,7 @@
</listitem>
<listitem>
<para>
- <emphasis role="bold">Deploy a RDBMS JDBC connector:</emphasis> a RDBMS JDBC connector is required for JBoss Portal to communicate with a database. Copy the connector into the <filename>JBOSS_INSTALL_DIRECTORY/server/default/lib/</filename> directory. For example, a RDBMS JDBC connector for MySQL can be download from <ulink url="http://www.mysql.com/products/connector/j/"></ulink>. For the correct RDMBS JDBC connector, please refer to the database documentation.
+ <emphasis role="bold">Deploy a RDBMS JDBC connector:</emphasis> a RDBMS JDBC connector is required for JBoss Portal to communicate with a database. Copy the connector into the <filename>$JBOSS_HOME/server/default/lib/</filename> directory. For example, a RDBMS JDBC connector for MySQL can be download from <ulink url="http://www.mysql.com/products/connector/j/"></ulink>. For the correct RDMBS JDBC connector, please refer to the database documentation.
</para>
</listitem>
</orderedlist>
@@ -438,7 +441,7 @@
</imageobject>
</mediaobject>
<para>
- Copy the Datasource descriptor that matches your database into the <filename>JBOSS_INSTALLATION_DIRECTORY/server/<replaceable>configuration</replaceable>/deploy/</filename> directory, where <replaceable>configuration</replaceable> is either all, default, minimal, or production. For example, if you are using the production configuration, copy the Datasource descriptor into the <filename>JBOSS_INSTALLATION_DIRECTORY/server/production/deploy/</filename> directory.
+ Copy the Datasource descriptor that matches your database into the <filename>$JBOSS_HOME/server/<replaceable>configuration</replaceable>/deploy/</filename> directory, where <replaceable>configuration</replaceable> is either all, default, minimal, or production. For example, if you are using the production configuration, copy the Datasource descriptor into the <filename>$JBOSS_HOME/server/production/deploy/</filename> directory.
</para>
<para>
After the Datasource descriptor has been copied into the <filename>deploy</filename> directory, make sure the username, password, connection-url, and driver-class are correct for your chosen database. Datasource descriptor files can be deployed to test before being used in production. The following is an example Datasource descriptor for the PostgreSQL database:
@@ -469,12 +472,12 @@
<orderedlist>
<listitem>
<para>
- <emphasis role="bold">Datasource descriptor:</emphasis> if you have not done so already, change into the <filename>setup</filename> subdirectory where the JBoss Portal binary was extracted to. Copy the correct Datasource descriptor file (<filename>*-ds.xml</filename>) you modified in the previous steps into the <filename>JBOSS_INSTALLATION_DIRECTORY/server/<replaceable>configuration</replaceable>/deploy/</filename> directory.
+ <emphasis role="bold">Datasource descriptor:</emphasis> if you have not done so already, change into the <filename>setup</filename> subdirectory where the JBoss Portal binary was extracted to. Copy the correct Datasource descriptor file (<filename>*-ds.xml</filename>) you modified in the previous steps into the <filename>$JBOSS_HOME/server/<replaceable>configuration</replaceable>/deploy/</filename> directory.
</para>
</listitem>
<listitem>
<para>
- <emphasis role="bold">Start the server:</emphasis> change into the <filename>JBOSS_INSTALLATION_DIRECTORY/bin/</filename> directory. On Microsoft Windows, execute <command>run.bat</command>. On Linux, run the <command>./run.sh</command> command.
+ <emphasis role="bold">Start the server:</emphasis> change into the <filename>$JBOSS_HOME/bin/</filename> directory. On Microsoft Windows, execute <command>run.bat</command>. On Linux, run the <command>./run.sh</command> command.
</para>
</listitem>
<listitem>
18 years, 2 months
JBoss Portal SVN: r9727 - docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: mmcallis
Date: 2008-02-04 01:49:33 -0500 (Mon, 04 Feb 2008)
New Revision: 9727
Modified:
docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/installation.xml
Log:
minor corrections...
2.1. The JBoss Portal and JBoss AS Bundle
Modified: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/installation.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/installation.xml 2008-02-04 04:44:30 UTC (rev 9726)
+++ docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/installation.xml 2008-02-04 06:49:33 UTC (rev 9727)
@@ -5,7 +5,7 @@
<ulink url="http://labs.jboss.com/portal/jbossportal/download/index.html">JBoss Portal Downloads</ulink> page. Clustered versions of JBoss Portal must be deployed in the <filename>JBOSS_INSTALLATION_DIRECTORY/server/all/deploy/</filename> directory. All JBoss AS instances must reference the same datasource. See <xref linkend="clustering"/> for details on how to configure JBoss Portal for clustering.
</para>
<sect1 id="install_bundle">
- <title>JBoss Portal and JBoss AS Bundle</title>
+ <title>The JBoss Portal and JBoss AS Bundle</title>
<para>This is the easiest and fastest way to get JBoss Portal installed and running. The JBoss Portal and JBoss AS bundle contains JBoss AS, JBoss Portal, and the embedded Hypersonic SQL database. To install the JBoss Portal and JBoss AS bundle:
</para>
<para>
@@ -22,7 +22,7 @@
</listitem>
<listitem>
<para>
- <emphasis role="bold">Start the server:</emphasis> change into the <filename>JBOSS_INSTALLATION_DIRECTORY/bin/</filename> directory. On Microsoft Windows, execute <command>run.bat</command>. On Linux, run the <command>./run.sh</command> command.
+ <emphasis role="bold">Start the server:</emphasis> change into the <filename>JBOSS_PORTAL_INSTALLATION_DIRECTORY/bin/</filename> directory. On Microsoft Windows, execute <command>run.bat</command>. On Linux, run the <command>./run.sh</command> command.
</para>
</listitem>
<listitem>
@@ -163,8 +163,15 @@
</listitem>
<listitem>
<para>
- <emphasis role="bold">Log in to JBoss Portal:</emphasis> using a Web browser, navigate to <computeroutput>http://localhost:8080/portal</computeroutput> to open the JBoss Portal homepage. Log in using one of the two default accounts: username <emphasis>user</emphasis>, password <emphasis>user</emphasis>, or username <emphasis>admin</emphasis>, password <emphasis>admin</emphasis>.
+ <emphasis role="bold">Log in to JBoss Portal:</emphasis> using a Web browser, navigate to <computeroutput>http://localhost:8080/portal</computeroutput> to open the JBoss Portal homepage. Log in using one of the two default accounts: username <emphasis>user</emphasis>, password <emphasis>user</emphasis>, or username <emphasis>admin</emphasis>, password <emphasis>admin</emphasis>:
</para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" valign="middle" fileref="images/frontpage.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
</listitem>
</orderedlist>
</para>
@@ -253,11 +260,17 @@
</para>
</sect2>
<sect2>
- <title>Setting up the JBoss Application Server</title>
+ <title>JBoss EAP and JBoss AS Setup</title>
<sect3>
<title>JBoss Application Server Setup</title>
<para>Before deploying JBoss Portal, make sure you have JBoss EAP or JBoss AS installed. Customers who have access to the <ulink url="https://support.redhat.com/portal/login.html">JBoss Customer Support Portal (CSP)</ulink> should download and install JBoss EAP 4.2. Customers who do not have access to the JBoss CSP are advised to use <ulink url="http://labs.jboss.com/jbossas/downloads/">JBoss AS</ulink>. For JBoss AS installation instructions, please refer to the <ulink url="http://labs.jboss.com/jbossas/docs/index.html">JBoss AS Installation Guide</ulink>.
</para>
+ <warning>
+ <title>Use the JBoss EAP and JBoss AS zip file</title>
+ <para>
+ Only use the JBoss EAP and JBoss AS zip file versions. <emphasis role="bold">DO NOT ATTEMPT to deploy JBoss Portal on the installer version of JBoss EAP or JBoss AS.</emphasis> We are currently working on aligning the Application installer with JBoss Portal.
+ </para>
+ </warning>
</sect3>
<sect3 id="install_source_env">
<title>Operating System Environment Settings</title>
@@ -337,11 +350,21 @@
<para>
At the end of the build process, the <filename>jboss-portal.sar</filename> file is copied into the <filename>JBOSS_HOME/server/default/deploy/</filename> directory:
</para>
+ <para>
<mediaobject>
<imageobject>
<imagedata align="center" valign="middle" fileref="images/setup/build_deploy.png"/>
</imageobject>
</mediaobject>
+ </para>
+ <para>
+ <note>
+ <title>Portal Modules</title>
+ <para>
+ The previous steps install a bare version of JBoss Portal. In previous versions, several additional modules were deployed as well, but this has since been modularized to provide greater flexibility. To deploy additional modules, see the <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=PortalModules">Portal's module list</ulink> for more information. To deploy all modules at once, change into the <filename>build</filename> directory. If you are running Linux, run the <command>./build.sh deploy-all</command> command. If you are running Microsoft Windows, run the <command>build.bat deploy-all</command> command.
+ </para>
+ </note>
+ </para>
<para>
To build the clustered version on Linux Operating Systems:
</para>
@@ -485,12 +508,7 @@
</para>
</note>
</sect1>
-<sect1>
- <title>Portal Modules</title>
- <para>
- The previous steps install a bare version of JBoss Portal. In previous versions, several additional modules were deployed as well, but this has since been modularized to provide greater flexibility. To deploy additional modules, see the <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=PortalModules">Portal's module list</ulink> for more information. To deploy all modules at once, change into the <filename>build</filename> directory and run the <command>build deploy-all</command> command.
- </para>
-</sect1>
+
<!--<sect1 id="install_installer">
<title>Installing using the JEMS Installer</title>
<para>As of JBoss 4.0.4GA, users are able to install JBoss Portal using the
18 years, 2 months
JBoss Portal SVN: r9726 - docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: mmcallis
Date: 2008-02-03 23:44:30 -0500 (Sun, 03 Feb 2008)
New Revision: 9726
Modified:
docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/installation.xml
Log:
updating 2.4. Deploying JBoss Portal
2.5. Portal Modules
Modified: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/installation.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/installation.xml 2008-02-04 04:12:45 UTC (rev 9725)
+++ docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/installation.xml 2008-02-04 04:44:30 UTC (rev 9726)
@@ -436,37 +436,61 @@
For further details about Datasource descriptors, please refer to the <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=CreateAJDBCDataSource">JBoss JDBC Datasource wiki page</ulink>.
</para>
</sect2>
- <sect2>
- <title>Starting and running JBoss Portal</title>
- <para>
- <emphasis role="bold">Start the Server:</emphasis>
- Go to JBOSS_HOME/bin and execute run.bat (run.sh, if Linux)
- <note>During the first boot (ever), SQL errors in the log, like the one below, can be safely ignored. They
- are thrown when the portal checks for the existence of the initial tables, before it creates them for
- you.
- <programlisting><![CDATA[16:43:39,234 WARN [JDBCExceptionReporter] SQL Error: -22, SQLState: S0002
-16:43:39,234 ERROR [JDBCExceptionReporter] Table not found in statement ...]]></programlisting>
- </note>
- </para>
- <para>
- Point your browser to
- <emphasis>http://localhost:8080/portal</emphasis>
- , and you should see the Portal HomePage. You can now login using one of the two default accounts:
- <emphasis>user/user</emphasis>
- or
- <emphasis>admin/admin</emphasis>
- .
- <note>
- This installs a bare version of Portal. In previous versions, several additional modules were deployed as
- well but this has since been modularized to provide greater flexibility. You might want to deploy
- additional modules to augment Portal (see
- <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=PortalModules">Portal's module list</ulink> for more
- information). You can also deploy all the modules all at once using <command>build deploy-all</command>
- in the <filename>build</filename> directory.
- </note>
- </para>
- </sect2>
- </sect1>
+</sect1>
+ <sect1>
+ <title>Deploying JBoss Portal</title>
+ <para>
+ To start JBoss EAP or JBoss AS and deploy JBoss Portal:
+ </para>
+ <para>
+ <orderedlist>
+ <listitem>
+ <para>
+ <emphasis role="bold">Datasource descriptor:</emphasis> if you have not done so already, change into the <filename>setup</filename> subdirectory where the JBoss Portal binary was extracted to. Copy the correct Datasource descriptor file (<filename>*-ds.xml</filename>) you modified in the previous steps into the <filename>JBOSS_INSTALLATION_DIRECTORY/server/<replaceable>configuration</replaceable>/deploy/</filename> directory.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis role="bold">Start the server:</emphasis> change into the <filename>JBOSS_INSTALLATION_DIRECTORY/bin/</filename> directory. On Microsoft Windows, execute <command>run.bat</command>. On Linux, run the <command>./run.sh</command> command.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis role="bold">Log in to JBoss Portal:</emphasis> using a Web browser, navigate to <computeroutput>http://localhost:8080/portal</computeroutput> to open the JBoss Portal homepage. Log in using one of the two default accounts: username <emphasis>user</emphasis>, password <emphasis>user</emphasis>, or username <emphasis>admin</emphasis>, password <emphasis>admin</emphasis>:
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" valign="middle" fileref="images/frontpage.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <note>
+ <title>SQL Errors</title>
+ <para>
+ Tables are automatically created the first time JBoss Portal starts. When deployed for the first time, JBoss Portal checks for the existence of the initial tables, which have not been created yet. This causes errors such as the following, which can safely be ignored:
+ </para>
+ <para>
+<programlisting><![CDATA[
+WARN [JDBCExceptionReporter] SQL Error: -22, SQLState: S0002
+ERROR [JDBCExceptionReporter] Table not found in statement ...
+WARN [JDBCExceptionReporter] SQL Error: 1146, SQLState: 42S02
+ERROR [JDBCExceptionReporter] Table 'jbossportal.jbp_cms_repositoryentry' doesn't exist
+WARN [JDBCExceptionReporter] SQL Error: 1146, SQLState: 42S02
+ERROR [JDBCExceptionReporter] Table 'jbossportal.jbp_cms_version_refs' doesn't exist
+]]></programlisting>
+ </para>
+ </note>
+</sect1>
+<sect1>
+ <title>Portal Modules</title>
+ <para>
+ The previous steps install a bare version of JBoss Portal. In previous versions, several additional modules were deployed as well, but this has since been modularized to provide greater flexibility. To deploy additional modules, see the <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=PortalModules">Portal's module list</ulink> for more information. To deploy all modules at once, change into the <filename>build</filename> directory and run the <command>build deploy-all</command> command.
+ </para>
+</sect1>
<!--<sect1 id="install_installer">
<title>Installing using the JEMS Installer</title>
<para>As of JBoss 4.0.4GA, users are able to install JBoss Portal using the
@@ -573,11 +597,5 @@
</sect2>
</sect1>-->
- <para>
- <mediaobject>
- <imageobject>
- <imagedata align="center" valign="middle" fileref="images/frontpage.png"/>
- </imageobject>
- </mediaobject>
- </para>
+
</chapter>
18 years, 2 months
JBoss Portal SVN: r9725 - docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: mmcallis
Date: 2008-02-03 23:12:45 -0500 (Sun, 03 Feb 2008)
New Revision: 9725
Modified:
docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/installation.xml
Log:
updating
2.3.4. Database Setup
2.3.5. Datasource Configuration
Modified: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/installation.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/installation.xml 2008-02-04 01:27:57 UTC (rev 9724)
+++ docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/installation.xml 2008-02-04 04:12:45 UTC (rev 9725)
@@ -377,67 +377,50 @@
</para>
</sect2>
<sect2>
- <title>Setting up the database</title>
- <sect3>
- <title>Database Setup</title>
- <para>You will need a database for JBoss Portal to function, you can use any database
- supported by Hibernate.
- <orderedlist>
- <listitem>
- <para>
- <emphasis role="bold">Create a new Database:</emphasis>
- For example purposes we call this new database
- <emphasis>jbossportal</emphasis>
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis role="bold">Grant access rights for a user to your database:</emphasis>
- You must make sure the user has access to this new DB, as JBoss Portal will need to create the
- tables and modify data within them.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis role="bold">Deploy your JDBC connector:</emphasis>
- You must make available a JDBC connector for JBoss Portal to communicate with your database. The
- connector lib should be placed in
- <filename>JBOSS_HOME/server/default/lib/*</filename>
- </para>
- </listitem>
- </orderedlist>
- </para>
- </sect3>
- <sect3>
- <title>DataSource Configuration</title>
- <para>
- You will need a valid datasource descriptor, for JBoss Portal to communicate with your database. Having
- obtained the sources and having set your JBOSS_HOME environment variable (
- <xref linkend="install_source_env"/>
- ), you can now have the JBoss Portal build system generate preconfigured datasources for you.
- </para>
- <para>
- Navigate to
- <filename>JBOSS_PORTAL_HOME_DIRECTORY/core</filename>
- and type:
- <programlisting>build datasource</programlisting>
- <mediaobject>
- <imageobject>
- <imagedata align="center" valign="middle" fileref="images/setup/build_ds.png"/>
- </imageobject>
- </mediaobject>
- </para>
- <para>
- Once complete, the datasource build should produce the following directory and file structure:
- <mediaobject>
- <imageobject>
- <imagedata align="center" valign="middle" fileref="images/setup/build_ds_dir.png"/>
- </imageobject>
- </mediaobject>
- </para>
- <para>At this point, you should configure the one that suits you best with your Database and JDBC
- driver.
- <programlisting><![CDATA[
+ <title>Database Setup</title>
+ <para>
+ A database is required for JBoss Portal to run. JBoss EAP and JBoss AS include an embedded Hypersonic SQL database that JBoss Portal can use; however, this is only recommended for developer use. The following databases are recommended for production use, and have had test suites run against them: MySQL 4, MySQL 5, Microsoft SQL Server, PostgreSQL 8, Oracle 9, and Oracle 10. JBoss Portal can use any database that is supported by Hibernate.
+ </para>
+ <para>
+ To configure a database to use with JBoss Portal:
+ </para>
+ <para>
+ <orderedlist>
+ <listitem>
+ <para>
+ <emphasis role="bold">Create a new database:</emphasis> this guide assumes that the new database will be called <emphasis>jbossportal</emphasis>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis role="bold">Grant access rights for a user to the <emphasis>jbossportal</emphasis> database:</emphasis> JBoss Portal needs to create tables and modify table data. Grant access rights to a desired user to the <emphasis>jbossportal</emphasis> database. Configure the same username and password in the Datasource descriptor.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis role="bold">Deploy a RDBMS JDBC connector:</emphasis> a RDBMS JDBC connector is required for JBoss Portal to communicate with a database. Copy the connector into the <filename>JBOSS_INSTALL_DIRECTORY/server/default/lib/</filename> directory. For example, a RDBMS JDBC connector for MySQL can be download from <ulink url="http://www.mysql.com/products/connector/j/"></ulink>. For the correct RDMBS JDBC connector, please refer to the database documentation.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ </sect2>
+ <sect2>
+ <title>Datasource Configuration</title>
+ <para>
+ The JBoss Portal binary download that was extracted in <xref linkend="install_binarydownload"/>, contains pre-configured Datasource descriptors for the more popular databases. Datasource descriptors are provided for the MySQL 4, MySQL 5, PostgreSQL, Microsoft SQL Server, and Oracle databases, and can be found in the <filename>setup</filename> subdirectory where the JBoss Portal binary was extracted to:
+ </para>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" valign="middle" fileref="images/setup/dsfiles.png"/>
+ </imageobject>
+ </mediaobject>
+ <para>
+ Copy the Datasource descriptor that matches your database into the <filename>JBOSS_INSTALLATION_DIRECTORY/server/<replaceable>configuration</replaceable>/deploy/</filename> directory, where <replaceable>configuration</replaceable> is either all, default, minimal, or production. For example, if you are using the production configuration, copy the Datasource descriptor into the <filename>JBOSS_INSTALLATION_DIRECTORY/server/production/deploy/</filename> directory.
+ </para>
+ <para>
+ After the Datasource descriptor has been copied into the <filename>deploy</filename> directory, make sure the username, password, connection-url, and driver-class are correct for your chosen database. Datasource descriptor files can be deployed to test before being used in production. The following is an example Datasource descriptor for the PostgreSQL database:
+ </para>
+ <programlisting><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
@@ -448,18 +431,11 @@
<password>portalpassword</password>
</local-tx-datasource>
</datasources>
- ]]></programlisting>
- Please verify that the username, password, url, and driver-class are correct for
- your flavor of DB.
- </para>
- <para>
- Now
- <emphasis role="bold">copy</emphasis>
- your datasource descriptor to
- <filename>JBOSS_HOME/server/default/deploy</filename>
- </para>
- </sect3>
- </sect2>
+ ]]></programlisting>
+ <para>
+ For further details about Datasource descriptors, please refer to the <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=CreateAJDBCDataSource">JBoss JDBC Datasource wiki page</ulink>.
+ </para>
+ </sect2>
<sect2>
<title>Starting and running JBoss Portal</title>
<para>
18 years, 2 months
JBoss Portal SVN: r9724 - in modules/portlet/trunk: portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168 and 9 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-03 20:27:57 -0500 (Sun, 03 Feb 2008)
New Revision: 9724
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletRequestParameterMap.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/ResourceRequestParameterMap.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventRequestImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventResponseImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceRequestImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceResponseImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceURLImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractActionContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractEventContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractRenderContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractResourceContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/ActionInvocation.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/EventInvocation.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvocation.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/ResourceInvocation.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/ActionContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/EventContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/PortletInvocationContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/ResourceInvocationContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/spi/ActionContextSupport.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/spi/PortletInvocationContextSupport.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/spi/RenderContextSupport.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletfilter/PropagateDoFilterArgsFilter1.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletfilter/PropagateDoFilterArgsFilter2.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/ActionContextImpl.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/ResourceTestContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestActionContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestEventContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestRenderContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletController.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletRequestHandler.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletResourceRequestHandler.java
Log:
- refactor input data for a portlet invocation to be on the invocation instead of being on the invocation context
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -33,7 +33,6 @@
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.ParametersStateString;
import org.jboss.portal.portlet.cache.CacheControl;
-import org.jboss.portal.portlet.spi.RenderContext;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.common.invocation.AttributeResolver;
import org.jboss.portal.WindowState;
@@ -62,12 +61,12 @@
//
if (invocation instanceof RenderInvocation)
{
- RenderContext renderCtx = (RenderContext)invocation.getContext();
+ RenderInvocation renderInvocation = (RenderInvocation)invocation;
//
- StateString navState = renderCtx.getNavigationalState();
- WindowState windowState = renderCtx.getWindowState();
- Mode mode = renderCtx.getMode();
+ StateString navState = renderInvocation.getNavigationalState();
+ WindowState windowState = renderInvocation.getWindowState();
+ Mode mode = renderInvocation.getMode();
//
CacheEntry cachedEntry = (CacheEntry)resolver.getAttribute(scopeKey);
@@ -123,12 +122,10 @@
// If no valid fragment we must invoke
if (fragment == null || cachedEntry.expirationTimeMillis < System.currentTimeMillis())
{
- RenderInvocation render = (RenderInvocation)invocation;
-
// Set validation token for revalidation only we have have a fragment
if (fragment != null)
{
- render.setValidationToken(cachedEntry.validationToken);
+ renderInvocation.setValidationToken(cachedEntry.validationToken);
}
// Invoke
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletApplicationImpl.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -222,8 +222,18 @@
for (LifeCyclePhase phase : filterInfo.getLifeCycles())
{
Class<? extends PortletFilter> type = phaseToType.get(phase);
- FilterKey key = new FilterKey(filterInfo.getName(), type);
- filters.put(key, lifeCycle);
+
+ //
+ if (type.isInstance(lifeCycle.getInstance()))
+ {
+ FilterKey key = new FilterKey(filterInfo.getName(), type);
+ filters.put(key, lifeCycle);
+ }
+ else
+ {
+ log.error("Cannot realize filter mapping on phase " + phase + " for filter " + filterInfo.getName() +
+ " with class " + className + " that does not implement the interface " + type.getName());
+ }
}
}
catch (PortletInitializationException e)
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletRequestParameterMap.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletRequestParameterMap.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletRequestParameterMap.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -23,13 +23,13 @@
package org.jboss.portal.portlet.impl.jsr168;
import org.jboss.portal.common.util.ParameterMap;
-import org.jboss.portal.portlet.spi.ActionContext;
-import org.jboss.portal.portlet.spi.EventContext;
-import org.jboss.portal.portlet.spi.RenderContext;
-import org.jboss.portal.portlet.spi.ResourceInvocationContext;
-import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.EventInvocation;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.invocation.ResourceInvocation;
import org.jboss.portal.portlet.info.NavigationInfo;
import java.util.Iterator;
@@ -50,33 +50,33 @@
/**
* Factory method that will chose the right builder according to the context argument type.
*/
- public static PortletRequestParameterMap create(NavigationInfo navigationInfo, PortletInvocationContext context)
+ public static PortletRequestParameterMap create(NavigationInfo navigationInfo, PortletInvocation invocation)
{
- if (context instanceof EventContext)
+ if (invocation instanceof EventInvocation)
{
- return create(navigationInfo, (EventContext)context);
+ return create(navigationInfo, (EventInvocation)invocation);
}
- else if (context instanceof ActionContext)
+ else if (invocation instanceof ActionInvocation)
{
- return create(navigationInfo, (ActionContext)context);
+ return create(navigationInfo, (ActionInvocation)invocation);
}
- else if (context instanceof RenderContext)
+ else if (invocation instanceof RenderInvocation)
{
- return create(navigationInfo, (RenderContext)context);
+ return create(navigationInfo, (RenderInvocation)invocation);
}
else
{
- return ResourceRequestParameterMap.create(navigationInfo, (ResourceInvocationContext)context);
+ return ResourceRequestParameterMap.create(navigationInfo, (ResourceInvocation)invocation);
}
}
- public static PortletRequestParameterMap create(NavigationInfo navigationInfo, EventContext context)
+ public static PortletRequestParameterMap create(NavigationInfo navigationInfo, EventInvocation invocation)
{
// Build public parameters
- ParameterMap publicParameters = safeBuildPublicParameters(navigationInfo, context.getPublicNavigationalState());
+ ParameterMap publicParameters = safeBuildPublicParameters(navigationInfo, invocation.getPublicNavigationalState());
// Get render parameters
- ParameterMap privateParameters = safeBuildParameters(context.getNavigationalState());
+ ParameterMap privateParameters = safeBuildParameters(invocation.getNavigationalState());
// Build combined map
ParameterMap parameters = safeCombine(privateParameters, publicParameters);
@@ -85,7 +85,7 @@
return new PortletRequestParameterMap(parameters, privateParameters, publicParameters);
}
- public static PortletRequestParameterMap create(NavigationInfo navigationInfo, RenderContext context)
+ public static PortletRequestParameterMap create(NavigationInfo navigationInfo, RenderInvocation context)
{
// Build public parameters
ParameterMap publicParameters = safeBuildPublicParameters(navigationInfo, context.getPublicNavigationalState());
@@ -109,16 +109,16 @@
* - getPrivateParameterMap() : the interaction parameter + form parameter
* - getPublicParameterMap() : public render parameter
*/
- public static PortletRequestParameterMap create(NavigationInfo navigationInfo, ActionContext context)
+ public static PortletRequestParameterMap create(NavigationInfo navigationInfo, ActionInvocation invocation)
{
// Build public parameters
- ParameterMap publicParameters = safeBuildPublicParameters(navigationInfo, context.getPublicNavigationalState());
+ ParameterMap publicParameters = safeBuildPublicParameters(navigationInfo, invocation.getPublicNavigationalState());
// The private parameters
- ParameterMap privateParameters = safeBuildParameters(context.getInteractionState());
+ ParameterMap privateParameters = safeBuildParameters(invocation.getInteractionState());
// Combine form if we have one
- privateParameters = safeCombine(privateParameters, context.getForm());
+ privateParameters = safeCombine(privateParameters, invocation.getForm());
// Combine to get shared map
ParameterMap parameters = safeCombine(privateParameters, publicParameters);
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/ResourceRequestParameterMap.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/ResourceRequestParameterMap.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/ResourceRequestParameterMap.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -25,6 +25,7 @@
import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.portlet.info.NavigationInfo;
import org.jboss.portal.portlet.spi.ResourceInvocationContext;
+import org.jboss.portal.portlet.invocation.ResourceInvocation;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -70,19 +71,19 @@
* - getPublicParameterMap() : public render parameter
* - getPrivateRenderParameterMap() : render parameter
*/
- public static ResourceRequestParameterMap create(NavigationInfo navigationInfo, ResourceInvocationContext context)
+ public static ResourceRequestParameterMap create(NavigationInfo navigationInfo, ResourceInvocation invocation)
{
// Build public parameters
- ParameterMap publicParameters = safeBuildPublicParameters(navigationInfo, context.getPublicNavigationalState());
+ ParameterMap publicParameters = safeBuildPublicParameters(navigationInfo, invocation.getPublicNavigationalState());
// Combine private render parameters if any
- ParameterMap privateRenderParameters = safeBuildParameters(context.getNavigationalState());
+ ParameterMap privateRenderParameters = safeBuildParameters(invocation.getNavigationalState());
// The private parameters
- ParameterMap privateParameters = safeBuildParameters(context.getResourceState());
+ ParameterMap privateParameters = safeBuildParameters(invocation.getResourceState());
// Combine form if we have one
- privateParameters = safeCombine(privateParameters, context.getForm());
+ privateParameters = safeCombine(privateParameters, invocation.getForm());
// Combien with private render parameters
privateParameters = safeCombine(privateParameters, privateRenderParameters);
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventImpl.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventImpl.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168.api;
-import org.jboss.portal.portlet.spi.EventContext;
+import org.jboss.portal.portlet.invocation.EventInvocation;
import javax.portlet.Event;
import javax.xml.namespace.QName;
@@ -36,25 +36,25 @@
{
/** . */
- private final EventContext context;
+ private final EventInvocation invocation;
- public EventImpl(EventContext context)
+ public EventImpl(EventInvocation invocation)
{
- this.context = context;
+ this.invocation = invocation;
}
public QName getQName()
{
- return context.getName();
+ return invocation.getName();
}
public String getName()
{
- return context.getName().getLocalPart();
+ return invocation.getName().getLocalPart();
}
public Serializable getValue()
{
- return context.getPayload();
+ return invocation.getPayload();
}
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventRequestImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventRequestImpl.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventRequestImpl.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -23,7 +23,6 @@
package org.jboss.portal.portlet.impl.jsr168.api;
import org.jboss.portal.portlet.invocation.EventInvocation;
-import org.jboss.portal.portlet.spi.EventContext;
import javax.portlet.EventRequest;
import javax.portlet.Event;
@@ -38,16 +37,22 @@
/** . */
private EventImpl event;
+ /** . */
+ private EventInvocation eventInvocation;
+
public EventRequestImpl(EventInvocation invocation)
{
super(invocation);
+
+ //
+ this.eventInvocation = invocation;
}
public Event getEvent()
{
if (event == null)
{
- event = new EventImpl((EventContext)invocation.getContext());
+ event = new EventImpl(eventInvocation);
}
//
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventResponseImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventResponseImpl.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventResponseImpl.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -23,8 +23,6 @@
package org.jboss.portal.portlet.impl.jsr168.api;
import org.jboss.portal.portlet.invocation.EventInvocation;
-import org.jboss.portal.portlet.spi.PortletInvocationContext;
-import org.jboss.portal.portlet.ParametersStateString;
import javax.portlet.EventResponse;
import javax.portlet.EventRequest;
@@ -54,12 +52,9 @@
}
//
- PortletInvocationContext context = invocation.getContext();
-
- //
WantUpdate update = wantUpdate();
- update.mode = context.getMode();
- update.windowState = context.getWindowState();
+ update.mode = invocation.getMode();
+ update.windowState = invocation.getWindowState();
// update.navigationalState = ParametersStateString.create(context.getNavigationalState()).getParameters();
// update.publicNavigationalState = context.getPublicNavigationalState();
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -163,7 +163,7 @@
this.attributes = new PortletRequestAttributes(container, userContext, realReq);
this.preferences = new PortletPreferencesImpl(prefs, containerPrefs, validator, mode);
this.navigationInfo = navigationInfo;
- this.requestParameterMap = PortletRequestParameterMap.create(navigationInfo, invocation.getContext());
+ this.requestParameterMap = PortletRequestParameterMap.create(navigationInfo, invocation);
this.supportedModes = buildSupportedModes();
this.supportedWindowStates = buildSupportedWindowState();
}
@@ -223,13 +223,13 @@
public WindowState getWindowState()
{
- String s = invocation.getContext().getWindowState().toString();
+ String s = invocation.getWindowState().toString();
return PortletUtils.decodeWindowState(s);
}
public PortletMode getPortletMode()
{
- String s = invocation.getContext().getMode().toString();
+ String s = invocation.getMode().toString();
return PortletUtils.decodePortletMode(s);
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceRequestImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceRequestImpl.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceRequestImpl.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -23,7 +23,6 @@
package org.jboss.portal.portlet.impl.jsr168.api;
import org.jboss.portal.portlet.invocation.ResourceInvocation;
-import org.jboss.portal.portlet.spi.ResourceInvocationContext;
import org.jboss.portal.portlet.impl.jsr168.ResourceRequestParameterMap;
import org.jboss.portal.common.util.MultiValuedPropertyMap;
import org.jboss.portal.common.util.ParameterMap;
@@ -40,23 +39,19 @@
{
/** . */
- private final ResourceInvocationContext resourceContext;
+ private final ResourceInvocation resourceInvocation;
- /** . */
- private final String validationToken;
-
public ResourceRequestImpl(ResourceInvocation invocation)
{
super(invocation);
//
- this.resourceContext = invocation.getContext();
- this.validationToken = invocation.getValidationToken();
+ this.resourceInvocation = invocation;
}
public String getResourceID()
{
- return resourceContext.getResourceId();
+ return resourceInvocation.getResourceId();
}
public Map<String, String[]> getPrivateRenderParameterMap()
@@ -76,19 +71,19 @@
public String getCacheability()
{
- return ResourceURLImpl.toJSR168(resourceContext.getCacheLevel());
+ return ResourceURLImpl.toJSR168(resourceInvocation.getCacheLevel());
}
public String getETag()
{
- return validationToken;
+ return resourceInvocation.getValidationToken();
}
protected void initProperties(MultiValuedPropertyMap<String> properties)
{
- if (validationToken != null)
+ if (resourceInvocation.getValidationToken() != null)
{
- properties.setValue(ETAG, validationToken);
+ properties.setValue(ETAG, resourceInvocation.getValidationToken());
}
}
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceResponseImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceResponseImpl.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceResponseImpl.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -44,7 +44,7 @@
super(invocation, preq);
//
- this.cacheability = invocation.getContext().getCacheLevel();
+ this.cacheability = invocation.getCacheLevel();
}
public void setLocale(Locale locale)
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceURLImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceURLImpl.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ResourceURLImpl.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -81,7 +81,7 @@
//
if (invocation instanceof ResourceInvocation)
{
- url.parentCacheLevel = ((ResourceInvocation)invocation).getContext().getCacheLevel();
+ url.parentCacheLevel = ((ResourceInvocation)invocation).getCacheLevel();
}
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractActionContext.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractActionContext.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractActionContext.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -23,11 +23,7 @@
package org.jboss.portal.portlet.impl.spi;
import org.jboss.portal.portlet.spi.ActionContext;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.common.util.ParameterMap;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -35,37 +31,8 @@
*/
public abstract class AbstractActionContext extends AbstractPortletInvocationContext implements ActionContext
{
-
- /** . */
- protected StateString interactionState;
-
- /** . */
- protected ParameterMap form;
-
-
- protected AbstractActionContext(
- Mode mode,
- WindowState windowState,
- StateString navigationalState,
- ParameterMap publicNavigationalState,
- MarkupInfo markupInfo,
- StateString interactionState,
- ParameterMap form)
+ protected AbstractActionContext(MarkupInfo markupInfo)
{
- super(mode, windowState, navigationalState, publicNavigationalState, markupInfo);
-
- //
- this.interactionState = interactionState;
- this.form = form;
+ super(markupInfo);
}
-
- public StateString getInteractionState()
- {
- return interactionState;
- }
-
- public ParameterMap getForm()
- {
- return form;
- }
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractEventContext.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractEventContext.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractEventContext.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -22,17 +22,9 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.spi;
-import org.jboss.portal.portlet.spi.RenderContext;
import org.jboss.portal.portlet.spi.EventContext;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.common.util.ParameterMap;
-import javax.xml.namespace.QName;
-import java.io.Serializable;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
@@ -40,35 +32,8 @@
public abstract class AbstractEventContext extends AbstractPortletInvocationContext implements EventContext
{
- /** . */
- protected QName name;
-
- /** . */
- protected Serializable payload;
-
- protected AbstractEventContext(
- Mode mode,
- WindowState windowState,
- StateString navigationalState,
- ParameterMap publicNavigationalState,
- MarkupInfo markupInfo,
- QName name,
- Serializable payload)
+ protected AbstractEventContext(MarkupInfo markupInfo)
{
- super(mode, windowState, navigationalState, publicNavigationalState, markupInfo);
-
- //
- this.name = name;
- this.payload = payload;
+ super(markupInfo);
}
-
- public QName getName()
- {
- return name;
- }
-
- public Serializable getPayload()
- {
- return payload;
- }
}
\ No newline at end of file
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -24,11 +24,7 @@
import org.jboss.portal.common.invocation.AbstractInvocationContext;
import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.portlet.spi.PortletInvocationContext;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -45,29 +41,8 @@
/** . */
protected final MarkupInfo markupInfo;
- /** . */
- protected final Mode mode;
-
- /** . */
- protected final WindowState windowState;
-
- /** . */
- protected final StateString navigationalState;
-
- /** . */
- protected final ParameterMap publicNavigationalState;
-
- protected AbstractPortletInvocationContext(
- Mode mode,
- WindowState windowState,
- StateString navigationalState,
- ParameterMap publicNavigationalState,
- MarkupInfo markupInfo)
+ protected AbstractPortletInvocationContext(MarkupInfo markupInfo)
{
- this.mode = mode;
- this.windowState = windowState;
- this.navigationalState = navigationalState;
- this.publicNavigationalState = publicNavigationalState;
this.markupInfo = markupInfo;
}
@@ -105,26 +80,6 @@
throw new IllegalArgumentException("Invalid URL " + url);
}
- public Mode getMode()
- {
- return mode;
- }
-
- public WindowState getWindowState()
- {
- return windowState;
- }
-
- public ParameterMap getPublicNavigationalState()
- {
- return publicNavigationalState;
- }
-
- public StateString getNavigationalState()
- {
- return navigationalState;
- }
-
public MarkupInfo getMarkupInfo()
{
return markupInfo;
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractRenderContext.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractRenderContext.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractRenderContext.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -23,11 +23,7 @@
package org.jboss.portal.portlet.impl.spi;
import org.jboss.portal.portlet.spi.RenderContext;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.common.util.ParameterMap;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -36,13 +32,8 @@
public abstract class AbstractRenderContext extends AbstractPortletInvocationContext implements RenderContext
{
- protected AbstractRenderContext(
- Mode mode,
- WindowState windowState,
- StateString navigationalState,
- ParameterMap publicNavigationalState,
- MarkupInfo markupInfo)
+ protected AbstractRenderContext(MarkupInfo markupInfo)
{
- super(mode, windowState, navigationalState, publicNavigationalState, markupInfo);
+ super(markupInfo);
}
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractResourceContext.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractResourceContext.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractResourceContext.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -22,12 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.spi;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.cache.CacheLevel;
import org.jboss.portal.portlet.spi.ResourceInvocationContext;
/**
@@ -37,55 +32,8 @@
public abstract class AbstractResourceContext extends AbstractPortletInvocationContext implements ResourceInvocationContext
{
- /** . */
- protected final String resourceId;
-
- /** . */
- protected final StateString resourceState;
-
- /** . */
- protected final ParameterMap form;
-
- /** . */
- protected final CacheLevel cacheLevel;
-
- public AbstractResourceContext(
- String resourceId,
- CacheLevel cacheLevel,
- Mode mode,
- WindowState windowState,
- StateString navigationalState,
- ParameterMap publicNavigationalState,
- StateString resourceState,
- ParameterMap form,
- MarkupInfo markupInfo)
+ public AbstractResourceContext(MarkupInfo markupInfo)
{
- super(mode, windowState, navigationalState, publicNavigationalState, markupInfo);
-
- //
- this.resourceId = resourceId;
- this.resourceState = resourceState;
- this.form = form;
- this.cacheLevel = cacheLevel;
+ super(markupInfo);
}
-
- public String getResourceId()
- {
- return resourceId;
- }
-
- public StateString getResourceState()
- {
- return resourceState;
- }
-
- public ParameterMap getForm()
- {
- return form;
- }
-
- public CacheLevel getCacheLevel()
- {
- return cacheLevel;
- }
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/ActionInvocation.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/ActionInvocation.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/ActionInvocation.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -24,6 +24,8 @@
import org.jboss.portal.portlet.spi.ActionContext;
import org.jboss.portal.portlet.spi.RequestContext;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.common.util.ParameterMap;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -38,6 +40,12 @@
/** The request context. */
protected RequestContext requestContext;
+ /** . */
+ protected StateString interactionState;
+
+ /** . */
+ protected ParameterMap form;
+
public ActionInvocation(ActionContext ctx) throws IllegalArgumentException
{
super(ctx);
@@ -46,6 +54,26 @@
this.ctx = ctx;
}
+ public StateString getInteractionState()
+ {
+ return interactionState;
+ }
+
+ public void setInteractionState(StateString interactionState)
+ {
+ this.interactionState = interactionState;
+ }
+
+ public ParameterMap getForm()
+ {
+ return form;
+ }
+
+ public void setForm(ParameterMap form)
+ {
+ this.form = form;
+ }
+
public ActionContext getContext()
{
return ctx;
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/EventInvocation.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/EventInvocation.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/EventInvocation.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -24,6 +24,9 @@
import org.jboss.portal.portlet.spi.EventContext;
+import javax.xml.namespace.QName;
+import java.io.Serializable;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -34,6 +37,12 @@
/** . */
private final EventContext ctx;
+ /** . */
+ private QName name;
+
+ /** . */
+ private Serializable payload;
+
public EventInvocation(EventContext ctx) throws IllegalArgumentException
{
super(ctx);
@@ -46,4 +55,24 @@
{
return ctx;
}
+
+ public QName getName()
+ {
+ return name;
+ }
+
+ public void setName(QName name)
+ {
+ this.name = name;
+ }
+
+ public Serializable getPayload()
+ {
+ return payload;
+ }
+
+ public void setPayload(Serializable payload)
+ {
+ this.payload = payload;
+ }
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvocation.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvocation.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvocation.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -24,6 +24,7 @@
import org.jboss.portal.common.invocation.Invocation;
import org.jboss.portal.common.invocation.Scope;
+import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.portlet.spi.InstanceContext;
import org.jboss.portal.portlet.spi.PortalContext;
import org.jboss.portal.portlet.spi.PortletInvocationContext;
@@ -33,6 +34,9 @@
import org.jboss.portal.portlet.spi.WindowContext;
import org.jboss.portal.portlet.spi.ClientContext;
import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -61,9 +65,24 @@
/** The response properties. */
public static final Scope RESPONSE_PROPERTIES_SCOPE = new Scope("response_properties");
+ /** . */
+ protected StateString navigationalState;
+
+ /** . */
+ protected ParameterMap publicNavigationalState;
+
+ /** . */
+ protected Mode mode;
+
+ /** . */
+ protected WindowState windowState;
+
/** The target portlet. */
protected PortletContext target;
+ /** The invocation context. */
+ protected PortletInvocationContext ctx;
+
/** The portal context. */
protected PortalContext portalContext;
@@ -91,9 +110,6 @@
/** The dispatched response. */
protected HttpServletResponse dresp;
- /** The invocation context. */
- protected PortletInvocationContext ctx;
-
/**
* Create an invocation to a portlet.
*
@@ -166,6 +182,46 @@
this.dreq = dreq;
}
+ public StateString getNavigationalState()
+ {
+ return navigationalState;
+ }
+
+ public void setNavigationalState(StateString navigationalState)
+ {
+ this.navigationalState = navigationalState;
+ }
+
+ public ParameterMap getPublicNavigationalState()
+ {
+ return publicNavigationalState;
+ }
+
+ public void setPublicNavigationalState(ParameterMap publicNavigationalState)
+ {
+ this.publicNavigationalState = publicNavigationalState;
+ }
+
+ public Mode getMode()
+ {
+ return mode;
+ }
+
+ public void setMode(Mode mode)
+ {
+ this.mode = mode;
+ }
+
+ public WindowState getWindowState()
+ {
+ return windowState;
+ }
+
+ public void setWindowState(WindowState windowState)
+ {
+ this.windowState = windowState;
+ }
+
public PortalContext getPortalContext()
{
return portalContext;
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/ResourceInvocation.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/ResourceInvocation.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/ResourceInvocation.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -24,6 +24,9 @@
import org.jboss.portal.portlet.spi.ResourceInvocationContext;
import org.jboss.portal.portlet.spi.RequestContext;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.cache.CacheLevel;
+import org.jboss.portal.common.util.ParameterMap;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -41,6 +44,18 @@
/** . */
private String validationToken;
+ /** . */
+ private String resourceId;
+
+ /** . */
+ private StateString resourceState;
+
+ /** . */
+ private ParameterMap form;
+
+ /** . */
+ private CacheLevel cacheLevel;
+
public ResourceInvocation(ResourceInvocationContext ctx) throws IllegalArgumentException
{
super(ctx);
@@ -64,6 +79,46 @@
this.validationToken = validationToken;
}
+ public String getResourceId()
+ {
+ return resourceId;
+ }
+
+ public void setResourceId(String resourceId)
+ {
+ this.resourceId = resourceId;
+ }
+
+ public StateString getResourceState()
+ {
+ return resourceState;
+ }
+
+ public void setResourceState(StateString resourceState)
+ {
+ this.resourceState = resourceState;
+ }
+
+ public ParameterMap getForm()
+ {
+ return form;
+ }
+
+ public void setForm(ParameterMap form)
+ {
+ this.form = form;
+ }
+
+ public CacheLevel getCacheLevel()
+ {
+ return cacheLevel;
+ }
+
+ public void setCacheLevel(CacheLevel cacheLevel)
+ {
+ this.cacheLevel = cacheLevel;
+ }
+
public RequestContext getRequestContext()
{
return requestContext;
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/ActionContext.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/ActionContext.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/ActionContext.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -22,9 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.spi;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.common.util.ParameterMap;
-
/**
* Extends the generic invocation context to provide action invocation specific input/services.
*
@@ -33,17 +30,4 @@
*/
public interface ActionContext extends PortletInvocationContext
{
- /**
- * Returns the interaction state of the request.
- *
- * @return the interaction state
- */
- StateString getInteractionState();
-
- /**
- * Returns the form parameters of the request or null if no form could be decoded by the caller.
- *
- * @return the request form
- */
- ParameterMap getForm();
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/EventContext.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/EventContext.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/EventContext.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -22,18 +22,10 @@
******************************************************************************/
package org.jboss.portal.portlet.spi;
-import javax.xml.namespace.QName;
-import java.io.Serializable;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
public interface EventContext extends PortletInvocationContext
{
-
- QName getName();
-
- Serializable getPayload();
-
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/PortletInvocationContext.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/PortletInvocationContext.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/PortletInvocationContext.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -38,35 +38,8 @@
*/
public interface PortletInvocationContext extends InvocationContext
{
- /**
- * Returns the navigational state provided to the portlet.
- *
- * @return the navigational state
- */
- StateString getNavigationalState();
/**
- * Returns the public navigational state provided to the portlet.
- *
- * @return the public navigational state
- */
- ParameterMap getPublicNavigationalState();
-
- /**
- * Returns the mode provided to the portlet.
- *
- * @return the mode
- */
- Mode getMode();
-
- /**
- * Returns the window state provided to the portlet.
- *
- * @return the window state
- */
- WindowState getWindowState();
-
- /**
* Return information about the underlying http wire this invocation is performed.
*
* @return the stream info
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/ResourceInvocationContext.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/ResourceInvocationContext.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/ResourceInvocationContext.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -22,42 +22,10 @@
******************************************************************************/
package org.jboss.portal.portlet.spi;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.cache.CacheLevel;
-import org.jboss.portal.common.util.ParameterMap;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
public interface ResourceInvocationContext extends PortletInvocationContext
{
-
- /**
- * Returns the resource id. It may be a null value.
- *
- * @return the resource id
- */
- String getResourceId();
-
- /**
- * Returns the resource state of the request.
- *
- * @return the resource state
- */
- StateString getResourceState();
-
- /**
- * Returns the form parameters of the request or null if no form could be decoded by the caller.
- *
- * @return the request form
- */
- ParameterMap getForm();
-
- /**
- * Returns the cache level.
- *
- * @return the cache level
- */
- CacheLevel getCacheLevel();
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/spi/ActionContextSupport.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/spi/ActionContextSupport.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/spi/ActionContextSupport.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -22,53 +22,12 @@
******************************************************************************/
package org.jboss.portal.portlet.support.spi;
-import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.spi.ActionContext;
-import org.jboss.portal.common.util.ParameterMap;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 5976 $
*/
public class ActionContextSupport extends PortletInvocationContextSupport implements ActionContext
{
-
- public String getCharacterEncoding()
- {
- throw new UnsupportedOperationException();
- }
-
- public int getContentLength()
- {
- throw new UnsupportedOperationException();
- }
-
- public BufferedReader getReader() throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- public InputStream getInputStream() throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- public String getContentType()
- {
- throw new UnsupportedOperationException();
- }
-
- public StateString getInteractionState()
- {
- throw new UnsupportedOperationException();
- }
-
- public ParameterMap getForm()
- {
- throw new UnsupportedOperationException();
- }
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/spi/PortletInvocationContextSupport.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/spi/PortletInvocationContextSupport.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/spi/PortletInvocationContextSupport.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -38,26 +38,6 @@
public class PortletInvocationContextSupport extends AbstractInvocationContext implements PortletInvocationContext
{
- public StateString getNavigationalState()
- {
- throw new UnsupportedOperationException();
- }
-
- public Mode getMode()
- {
- throw new UnsupportedOperationException();
- }
-
- public WindowState getWindowState()
- {
- throw new UnsupportedOperationException();
- }
-
- public ParameterMap getPublicNavigationalState()
- {
- throw new UnsupportedOperationException();
- }
-
public MarkupInfo getMarkupInfo()
{
throw new UnsupportedOperationException();
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/spi/RenderContextSupport.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/spi/RenderContextSupport.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/spi/RenderContextSupport.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -30,5 +30,4 @@
*/
public class RenderContextSupport extends PortletInvocationContextSupport implements RenderContext
{
-
}
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletfilter/PropagateDoFilterArgsFilter1.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletfilter/PropagateDoFilterArgsFilter1.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletfilter/PropagateDoFilterArgsFilter1.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -43,13 +43,17 @@
import javax.portlet.ResourceResponse;
import javax.portlet.filter.FilterChain;
import javax.portlet.filter.RenderFilter;
+import javax.portlet.filter.ResourceFilter;
+import javax.portlet.filter.ActionFilter;
+import javax.portlet.filter.EventFilter;
import java.io.IOException;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class PropagateDoFilterArgsFilter1 extends AbstractPortletFilter implements RenderFilter
+public class PropagateDoFilterArgsFilter1 extends AbstractPortletFilter
+ implements RenderFilter, ResourceFilter, ActionFilter, EventFilter
{
/** . */
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletfilter/PropagateDoFilterArgsFilter2.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletfilter/PropagateDoFilterArgsFilter2.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletfilter/PropagateDoFilterArgsFilter2.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -44,13 +44,17 @@
import javax.portlet.EventRequest;
import javax.portlet.filter.FilterChain;
import javax.portlet.filter.RenderFilter;
+import javax.portlet.filter.ResourceFilter;
+import javax.portlet.filter.ActionFilter;
+import javax.portlet.filter.EventFilter;
import java.io.IOException;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class PropagateDoFilterArgsFilter2 extends AbstractPortletFilter implements RenderFilter
+public class PropagateDoFilterArgsFilter2 extends AbstractPortletFilter
+ implements RenderFilter, ResourceFilter, ActionFilter, EventFilter
{
/** . */
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/ActionContextImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/ActionContextImpl.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/ActionContextImpl.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.test.portlet.state;
-import org.jboss.portal.Mode;
import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.support.spi.ActionContextSupport;
@@ -33,26 +32,9 @@
*/
public class ActionContextImpl extends ActionContextSupport
{
-
- /** . */
- private final Mode mode;
-
- public ActionContextImpl(Mode mode)
+ public ActionContextImpl()
{
- this.mode = mode;
-
- //
addResolver(PortletInvocation.REQUEST_SCOPE, new MapAttributeResolver());
addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
}
-
- public ActionContextImpl()
- {
- this(Mode.EDIT);
- }
-
- public Mode getMode()
- {
- return mode;
- }
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/ResourceTestContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/ResourceTestContext.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/ResourceTestContext.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -22,15 +22,10 @@
******************************************************************************/
package org.jboss.portal.portlet.test;
-import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.ContainerURL;
-import org.jboss.portal.portlet.cache.CacheLevel;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.impl.spi.AbstractResourceContext;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.common.invocation.resolver.PrincipalAttributeResolver;
import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
@@ -47,28 +42,9 @@
/** . */
private final PortletURLRenderer urlRenderer;
- public ResourceTestContext(
- String resourceId,
- CacheLevel resourceCacheLevel,
- PortletURLRenderer urlRenderer,
- Mode mode,
- WindowState windowState,
- StateString navigationalState,
- ParameterMap publicNavigationalState,
- StateString resourceState,
- ParameterMap form,
- MarkupInfo markupInfo)
+ public ResourceTestContext(PortletURLRenderer urlRenderer, MarkupInfo markupInfo)
{
- super(
- resourceId,
- resourceCacheLevel,
- mode,
- windowState,
- navigationalState,
- publicNavigationalState,
- resourceState,
- form,
- markupInfo);
+ super(markupInfo);
//
this.urlRenderer = urlRenderer;
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestActionContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestActionContext.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestActionContext.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -22,14 +22,10 @@
******************************************************************************/
package org.jboss.portal.portlet.test;
-import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.ContainerURL;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.impl.spi.AbstractActionContext;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.common.invocation.resolver.PrincipalAttributeResolver;
import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
@@ -46,17 +42,9 @@
/** . */
private final PortletURLRenderer urlRenderer;
- public TestActionContext(
- PortletURLRenderer urlRenderer,
- Mode mode,
- WindowState windowState,
- StateString navigationalState,
- ParameterMap publicNavigationalState,
- MarkupInfo markupInfo,
- StateString interactionState,
- ParameterMap form)
+ public TestActionContext(PortletURLRenderer urlRenderer, MarkupInfo markupInfo)
{
- super(mode, windowState, navigationalState, publicNavigationalState, markupInfo, interactionState, form);
+ super(markupInfo);
//
this.urlRenderer = urlRenderer;
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestEventContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestEventContext.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestEventContext.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -48,17 +48,9 @@
/** . */
private final PortletURLRenderer urlRenderer;
- public TestEventContext(
- PortletURLRenderer urlRenderer,
- Mode mode,
- WindowState windowState,
- StateString navigationalState,
- ParameterMap publicNavigationalState,
- MarkupInfo markupInfo,
- QName name,
- Serializable payload)
+ public TestEventContext(PortletURLRenderer urlRenderer, MarkupInfo markupInfo)
{
- super(mode, windowState, navigationalState, publicNavigationalState, markupInfo, name, payload);
+ super(markupInfo);
//
this.urlRenderer = urlRenderer;
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestRenderContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestRenderContext.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestRenderContext.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -22,14 +22,10 @@
******************************************************************************/
package org.jboss.portal.portlet.test;
-import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.ContainerURL;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.impl.spi.AbstractRenderContext;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.common.invocation.resolver.PrincipalAttributeResolver;
import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
@@ -46,15 +42,9 @@
/** . */
private final PortletURLRenderer urlRenderer;
- public TestRenderContext(
- PortletURLRenderer urlRenderer,
- Mode mode,
- WindowState windowState,
- StateString navigationalState,
- ParameterMap publicNavigationalState,
- MarkupInfo markupInfo)
+ public TestRenderContext(PortletURLRenderer urlRenderer, MarkupInfo markupInfo)
{
- super(mode, windowState, navigationalState, publicNavigationalState, markupInfo);
+ super(markupInfo);
//
this.urlRenderer = urlRenderer;
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletController.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletController.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletController.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -176,12 +176,18 @@
//
TestInstanceContext instanceContext = new TestInstanceContext(req, portlet.getContext(), false);
- TestRenderContext renderContext = new TestRenderContext(renderer, mode, windowState, portletNS, publicNS, MARKUP_INFO);
+ TestRenderContext renderContext = new TestRenderContext(renderer, MARKUP_INFO);
//
RenderInvocation render = new RenderInvocation(renderContext);
//
+ render.setMode(mode);
+ render.setWindowState(windowState);
+ render.setNavigationalState(portletNS);
+ render.setPublicNavigationalState(publicNS);
+
+ //
render.setClientContext(new AbstractClientContext(req, pageProperties.getCookies()));
render.setServerContext(new AbstractServerContext(req, resp));
render.setInstanceContext(instanceContext);
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletRequestHandler.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletRequestHandler.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletRequestHandler.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -261,18 +261,18 @@
//
TestInstanceContext instanceContext = new TestInstanceContext(req, portlet.getContext(), true);
- TestActionContext actionContext = new TestActionContext(
- renderer,
- mode,
- windowState,
- portletActionRequest.windowNavigationalState.getPortletNavigationalState(),
- publicNS,
- MARKUP_INFO,
- portletActionRequest.interactionState,
- portletActionRequest.bodyParameters != null ? ParameterMap.clone(portletActionRequest.bodyParameters) : null);
+ TestActionContext actionContext = new TestActionContext(renderer, MARKUP_INFO);
ActionInvocation actionInvocation = new ActionInvocation(actionContext);
//
+ actionInvocation.setMode(mode);
+ actionInvocation.setWindowState(windowState);
+ actionInvocation.setNavigationalState(portletActionRequest.windowNavigationalState.getPortletNavigationalState());
+ actionInvocation.setPublicNavigationalState(publicNS);
+ actionInvocation.setInteractionState(portletActionRequest.interactionState);
+ actionInvocation.setForm(portletActionRequest.bodyParameters != null ? ParameterMap.clone(portletActionRequest.bodyParameters) : null);
+
+ //
actionInvocation.setClientContext(new AbstractClientContext(req));
actionInvocation.setServerContext(new AbstractServerContext(req, resp));
actionInvocation.setInstanceContext(instanceContext);
@@ -316,18 +316,18 @@
//
TestInstanceContext instanceContext = new TestInstanceContext(req, portlet.getContext(), true);
- TestEventContext actionContext = new TestEventContext(
- renderer,
- windowNS.getMode(),
- windowNS.getWindowState(),
- windowNS.getPortletNavigationalState(),
- publicNS,
- MARKUP_INFO,
- event.getName(),
- event.getPayload());
+ TestEventContext actionContext = new TestEventContext(renderer, MARKUP_INFO);
EventInvocation eventInvocation = new EventInvocation(actionContext);
//
+ eventInvocation.setMode(windowNS.getMode());
+ eventInvocation.setWindowState(windowNS.getWindowState());
+ eventInvocation.setNavigationalState(windowNS.getPortletNavigationalState());
+ eventInvocation.setPublicNavigationalState(publicNS);
+ eventInvocation.setName(event.getName());
+ eventInvocation.setPayload(event.getPayload());
+
+ //
eventInvocation.setClientContext(new AbstractClientContext(req, requestCookies));
eventInvocation.setServerContext(new AbstractServerContext(req, resp));
eventInvocation.setInstanceContext(instanceContext);
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletResourceRequestHandler.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletResourceRequestHandler.java 2008-02-03 17:17:14 UTC (rev 9723)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletResourceRequestHandler.java 2008-02-04 01:27:57 UTC (rev 9724)
@@ -196,18 +196,18 @@
//
TestInstanceContext instanceContext = new TestInstanceContext(req, portlet.getContext(), true);
- ResourceInvocationContext resourceInvocationContext = new ResourceTestContext(
- portletResourceRequest.resourceId,
- cacheability,
- renderer,
- mode,
- windowState,
- portletNS,
- publicNS,
- portletResourceRequest.resourceState,
- portletResourceRequest.bodyParameters != null ? ParameterMap.clone(portletResourceRequest.bodyParameters) : null,
- MARKUP_INFO);
+ ResourceInvocationContext resourceInvocationContext = new ResourceTestContext(renderer, MARKUP_INFO);
ResourceInvocation resourceInvocation = new ResourceInvocation(resourceInvocationContext);
+
+ //
+ resourceInvocation.setResourceId(portletResourceRequest.resourceId);
+ resourceInvocation.setCacheLevel(cacheability);
+ resourceInvocation.setMode(mode);
+ resourceInvocation.setWindowState(windowState);
+ resourceInvocation.setNavigationalState(portletNS);
+ resourceInvocation.setPublicNavigationalState(publicNS);
+ resourceInvocation.setResourceState(portletResourceRequest.resourceState);
+ resourceInvocation.setForm(portletResourceRequest.bodyParameters != null ? ParameterMap.clone(portletResourceRequest.bodyParameters) : null);
//
resourceInvocation.setClientContext(new AbstractClientContext(req));
18 years, 2 months
JBoss Portal SVN: r9723 - modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-03 12:17:14 -0500 (Sun, 03 Feb 2008)
New Revision: 9723
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java
Log:
- update comment on producer cache interceptor
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java 2008-02-03 17:05:57 UTC (rev 9722)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java 2008-02-03 17:17:14 UTC (rev 9723)
@@ -28,6 +28,9 @@
import org.apache.log4j.Logger;
/**
+ * Not removed as it is a place holder to implement producer cache (i.e caching markup
+ * on the producer side to avoid recomputation).
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 7226 $
*/
18 years, 2 months
JBoss Portal SVN: r9722 - in modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl: jsr168/api and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-03 12:05:57 -0500 (Sun, 03 Feb 2008)
New Revision: 9722
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerOptionInfo.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java
Log:
start to add support for container runtime options
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-02-03 16:12:29 UTC (rev 9721)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-02-03 17:05:57 UTC (rev 9722)
@@ -33,6 +33,7 @@
import org.jboss.portal.portlet.impl.metadata.portlet.PortletInfoMetaData;
import org.jboss.portal.portlet.impl.metadata.security.SecurityConstraintMetaData;
import org.jboss.portal.portlet.impl.metadata.common.InitParamMetaData;
+import org.jboss.portal.portlet.impl.metadata.common.ContainerRuntimeMetaData;
import org.jboss.portal.portlet.impl.metadata.event.EventDefinitionReferenceMetaData;
import org.jboss.portal.portlet.impl.metadata.event.EventDefinitionMetaData;
import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
@@ -131,6 +132,9 @@
private static final Map<String,FilterMetaData> EMPTY_FILTER_MAP = Collections.emptyMap();
/** . */
+ private static final Map<String,ContainerRuntimeMetaData> EMPTY_CONTAINER_RUNTIME_OPTION_MAP = Collections.emptyMap();
+
+ /** . */
private final PortletApplication10MetaData portletApplicationMD;
/** . */
@@ -151,6 +155,9 @@
/** . */
private final Logger log = Logger.getLogger(ContainerInfoBuilder.class);
+ /** . */
+ private Map<String, ContainerOptionInfo> applicationOptions;
+
public ContainerInfoBuilder(
PortletApplication10MetaData portletApplicationMD,
ContainerInfoBuilderContext context)
@@ -215,6 +222,10 @@
{
tmp.setFilterMapping(EMPTY_FILTER_MAPPING_MAP);
}
+ if (tmp.getContainerRuntimeOptions() == null)
+ {
+ tmp.setContainerRuntimeOptions(EMPTY_CONTAINER_RUNTIME_OPTION_MAP);
+ }
}
}
@@ -278,6 +289,10 @@
{
portletMD.setSupportedPublishingEvent(EMPTY_EVENT_DEFINITION_REFERENCE_LIST);
}
+ if (portletMD.getContainerRuntimeOptions() == null)
+ {
+ portletMD.setContainerRuntimeOptions(EMPTY_CONTAINER_RUNTIME_OPTION_MAP);
+ }
}
}
@@ -366,6 +381,17 @@
}
//
+ applicationOptions = build(tmp.getContainerRuntimeOptions().values());
+ if (applicationOptions != null)
+ {
+ applicationOptions = Collections.unmodifiableMap(applicationOptions);
+ }
+ else
+ {
+ applicationOptions = Collections.emptyMap();
+ }
+
+ //
listeners = new ArrayList<ContainerListenerInfo>(tmp.getListeners().size());
for (ListenerMetaData listenerMD : tmp.getListeners())
{
@@ -472,11 +498,19 @@
ContainerSessionInfo containerSession = buildContainerSession(portletMD);
//
- Map<String, String> initParameters = new HashMap<String, String>();
+ Map<String, String> initParameters = Collections.emptyMap();
for (InitParamMetaData initParamMD : portletMD.getInitParams())
{
+ if (initParameters.isEmpty())
+ {
+ initParameters = new HashMap<String, String>();
+ }
initParameters.put(initParamMD.getName(), initParamMD.getValue());
}
+ if (initParameters.size() > 0)
+ {
+ initParameters = Collections.unmodifiableMap(initParameters);
+ }
//
ContainerPortletInfo containerPortletInfo;
@@ -486,7 +520,7 @@
ContainerNavigationInfo containerNavigation = buildContainerNavigationInfo(portletMD);
//
- List<String> filters = new ArrayList<String>();
+ List<String> filters = Collections.emptyList();
for (FilterMappingMetaData filterMappingMD : ((PortletApplication20MetaData)portletApplicationMD).getFilterMapping().values())
{
for (String portletName : filterMappingMD.getPortletNames())
@@ -510,12 +544,38 @@
// Add the filter
if (matches)
{
+ if (filters.isEmpty())
+ {
+ filters = new ArrayList<String>();
+ }
filters.add(filterMappingMD.getName());
}
}
}
+ if (filters.size() > 0)
+ {
+ filters = Collections.unmodifiableList(filters);
+ }
//
+ Map<String, ContainerOptionInfo> options = build(portletMD.getContainerRuntimeOptions().values());
+ if (options != null)
+ {
+ for (Map.Entry<String, ContainerOptionInfo> entry : applicationOptions.entrySet())
+ {
+ if (!options.containsKey(entry.getKey()))
+ {
+ options.put(entry.getKey(), entry.getValue());
+ }
+ }
+ options = Collections.unmodifiableMap(options);
+ }
+ else
+ {
+ options = applicationOptions;
+ }
+
+ //
containerPortletInfo = new ContainerPortletInfo(
containerCapabilities,
containerPreferences,
@@ -525,12 +585,13 @@
containerSession,
containerEvents,
containerNavigation,
- Collections.unmodifiableList(filters),
+ filters,
portletMD.getPortletName(),
portletMD.getPortletClass(),
- Collections.unmodifiableMap(initParameters),
+ initParameters,
false,
- context.getBundleManager(portletMD)
+ context.getBundleManager(portletMD),
+ options
);
}
else
@@ -554,6 +615,26 @@
return containerPortletInfo;
}
+ private Map<String, ContainerOptionInfo> build(Collection<ContainerRuntimeMetaData> optionsMD)
+ {
+ Map<String, ContainerOptionInfo> options = null;
+ for (ContainerRuntimeMetaData containerRuntimeMD : optionsMD)
+ {
+ ContainerOptionInfo optionInfo = build(containerRuntimeMD);
+ if (options == null)
+ {
+ options = new HashMap<String, ContainerOptionInfo>();
+ }
+ options.put(optionInfo.getName(), optionInfo);
+ }
+ return options;
+ }
+
+ private ContainerOptionInfo build(ContainerRuntimeMetaData containerRuntimeMD)
+ {
+ return new ContainerOptionInfo(containerRuntimeMD.getName(), Collections.unmodifiableList(containerRuntimeMD.getValues()));
+ }
+
private ContainerNavigationInfo buildContainerNavigationInfo(PortletMetaData portletMD)
{
ContainerNavigationInfo navigation = new ContainerNavigationInfo();
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerOptionInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerOptionInfo.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerOptionInfo.java 2008-02-03 17:05:57 UTC (rev 9722)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * 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. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.info;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ContainerOptionInfo
+{
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final List<String> values;
+
+ public ContainerOptionInfo(String name, List<String> values)
+ {
+ this.name = name;
+ this.values = values;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public List<String> getValues()
+ {
+ return values;
+ }
+}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java 2008-02-03 16:12:29 UTC (rev 9721)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java 2008-02-03 17:05:57 UTC (rev 9722)
@@ -82,6 +82,9 @@
/** . */
private final List<String> filterRefs;
+ /** . */
+ private final Map<String, ContainerOptionInfo> options;
+
public ContainerPortletInfo(
ContainerCapabilitiesInfo capabilities,
ContainerPreferencesInfo preferences,
@@ -109,6 +112,7 @@
this.initParameters = initParameters;
this.remotable = remotable;
this.bundleManager = bundleManager;
+ this.options = Collections.emptyMap();
}
ContainerPortletInfo(
@@ -125,7 +129,8 @@
String className,
Map<String, String> initParameters,
Boolean remotable,
- ResourceBundleManager bundleManager)
+ ResourceBundleManager bundleManager,
+ Map<String, ContainerOptionInfo> options)
{
this.capabilities = capabilities;
this.preferences = preferences;
@@ -141,6 +146,7 @@
this.initParameters = initParameters;
this.remotable = remotable;
this.bundleManager = bundleManager;
+ this.options = options;
}
public String getName()
@@ -148,6 +154,11 @@
return name;
}
+ public Map<String, ContainerOptionInfo> getOptions()
+ {
+ return options;
+ }
+
public ResourceBundleManager getBundleManager()
{
return bundleManager;
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java 2008-02-03 16:12:29 UTC (rev 9721)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java 2008-02-03 17:05:57 UTC (rev 9722)
@@ -23,9 +23,11 @@
package org.jboss.portal.portlet.impl.jsr168.api;
import org.jboss.portal.common.i18n.ResourceBundleManager;
+import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.portlet.impl.info.ContainerParameterInfo;
import org.jboss.portal.portlet.impl.info.ContainerPortletApplicationInfo;
import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.impl.info.ContainerOptionInfo;
import javax.portlet.PortletConfig;
import javax.portlet.PortletContext;
@@ -66,6 +68,9 @@
/** . */
private List<String> publicRenderParameterNames;
+ /** . */
+ private Map<String, String[]> containerRuntimeOptions;
+
public PortletConfigImpl(
ContainerPortletInfo portletInfo,
ContainerPortletApplicationInfo portletApplicationInfo,
@@ -80,6 +85,24 @@
}
//
+ Map<String, String[]> containerRuntimeOptions;
+ if (portletInfo.getOptions().size() > 0)
+ {
+ ParameterMap tmp = new ParameterMap(ParameterMap.AccessMode.get(true, false));
+ for (ContainerOptionInfo option : portletInfo.getOptions().values())
+ {
+ String name = option.getName();
+ String[] values = option.getValues().toArray(new String[option.getValues().size()]);
+ tmp.setValues(name, values);
+ }
+ containerRuntimeOptions = Collections.unmodifiableMap(tmp);
+ }
+ else
+ {
+ containerRuntimeOptions = Collections.emptyMap();
+ }
+
+ //
this.portletInfo = portletInfo;
this.portletApplicationInfo = portletApplicationInfo;
this.portletContext = portletContext;
@@ -87,6 +110,7 @@
this.publishingEventQNames = new ArrayList<QName>(portletInfo.getEventing().getProducedEvents().keySet());
this.processingEventQNames = new ArrayList<QName>(portletInfo.getEventing().getConsumedEvents().keySet());
this.publicRenderParameterNames = publicRenderParameterNames;
+ this.containerRuntimeOptions = containerRuntimeOptions;
}
public String getPortletName()
@@ -146,7 +170,6 @@
public Map<String, String[]> getContainerRuntimeOptions()
{
- // For now we support no container runtime options
- return Collections.emptyMap();
+ return containerRuntimeOptions;
}
}
18 years, 2 months
JBoss Portal SVN: r9721 - in modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168: api and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-03 11:12:29 -0500 (Sun, 03 Feb 2008)
New Revision: 9721
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/Constants.java
Removed:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/APIConstants.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/RequestDispatcherImpl.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/InlineBundle.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletRequestAttributes.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/FilterChainImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletResponseImpl.java
Log:
- improved implementation of PortletRequest delegating to the underlying HttpServletRequest (it should use the most accurate request during a dispatch)
Deleted: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/APIConstants.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/APIConstants.java 2008-02-03 11:59:52 UTC (rev 9720)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/APIConstants.java 2008-02-03 16:12:29 UTC (rev 9721)
@@ -1,51 +0,0 @@
-/******************************************************************************
- * 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. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.jsr168;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public interface APIConstants
-{
- /** . */
- String JAVAX_PORTLET_TITLE = "javax.portlet.title";
-
- /** . */
- String JAVAX_PORTLET_SHORT_TITLE = "javax.portlet.short-title";
-
- /** . */
- String JAVAX_PORTLET_KEYWORDS = "javax.portlet.keywords";
-
- /** . */
- String JAVAX_PORTLET_CONFIG = "javax.portlet.config";
-
- /** . */
- String JAVAX_PORTLET_REQUEST = "javax.portlet.request";
-
- /** . */
- String JAVAX_PORTLET_RESPONSE = "javax.portlet.response";
-
- /** . */
- String JAVAX_PORTLET_LIFECYCLE_PHASE = "javax.portlet.lifecycle_phase";
-}
Copied: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/Constants.java (from rev 9707, modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/APIConstants.java)
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/Constants.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/Constants.java 2008-02-03 16:12:29 UTC (rev 9721)
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * 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. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class Constants
+{
+
+ private Constants()
+ {
+ }
+
+ /** . */
+ public static final String JAVAX_PORTLET_TITLE = "javax.portlet.title";
+
+ /** . */
+ public static final String JAVAX_PORTLET_SHORT_TITLE = "javax.portlet.short-title";
+
+ /** . */
+ public static final String JAVAX_PORTLET_KEYWORDS = "javax.portlet.keywords";
+
+ /** . */
+ public static final String JAVAX_PORTLET_CONFIG = "javax.portlet.config";
+
+ /** . */
+ public static final String JAVAX_PORTLET_REQUEST = "javax.portlet.request";
+
+ /** . */
+ public static final String JAVAX_PORTLET_RESPONSE = "javax.portlet.response";
+
+ /** . */
+ public static final String JAVAX_PORTLET_LIFECYCLE_PHASE = "javax.portlet.lifecycle_phase";
+}
Property changes on: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/Constants.java
___________________________________________________________________
Name: svn:executable
+
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java 2008-02-03 11:59:52 UTC (rev 9720)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java 2008-02-03 16:12:29 UTC (rev 9721)
@@ -25,22 +25,23 @@
import org.jboss.portal.common.http.QueryStringParser;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.util.ParameterMap;
-import org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl;
import org.jboss.portal.portlet.impl.jsr168.api.PortletRequestImpl;
-import org.jboss.portal.portlet.impl.jsr168.api.ActionRequestImpl;
-import org.jboss.portal.portlet.impl.jsr168.api.EventRequestImpl;
-import org.jboss.portal.portlet.impl.jsr168.api.ResourceRequestImpl;
-import org.jboss.portal.portlet.impl.jsr168.api.ClientDataRequestImpl;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletContext;
+import javax.servlet.ServletRequest;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.portlet.PortletSession;
import javax.portlet.PortletRequest;
+import javax.portlet.ClientDataRequest;
+import javax.portlet.ActionRequest;
+import javax.portlet.ResourceRequest;
+import javax.portlet.EventRequest;
+import javax.portlet.RenderRequest;
import java.security.Principal;
import java.util.Enumeration;
import java.util.Locale;
@@ -111,7 +112,7 @@
private final PortletRequest preq;
/** . */
- private final HttpServletRequest dreq;
+ private final HttpServletRequestWrapper dreq;
/** . */
private final Map<String, String[]> parameters;
@@ -133,8 +134,8 @@
public DispatchedHttpServletRequest(
Dispatch dispatch,
- PortletRequestImpl preq,
- HttpServletRequest dreq,
+ PortletRequest preq,
+ HttpServletRequestWrapper dreq,
ServletContext servletContext)
{
super(dreq);
@@ -265,6 +266,8 @@
if (s != null)
{
Map<String, String> containerAttributes = containerAttributesStack.getLast();
+
+ //
if (containerAttributes.containsKey(s))
{
return containerAttributes.get(s);
@@ -275,28 +278,23 @@
{
return null;
}
+
+ //
+ return preq.getAttribute(s);
}
-
- //
- return ((PortletRequestImpl)preq).getAttributes().getAttribute(s, (HttpServletRequest)getRequest());
+ else
+ {
+ return null;
+ }
}
public final Enumeration getAttributeNames()
{
- Set<String> names = Tools.toSet(((PortletRequestImpl)preq).getAttributes().getAttributeNames(null));
+ Set<String> names = Tools.toSet(preq.getAttributeNames());
- // Add super stuff that is not reserved
- for (Enumeration e = super.getAttributeNames();e.hasMoreElements();)
- {
- String name = (String)e.nextElement();
+ //
+ names.removeAll(ALL_CONTAINER_ATTRIBUTES);
- //
- if (!ALL_CONTAINER_ATTRIBUTES.contains(name))
- {
- names.add(name);
- }
- }
-
//
names.addAll(containerAttributesStack.getLast().keySet());
@@ -505,6 +503,20 @@
return "HTTP/1.1";
}
+ // ******
+
+ public void setRequest(ServletRequest servletRequest)
+ {
+ // That's a trick
+ dreq.setRequest(servletRequest);
+ }
+
+ public ServletRequest getRequest()
+ {
+ // That's a trick
+ return dreq.getRequest();
+ }
+
String[] pushDispatch(Dispatch dispatch)
{
String path = dispatch.getPath();
@@ -643,6 +655,54 @@
containerAttributesStack.removeLast();
}
+ /**
+ * Returns the an implementation of <code>javax.servlet.http.HttpSession</code> that wraps this
+ * portlet session and use the specified scope for manipulating attributes. This session is used
+ * during the request dispatch to a servlet.
+ *
+ * @param scope the scope
+ * @return the wrapped session
+ */
+ private HttpSession getSession(boolean create, int scope)
+ {
+ if (session == null)
+ {
+ session = new DispatchedHttpSession[2];
+ }
+
+ // Dereference an existing session if necessary
+ if (session[scope] != null && !session[scope].isValid())
+ {
+ session[scope] = null;
+ }
+
+ // If we have a session here we are sure it is valid and ok to return it
+ if (session[scope] != null)
+ {
+ // So we do nothing
+ }
+ else if (create)
+ {
+ // For sure we need a session we will obtain a valid one
+ PortletSession portletSession = preq.getPortletSession();
+ session[scope] = new DispatchedHttpSession(this, portletSession, scope);
+ }
+ else
+ {
+ // Here we can try an existing session but it may return null
+ PortletSession portletSession = preq.getPortletSession(false);
+
+ //
+ if (portletSession != null)
+ {
+ session[scope] = new DispatchedHttpSession(this, portletSession, scope);
+ }
+ }
+
+ //
+ return session[scope];
+ }
+
// Subclasses
public static abstract class ClientData extends DispatchedHttpServletRequest
@@ -652,9 +712,9 @@
private PortletServletInputStream in;
/** . */
- private final ClientDataRequestImpl cdreq;
+ private final ClientDataRequest cdreq;
- public ClientData(Dispatch dispatch, ClientDataRequestImpl cdreq, HttpServletRequest dreq, ServletContext servletContext)
+ public ClientData(Dispatch dispatch, ClientDataRequest cdreq, HttpServletRequestWrapper dreq, ServletContext servletContext)
{
super(dispatch, cdreq, dreq, servletContext);
@@ -707,7 +767,7 @@
/** . */
private final InputStream in;
- private PortletServletInputStream(ClientDataRequestImpl req) throws IOException
+ private PortletServletInputStream(ClientDataRequest req) throws IOException
{
in = req.getPortletInputStream();
}
@@ -722,7 +782,7 @@
public static final class Action extends ClientData
{
- public Action(Dispatch dispatch, ActionRequestImpl areq, HttpServletRequest dreq, ServletContext servletContext)
+ public Action(Dispatch dispatch, ActionRequest areq, HttpServletRequestWrapper dreq, ServletContext servletContext)
{
super(dispatch, areq, dreq, servletContext);
}
@@ -731,7 +791,7 @@
public static final class Resource extends ClientData
{
- public Resource(Dispatch dispatch, ResourceRequestImpl rreq, HttpServletRequest dreq, ServletContext servletContext)
+ public Resource(Dispatch dispatch, ResourceRequest rreq, HttpServletRequestWrapper dreq, ServletContext servletContext)
{
super(dispatch, rreq, dreq, servletContext);
}
@@ -739,7 +799,7 @@
public static abstract class Mime extends DispatchedHttpServletRequest
{
- public Mime(Dispatch dispatch, PortletRequestImpl preq, HttpServletRequest dreq, ServletContext servletContext)
+ public Mime(Dispatch dispatch, PortletRequest preq, HttpServletRequestWrapper dreq, ServletContext servletContext)
{
super(dispatch, preq, dreq, servletContext);
}
@@ -778,9 +838,9 @@
{
/** . */
- private final EventRequestImpl ereq;
+ private final EventRequest ereq;
- public Event(Dispatch dispatch, EventRequestImpl ereq, HttpServletRequest dreq, ServletContext servletContext)
+ public Event(Dispatch dispatch, EventRequest ereq, HttpServletRequestWrapper dreq, ServletContext servletContext)
{
super(dispatch, ereq, dreq, servletContext);
@@ -797,7 +857,7 @@
public static final class Render extends Mime
{
- public Render(Dispatch dispatch, RenderRequestImpl rreq, HttpServletRequest dreq, ServletContext servletContext)
+ public Render(Dispatch dispatch, RenderRequest rreq, HttpServletRequestWrapper dreq, ServletContext servletContext)
{
super(dispatch, rreq, dreq, servletContext);
}
@@ -807,52 +867,4 @@
return "GET";
}
}
-
- /**
- * Returns the an implementation of <code>javax.servlet.http.HttpSession</code> that wraps this
- * portlet session and use the specified scope for manipulating attributes. This session is used
- * during the request dispatch to a servlet.
- *
- * @param scope the scope
- * @return the wrapped session
- */
- private HttpSession getSession(boolean create, int scope)
- {
- if (session == null)
- {
- session = new DispatchedHttpSession[2];
- }
-
- // Dereference an existing session if necessary
- if (session[scope] != null && !session[scope].isValid())
- {
- session[scope] = null;
- }
-
- // If we have a session here we are sure it is valid and ok to return it
- if (session[scope] != null)
- {
- // So we do nothing
- }
- else if (create)
- {
- // For sure we need a session we will obtain a valid one
- PortletSession portletSession = preq.getPortletSession();
- session[scope] = new DispatchedHttpSession(this, portletSession, scope);
- }
- else
- {
- // Here we can try an existing session but it may return null
- PortletSession portletSession = preq.getPortletSession(false);
-
- //
- if (portletSession != null)
- {
- session[scope] = new DispatchedHttpSession(this, portletSession, scope);
- }
- }
-
- //
- return session[scope];
- }
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/InlineBundle.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/InlineBundle.java 2008-02-03 11:59:52 UTC (rev 9720)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/InlineBundle.java 2008-02-03 16:12:29 UTC (rev 9721)
@@ -56,21 +56,21 @@
String title = portletInfo.getMeta().getDefaultMetaValue(MetaInfo.TITLE);
if (title != null)
{
- list.add(new Object[]{APIConstants.JAVAX_PORTLET_TITLE, title});
+ list.add(new Object[]{Constants.JAVAX_PORTLET_TITLE, title});
}
//
String shortTitle = portletInfo.getMeta().getDefaultMetaValue(MetaInfo.SHORT_TITLE);
if (shortTitle != null)
{
- list.add(new Object[]{APIConstants.JAVAX_PORTLET_SHORT_TITLE, shortTitle});
+ list.add(new Object[]{Constants.JAVAX_PORTLET_SHORT_TITLE, shortTitle});
}
//
String keywords = portletInfo.getMeta().getDefaultMetaValue(MetaInfo.KEYWORDS);
if (keywords != null)
{
- list.add(new Object[]{APIConstants.JAVAX_PORTLET_KEYWORDS, keywords});
+ list.add(new Object[]{Constants.JAVAX_PORTLET_KEYWORDS, keywords});
}
//
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2008-02-03 11:59:52 UTC (rev 9720)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2008-02-03 16:12:29 UTC (rev 9721)
@@ -40,7 +40,8 @@
import org.jboss.portal.portlet.impl.jsr168.api.ResourceRequestImpl;
import org.jboss.portal.portlet.impl.jsr168.api.ResourceResponseImpl;
import org.jboss.portal.portlet.impl.jsr168.api.FilterChainImpl;
-import org.jboss.portal.portlet.impl.jsr168.spi.PortletAPIFactory;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletResponseImpl;
import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
import org.jboss.portal.portlet.impl.info.ContainerPreferencesInfo;
import org.jboss.portal.portlet.invocation.ActionInvocation;
@@ -78,6 +79,7 @@
import javax.portlet.filter.FilterChain;
import javax.portlet.filter.FilterConfig;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Set;
import java.util.List;
@@ -417,28 +419,61 @@
public PortletInvocationResponse dispatch(PortletInvocation invocation) throws PortletInvokerException, InvocationException
{
+ HttpServletRequest dreq = invocation.getDispatchedRequest();
+ HttpServletResponse dresp = invocation.getDispatchedResponse();
+
+ //
+ PortletRequestImpl req;
+ PortletResponseImpl resp;
+ String phase;
+ FilterChainImpl<?> chain;
+ if (invocation instanceof ActionInvocation)
+ {
+ req = new ActionRequestImpl((ActionInvocation)invocation);
+ resp = new ActionResponseImpl((ActionInvocation)invocation, req);
+ phase = "ACTION_PHASE";
+ chain = new FilterChainImpl<ActionFilter>(actionFilterList, ActionFilter.class);
+ }
+ else if (invocation instanceof RenderInvocation)
+ {
+ req = new RenderRequestImpl((RenderInvocation)invocation);
+ resp = new RenderResponseImpl((RenderInvocation)invocation, req);
+ phase = "RENDER_PHASE";
+ chain = new FilterChainImpl<RenderFilter>(renderFilterList, RenderFilter.class);
+ }
+ else if (invocation instanceof EventInvocation)
+ {
+ req = new EventRequestImpl((EventInvocation)invocation);
+ resp = new EventResponseImpl((EventInvocation)invocation, req);
+ phase = "EVENT_PHASE";
+ chain = new FilterChainImpl<EventFilter>(eventFilterList, EventFilter.class);
+ }
+ else if (invocation instanceof ResourceInvocation)
+ {
+ req = new ResourceRequestImpl((ResourceInvocation)invocation);
+ resp = new ResourceResponseImpl((ResourceInvocation)invocation, req);
+ phase = "RESOURCE_SERVING_PHASE";
+ chain = new FilterChainImpl<ResourceFilter>(resourceFilterList, ResourceFilter.class);
+ }
+ else
+ {
+ throw new InvocationException("Unexpected invocation " + invocation);
+ }
+
+ //
try
{
- if (invocation instanceof ActionInvocation)
- {
- return invokeAction((ActionInvocation)invocation);
- }
- else if (invocation instanceof RenderInvocation)
- {
- return invokeRender((RenderInvocation)invocation);
- }
- else if (invocation instanceof EventInvocation)
- {
- return invokeEvent((EventInvocation)invocation);
- }
- else if (invocation instanceof ResourceInvocation)
- {
- return invokeResource((ResourceInvocation)invocation);
- }
- else
- {
- throw new InvocationException("Unexpected invocation " + invocation);
- }
+ dreq.setAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION, invocation);
+ dreq.setAttribute(Constants.JAVAX_PORTLET_CONFIG, config);
+ dreq.setAttribute(Constants.JAVAX_PORTLET_REQUEST, req);
+ dreq.setAttribute(Constants.JAVAX_PORTLET_RESPONSE, resp);
+ dreq.setAttribute(Constants.JAVAX_PORTLET_LIFECYCLE_PHASE, phase);
+
+ //
+ chain.doFilter(req, resp);
+
+ //
+ return resp.getResponse();
}
catch (NoClassDefFoundError e)
{
@@ -472,135 +507,16 @@
return new ErrorResponse(e);
}
}
- }
-
- protected PortletInvocationResponse invokeAction(ActionInvocation invocation) throws IOException, PortletException
- {
- PortletAPIFactory factory = application.getPortletAPIFactory();
- ActionRequestImpl req = factory.createActionRequest(invocation);
- ActionResponseImpl resp = factory.createActionResponse(invocation, req);
- HttpServletRequest dreq = invocation.getDispatchedRequest();
- try
- {
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_CONFIG, config);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_REQUEST, req);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_RESPONSE, resp);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_LIFECYCLE_PHASE, "ACTION_PHASE");
- dreq.setAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION, invocation);
-
- //
- FilterChainImpl<ActionFilter> chain = new FilterChainImpl<ActionFilter>(actionFilterList, ActionFilter.class);
- chain.doFilter(req, resp);
- }
finally
{
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_CONFIG);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_REQUEST);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_RESPONSE);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_LIFECYCLE_PHASE);
dreq.removeAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
+ dreq.removeAttribute(Constants.JAVAX_PORTLET_CONFIG);
+ dreq.removeAttribute(Constants.JAVAX_PORTLET_REQUEST);
+ dreq.removeAttribute(Constants.JAVAX_PORTLET_RESPONSE);
+ dreq.removeAttribute(Constants.JAVAX_PORTLET_LIFECYCLE_PHASE);
}
-
- return resp.getResponse();
}
- protected PortletInvocationResponse invokeRender(RenderInvocation invocation) throws IOException, PortletException
- {
- PortletAPIFactory factory = application.getPortletAPIFactory();
- RenderRequestImpl req = factory.createRenderRequest(invocation);
- RenderResponseImpl resp = factory.createRenderResponse(invocation, req);
- HttpServletRequest dreq = invocation.getDispatchedRequest();
- try
- {
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_CONFIG, config);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_REQUEST, req);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_RESPONSE, resp);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_LIFECYCLE_PHASE, "RENDER_PHASE");
- dreq.setAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION, invocation);
-
- //
- FilterChainImpl<RenderFilter> chain = new FilterChainImpl<RenderFilter>(renderFilterList, RenderFilter.class);
- chain.doFilter(req, resp);
- }
- finally
- {
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_CONFIG);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_REQUEST);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_RESPONSE);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_LIFECYCLE_PHASE);
- dreq.removeAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
- }
- return resp.getResponse();
- }
-
- protected PortletInvocationResponse invokeEvent(EventInvocation invocation) throws IOException, PortletException
- {
- // Todo something clever if CCE occues
- EventPortlet eventPortlet = (EventPortlet)portlet;
-
- //
- PortletAPIFactory factory = application.getPortletAPIFactory();
- EventRequestImpl req = factory.createEventRequest(invocation);
- EventResponseImpl resp = factory.createEventResponse(invocation, req);
- HttpServletRequest dreq = invocation.getDispatchedRequest();
- try
- {
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_CONFIG, config);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_REQUEST, req);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_RESPONSE, resp);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_LIFECYCLE_PHASE, "EVENT_PHASE");
- dreq.setAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION, invocation);
-
- //
- FilterChainImpl<EventFilter> chain = new FilterChainImpl<EventFilter>(eventFilterList, EventFilter.class);
- chain.doFilter(req, resp);
- }
- finally
- {
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_CONFIG);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_REQUEST);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_RESPONSE);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_LIFECYCLE_PHASE);
- dreq.removeAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
- }
- return resp.getResponse();
- }
-
- protected PortletInvocationResponse invokeResource(ResourceInvocation invocation) throws IOException, PortletException
- {
- // Todo something clever if CCE occues
- ResourceServingPortlet eventPortlet = (ResourceServingPortlet)portlet;
-
- //
- PortletAPIFactory factory = application.getPortletAPIFactory();
- ResourceRequestImpl req = factory.createResourceRequest(invocation);
- ResourceResponseImpl resp = factory.createResourceResponse(invocation, req);
- HttpServletRequest dreq = invocation.getDispatchedRequest();
- try
- {
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_CONFIG, config);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_REQUEST, req);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_RESPONSE, resp);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_LIFECYCLE_PHASE, "RESOURCE_SERVING_PHASE");
- dreq.setAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION, invocation);
-
- //
- FilterChainImpl<ResourceFilter> chain = new FilterChainImpl<ResourceFilter>(resourceFilterList, ResourceFilter.class);
- chain.doFilter(req, resp);
- }
- finally
- {
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_CONFIG);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_REQUEST);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_RESPONSE);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_LIFECYCLE_PHASE);
- dreq.removeAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
- }
-
- //
- return resp.getResponse();
- }
-
private class Invoker implements ActionFilter, EventFilter, RenderFilter, ResourceFilter
{
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletRequestAttributes.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletRequestAttributes.java 2008-02-03 11:59:52 UTC (rev 9720)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletRequestAttributes.java 2008-02-03 16:12:29 UTC (rev 9721)
@@ -28,7 +28,7 @@
import org.jboss.portal.portlet.container.PortletContainer;
import javax.portlet.PortletRequest;
-import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
import java.util.Map;
import java.util.Enumeration;
import java.util.Set;
@@ -56,20 +56,29 @@
/** Constant object to mark that a request attribute is removed. */
protected static final Object REMOVED_ATTRIBUTE = new Object();
- private PortletContainer container;
+ /** . */
+ private final PortletContainer container;
- private UserContext userContext;
+ /** . */
+ private final UserContext userContext;
+ /** . */
+ private final HttpServletRequestWrapper wreq;
+
/** The lazy request attributes map added or removed during the request of the portlet. */
private Map<String, Object> attributes;
- public PortletRequestAttributes(PortletContainer container, UserContext userContext)
+ public PortletRequestAttributes(
+ PortletContainer container,
+ UserContext userContext,
+ HttpServletRequestWrapper wreq)
{
this.container = container;
this.userContext = userContext;
+ this.wreq = wreq;
}
- public Object getAttribute(String name, HttpServletRequest req)
+ public Object getAttribute(String name)
{
if (name == null)
{
@@ -107,9 +116,9 @@
{
value = attributes.get(name);
}
- if (value == null && req != null)
+ if (value == null && wreq != null)
{
- value = req.getAttribute(name);
+ value = wreq.getAttribute(name);
}
else if (value == REMOVED_ATTRIBUTE)
{
@@ -119,7 +128,7 @@
}
}
- public Iterator<String> getAttributeNames(HttpServletRequest req)
+ public Iterator<String> getAttributeNames()
{
// Copy the attribute names to avoid ConcurrentModificationException
// one test in the TCK getPortalObjectContext the Enumeration then dispatch the call to a
@@ -127,13 +136,10 @@
Set<String> names = new HashSet<String>();
//
- if (req != null)
+ for (Enumeration e = wreq.getAttributeNames();e.hasMoreElements();)
{
- for (Enumeration e = req.getAttributeNames();e.hasMoreElements();)
- {
- // Fixme : when migrated to servlet 2.5
- names.add((String)e.nextElement());
- }
+ // Fixme : when migrated to servlet 2.5
+ names.add((String)e.nextElement());
}
//
Deleted: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/RequestDispatcherImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/RequestDispatcherImpl.java 2008-02-03 11:59:52 UTC (rev 9720)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/RequestDispatcherImpl.java 2008-02-03 16:12:29 UTC (rev 9721)
@@ -1,77 +0,0 @@
-/******************************************************************************
- * 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. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.jsr168;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.ServletException;
-import java.io.IOException;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class RequestDispatcherImpl implements RequestDispatcher
-{
-
- /** . */
- private final RequestDispatcher realDispatcher;
-
- /** . */
- private final String path;
-
- public RequestDispatcherImpl(RequestDispatcher realDispatcher, String path)
- {
- this.realDispatcher = realDispatcher;
- this.path = path;
- }
-
- public void include(ServletRequest req, ServletResponse resp) throws ServletException, IOException
- {
- Dispatch dispatch = new Dispatch(DispatchType.INCLUDE, path);
- ((DispatchedHttpServletRequest)req).pushDispatch(dispatch);
- try
- {
- realDispatcher.include(req, resp);
- }
- finally
- {
- ((DispatchedHttpServletRequest)req).popDispatch();
- }
- }
-
- public void forward(ServletRequest req, ServletResponse resp) throws ServletException, IOException
- {
- Dispatch dispatch = new Dispatch(DispatchType.FORWARD, path);
- ((DispatchedHttpServletRequest)req).pushDispatch(dispatch);
- try
- {
- realDispatcher.forward(req, resp);
- }
- finally
- {
- ((DispatchedHttpServletRequest)req).popDispatch();
- }
- }
-}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/FilterChainImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/FilterChainImpl.java 2008-02-03 11:59:52 UTC (rev 9720)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/FilterChainImpl.java 2008-02-03 16:12:29 UTC (rev 9721)
@@ -37,6 +37,8 @@
import javax.portlet.RenderResponse;
import javax.portlet.EventRequest;
import javax.portlet.EventResponse;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
import java.io.IOException;
import java.util.List;
@@ -63,6 +65,30 @@
this.index = 0;
}
+ public void doFilter(PortletRequest req, PortletResponse resp) throws IOException, PortletException
+ {
+ if (req instanceof ActionRequest && resp instanceof ActionResponse)
+ {
+ doFilter((ActionRequest)req, (ActionResponse)resp);
+ }
+ else if (req instanceof EventRequest && resp instanceof EventResponse)
+ {
+ doFilter((EventRequest)req, (EventResponse)resp);
+ }
+ else if (req instanceof RenderRequest && resp instanceof RenderResponse)
+ {
+ doFilter((RenderRequest)req, (RenderResponse)resp);
+ }
+ else if (req instanceof ResourceRequest && resp instanceof ResourceResponse)
+ {
+ doFilter((ResourceRequest)req, (ResourceResponse)resp);
+ }
+ else
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+
public void doFilter(ActionRequest req, ActionResponse resp) throws IOException, PortletException
{
if (!ActionFilter.class.isAssignableFrom(phase))
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java 2008-02-03 11:59:52 UTC (rev 9720)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java 2008-02-03 16:12:29 UTC (rev 9721)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168.api;
-import org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.impl.jsr168.DispatchedHttpServletRequest;
import org.jboss.portal.portlet.impl.jsr168.DispatchedHttpServletResponse;
import org.jboss.portal.portlet.impl.jsr168.DispatchType;
@@ -39,11 +37,14 @@
import javax.portlet.PortletResponse;
import javax.portlet.ActionRequest;
import javax.portlet.EventRequest;
+import javax.portlet.ResourceRequest;
+import javax.portlet.filter.PortletRequestWrapper;
+import javax.portlet.filter.PortletResponseWrapper;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpServletResponseWrapper;
import java.io.IOException;
/**
@@ -88,48 +89,48 @@
private void dispatch(
DispatchType type,
- PortletRequest req,
- PortletResponse resp) throws PortletException, IOException
+ PortletRequest wreq,
+ PortletResponse wresp) throws PortletException, IOException
{
+ PortletRequestImpl req = unwrap(wreq);
+ PortletResponseImpl resp = unwrap(wresp);
+
+ //
Dispatch dispatch = new Dispatch(type, path);
//
try
{
- // Get the invocation that is still in the request
- PortletInvocation invocation = (PortletInvocation)req.getAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
-
- //
- PortletApplication application = ((PortletRequestImpl)req).container.getApplication();
+ PortletApplication application = req.container.getApplication();
PortletApplicationContext applicationContext = application.getContext();
ServletContext servletContext = applicationContext.getServletContext();
//
- HttpServletRequest dreq = invocation.getDispatchedRequest();
- HttpServletResponse dresp = invocation.getDispatchedResponse();
+ HttpServletRequestWrapper realReq = req.getRealRequest();
+ HttpServletResponseWrapper realResp = resp.getRealResponse();
//
DispatchedHttpServletRequest direq;
DispatchedHttpServletResponse diresp;
if (req instanceof ActionRequest)
{
- direq = new DispatchedHttpServletRequest.Action(dispatch, (ActionRequestImpl)req, dreq, servletContext);
- diresp = new DispatchedHttpServletResponse.StateAware(direq, (StateAwareResponseImpl)resp, dresp);
+ direq = new DispatchedHttpServletRequest.Action(dispatch, (ActionRequest)req, realReq, servletContext);
+ diresp = new DispatchedHttpServletResponse.StateAware(direq, (StateAwareResponseImpl)resp, realResp);
}
else if (req instanceof EventRequest)
{
- direq = new DispatchedHttpServletRequest.Event(dispatch, (EventRequestImpl)req, dreq, servletContext);
- diresp = new DispatchedHttpServletResponse.StateAware(direq, (StateAwareResponseImpl)resp, dresp);
+ direq = new DispatchedHttpServletRequest.Event(dispatch, (EventRequest)req, realReq, servletContext);
+ diresp = new DispatchedHttpServletResponse.StateAware(direq, (StateAwareResponseImpl)resp, realResp);
}
else if (req instanceof RenderRequest)
{
- direq = new DispatchedHttpServletRequest.Render(dispatch, (RenderRequestImpl)req, dreq, servletContext);
- diresp = new DispatchedHttpServletResponse.Mime(direq, (MimeResponseImpl)resp, dresp);
+ direq = new DispatchedHttpServletRequest.Render(dispatch, (RenderRequest)req, realReq, servletContext);
+ diresp = new DispatchedHttpServletResponse.Mime(direq, (MimeResponseImpl)resp, realResp);
}
else
{
- direq = new DispatchedHttpServletRequest.Resource(dispatch, (ResourceRequestImpl)req, dreq, servletContext);
- diresp = new DispatchedHttpServletResponse.Mime(direq, (MimeResponseImpl)resp, dresp);
+ direq = new DispatchedHttpServletRequest.Resource(dispatch, (ResourceRequest)req, realReq, servletContext);
+ diresp = new DispatchedHttpServletResponse.Mime(direq, (MimeResponseImpl)resp, realResp);
}
//
@@ -149,4 +150,44 @@
throw new PortletException(e);
}
}
+
+ private PortletRequestImpl unwrap(PortletRequest wrapped)
+ {
+ while (true)
+ {
+ if (wrapped instanceof PortletRequestImpl)
+ {
+ return (PortletRequestImpl)wrapped;
+ }
+ else if (wrapped instanceof PortletRequestWrapper)
+ {
+ PortletRequestWrapper wrapper = (PortletRequestWrapper)wrapped;
+ wrapped = wrapper.getRequest();
+ }
+ else
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+ }
+
+ private PortletResponseImpl unwrap(PortletResponse wrapped)
+ {
+ while (true)
+ {
+ if (wrapped instanceof PortletResponseImpl)
+ {
+ return (PortletResponseImpl)wrapped;
+ }
+ else if (wrapped instanceof PortletResponseWrapper)
+ {
+ PortletResponseWrapper wrapper = (PortletResponseWrapper)wrapped;
+ wrapped = wrapper.getResponse();
+ }
+ else
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+ }
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java 2008-02-03 11:59:52 UTC (rev 9720)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java 2008-02-03 16:12:29 UTC (rev 9721)
@@ -56,9 +56,9 @@
import javax.portlet.PreferencesValidator;
import javax.portlet.RenderRequest;
import javax.portlet.WindowState;
-import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequestWrapper;
import java.security.Principal;
import java.util.Collections;
import java.util.Enumeration;
@@ -81,18 +81,43 @@
/** . */
protected static final Logger log = Logger.getLogger(PortletRequestImpl.class);
+ /** . */
protected PortletInvocation invocation;
+
+ /** . */
protected ClientContext clientContext;
+
+ /** . */
protected UserContext userContext;
+
+ /** . */
protected SecurityContext securityContext;
+
+ /** . */
protected ServerContext serverContext;
+
+ /** . */
protected WindowContext windowContext;
+
+ /** . */
protected PortletPreferences preferences;
+
+ /** . */
protected PortletContainerImpl container;
- protected HttpServletRequest dreq;
+
+ /** . */
+ private HttpServletRequestWrapper realReq;
+
+ /** . */
protected PortalContext portalContext;
+
+ /** . */
protected PortletSessionImpl psession;
+
+ /** . */
protected int sessionStatus;
+
+ /** . */
protected ContainerNavigationInfo navigationInfo;
/** . */
@@ -110,6 +135,9 @@
/** . */
protected final Set<org.jboss.portal.WindowState> supportedWindowStates;
+ /** . */
+ private final String contextPath;
+
public PortletRequestImpl(PortletInvocation invocation)
{
PortletContainerImpl container = (PortletContainerImpl)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PortletContainerInvoker.PORTLET_CONTAINER);
@@ -122,6 +150,7 @@
UserContext userContext = invocation.getUserContext();
//
+ this.contextPath = (String)invocation.getDispatchedRequest().getAttribute("javax.servlet.include.context_path");
this.invocation = invocation;
this.userContext = userContext;
this.securityContext = invocation.getSecurityContext();
@@ -129,9 +158,9 @@
this.clientContext = invocation.getClientContext();
this.windowContext = invocation.getWindowContext();
this.container = container;
- this.dreq = invocation.getDispatchedRequest();
+ this.realReq = new HttpServletRequestWrapper(invocation.getDispatchedRequest());
this.portalContext = new PortalContextImpl(invocation.getPortalContext());
- this.attributes = new PortletRequestAttributes(container, userContext);
+ this.attributes = new PortletRequestAttributes(container, userContext, realReq);
this.preferences = new PortletPreferencesImpl(prefs, containerPrefs, validator, mode);
this.navigationInfo = navigationInfo;
this.requestParameterMap = PortletRequestParameterMap.create(navigationInfo, invocation.getContext());
@@ -145,7 +174,7 @@
{
if (name == null)
{
- throw new IllegalArgumentException("Name shoudl not be null");
+ throw new IllegalArgumentException("Name should not be null");
}
//
@@ -206,15 +235,14 @@
// PLT.11.1.3
-
public Object getAttribute(String name) throws IllegalArgumentException
{
- return attributes.getAttribute(name, dreq);
+ return attributes.getAttribute(name);
}
public Enumeration<String> getAttributeNames()
{
- return Tools.toEnumeration(attributes.getAttributeNames(dreq));
+ return Tools.toEnumeration(attributes.getAttributeNames());
}
public void setAttribute(String name, Object value)
@@ -273,7 +301,7 @@
public String getContextPath()
{
- return (String)dreq.getAttribute("javax.servlet.include.context_path");
+ return contextPath;
}
// PLT.11.1.6
@@ -392,14 +420,14 @@
else if (create)
{
// For sure we need a session we will obtain a valid one
- HttpSession hsession = dreq.getSession();
+ HttpSession hsession = realReq.getSession();
PortletApplicationImpl portletApp = (PortletApplicationImpl)container.getApplication();
psession = new PortletSessionImpl(hsession, windowContext.getId(), portletApp.getPortletContext());
}
else
{
// Here we can try an existing session but it may return null
- HttpSession hsession = dreq.getSession(false);
+ HttpSession hsession = realReq.getSession(false);
//
if (hsession != null)
@@ -420,12 +448,12 @@
public String getRequestedSessionId()
{
- return dreq.getRequestedSessionId();
+ return realReq.getRequestedSessionId();
}
public boolean isRequestedSessionIdValid()
{
- return dreq.isRequestedSessionIdValid();
+ return realReq.isRequestedSessionIdValid();
}
public Enumeration<Locale> getLocales()
@@ -510,6 +538,11 @@
}
}
+ public final HttpServletRequestWrapper getRealRequest()
+ {
+ return realReq;
+ }
+
private MultiValuedPropertyMap<String> getProperties()
{
if (properties == null)
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletResponseImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletResponseImpl.java 2008-02-03 11:59:52 UTC (rev 9720)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletResponseImpl.java 2008-02-03 16:12:29 UTC (rev 9721)
@@ -32,6 +32,7 @@
import javax.portlet.PortletResponse;
import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponseWrapper;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@@ -57,10 +58,14 @@
/** . */
private ResponseProperties properties;
+ /** . */
+ private HttpServletResponseWrapper realResp;
+
protected PortletResponseImpl(PortletInvocation invocation, PortletRequestImpl preq)
{
this.invocation = invocation;
this.preq = preq;
+ this.realResp = new HttpServletResponseWrapper(invocation.getDispatchedResponse());
}
public abstract PortletInvocationResponse getResponse();
@@ -133,6 +138,11 @@
return namespace;
}
+ public final HttpServletResponseWrapper getRealResponse()
+ {
+ return realResp;
+ }
+
protected final ResponseProperties getProperties()
{
return getProperties(true);
18 years, 2 months
JBoss Portal SVN: r9720 - in modules/portlet/trunk/portlet/src: main/java/org/jboss/portal/portlet/impl/jsr168/api and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-03 06:59:52 -0500 (Sun, 03 Feb 2008)
New Revision: 9720
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpSession.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchtedRequestDispatcher.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/session/HTTPSessionInvalidationInvalidesPortletSessionTestCase.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletSessionImpl.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/session/ObtainNonNullSessionUsingCreateEqualsFalseTestCase.java
Log:
- rewrote portlet session obtention
- rewrote http portlet session wrapper obtention
- added test case for portlet session
- added http request/response unwrapping for dispatch
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java 2008-02-03 02:13:01 UTC (rev 9719)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java 2008-02-03 11:59:52 UTC (rev 9720)
@@ -40,6 +40,7 @@
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.portlet.PortletSession;
+import javax.portlet.PortletRequest;
import java.security.Principal;
import java.util.Enumeration;
import java.util.Locale;
@@ -107,7 +108,7 @@
final DispatchType dispatchType;
/** . */
- private final PortletRequestImpl preq;
+ private final PortletRequest preq;
/** . */
private final HttpServletRequest dreq;
@@ -127,6 +128,9 @@
/** . */
private final ServletContext servletContext;
+ /** . */
+ private DispatchedHttpSession[] session;
+
public DispatchedHttpServletRequest(
Dispatch dispatch,
PortletRequestImpl preq,
@@ -274,12 +278,12 @@
}
//
- return preq.getAttributes().getAttribute(s, (HttpServletRequest)getRequest());
+ return ((PortletRequestImpl)preq).getAttributes().getAttribute(s, (HttpServletRequest)getRequest());
}
public final Enumeration getAttributeNames()
{
- Set<String> names = Tools.toSet(preq.getAttributes().getAttributeNames(null));
+ Set<String> names = Tools.toSet(((PortletRequestImpl)preq).getAttributes().getAttributeNames(null));
// Add super stuff that is not reserved
for (Enumeration e = super.getAttributeNames();e.hasMoreElements();)
@@ -308,7 +312,7 @@
}
//
- preq.getAttributes().setAttribute(s, o);
+ ((PortletRequestImpl)preq).getAttributes().setAttribute(s, o);
}
public final void removeAttribute(String s)
@@ -461,7 +465,7 @@
public final RequestDispatcher getRequestDispatcher(String s)
{
- return new RequestDispatcherImpl(dreq.getRequestDispatcher(s), s);
+ return new DispatchtedRequestDispatcher(dreq.getRequestDispatcher(s), s);
}
public final boolean isUserInRole(String s)
@@ -471,12 +475,12 @@
public final HttpSession getSession(boolean b)
{
- return preq.getPortletSession(b).getHttpSession(PortletSession.APPLICATION_SCOPE);
+ return getSession(b, PortletSession.APPLICATION_SCOPE);
}
public final HttpSession getSession()
{
- return preq.getPortletSession().getHttpSession(PortletSession.APPLICATION_SCOPE);
+ return getSession(true);
}
public final boolean isRequestedSessionIdFromCookie()
@@ -803,4 +807,52 @@
return "GET";
}
}
+
+ /**
+ * Returns the an implementation of <code>javax.servlet.http.HttpSession</code> that wraps this
+ * portlet session and use the specified scope for manipulating attributes. This session is used
+ * during the request dispatch to a servlet.
+ *
+ * @param scope the scope
+ * @return the wrapped session
+ */
+ private HttpSession getSession(boolean create, int scope)
+ {
+ if (session == null)
+ {
+ session = new DispatchedHttpSession[2];
+ }
+
+ // Dereference an existing session if necessary
+ if (session[scope] != null && !session[scope].isValid())
+ {
+ session[scope] = null;
+ }
+
+ // If we have a session here we are sure it is valid and ok to return it
+ if (session[scope] != null)
+ {
+ // So we do nothing
+ }
+ else if (create)
+ {
+ // For sure we need a session we will obtain a valid one
+ PortletSession portletSession = preq.getPortletSession();
+ session[scope] = new DispatchedHttpSession(this, portletSession, scope);
+ }
+ else
+ {
+ // Here we can try an existing session but it may return null
+ PortletSession portletSession = preq.getPortletSession(false);
+
+ //
+ if (portletSession != null)
+ {
+ session[scope] = new DispatchedHttpSession(this, portletSession, scope);
+ }
+ }
+
+ //
+ return session[scope];
+ }
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java 2008-02-03 02:13:01 UTC (rev 9719)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java 2008-02-03 11:59:52 UTC (rev 9720)
@@ -24,7 +24,6 @@
import org.jboss.portal.portlet.impl.jsr168.api.MimeResponseImpl;
import org.jboss.portal.portlet.impl.jsr168.api.StateAwareResponseImpl;
-import org.jboss.portal.common.NotYetImplemented;
import javax.portlet.PortletResponse;
import javax.servlet.ServletOutputStream;
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpSession.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpSession.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpSession.java 2008-02-03 11:59:52 UTC (rev 9720)
@@ -0,0 +1,149 @@
+/******************************************************************************
+ * 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. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168;
+
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.ServletContext;
+import javax.portlet.PortletSession;
+import java.util.Enumeration;
+import java.util.ArrayList;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class DispatchedHttpSession implements HttpSession
+{
+
+ /** . */
+ private final DispatchedHttpServletRequest dispatchedRequest;
+
+ /** . */
+ private final PortletSession delegate;
+
+ /** . */
+ private final int scope;
+
+ public DispatchedHttpSession(DispatchedHttpServletRequest dispatchedRequest, PortletSession delegate, int scope)
+ {
+ this.dispatchedRequest = dispatchedRequest;
+ this.delegate = delegate;
+ this.scope = scope;
+ }
+
+ public long getCreationTime()
+ {
+ return delegate.getCreationTime();
+ }
+
+ public String getId()
+ {
+ return delegate.getId();
+ }
+
+ public long getLastAccessedTime()
+ {
+ return delegate.getLastAccessedTime();
+ }
+
+ public ServletContext getServletContext()
+ {
+ return ((HttpServletRequest)dispatchedRequest.getRequest()).getSession().getServletContext();
+ }
+
+ public void setMaxInactiveInterval(int i)
+ {
+ delegate.setMaxInactiveInterval(i);
+ }
+
+ public int getMaxInactiveInterval()
+ {
+ return delegate.getMaxInactiveInterval();
+ }
+
+ public HttpSessionContext getSessionContext()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getAttribute(String s)
+ {
+ return delegate.getAttribute(s, scope);
+ }
+
+ public Object getValue(String s)
+ {
+ return getAttribute(s);
+ }
+
+ public Enumeration getAttributeNames()
+ {
+ return delegate.getAttributeNames(scope);
+ }
+
+ public String[] getValueNames()
+ {
+ ArrayList<String> names = Collections.list(delegate.getAttributeNames());
+
+ //
+ return names.toArray(new String[names.size()]);
+ }
+
+ public void setAttribute(String s, Object o)
+ {
+ delegate.setAttribute(s, o, scope);
+ }
+
+ public void putValue(String s, Object o)
+ {
+ setAttribute(s, o);
+ }
+
+ public void removeAttribute(String s)
+ {
+ delegate.removeAttribute(s, scope);
+ }
+
+ public void removeValue(String s)
+ {
+ removeAttribute(s);
+ }
+
+ public void invalidate()
+ {
+ delegate.invalidate();
+ }
+
+ public boolean isNew()
+ {
+ return delegate.isNew();
+ }
+
+ boolean isValid()
+ {
+ return true;
+ }
+}
Copied: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchtedRequestDispatcher.java (from rev 9707, modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/RequestDispatcherImpl.java)
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchtedRequestDispatcher.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchtedRequestDispatcher.java 2008-02-03 11:59:52 UTC (rev 9720)
@@ -0,0 +1,125 @@
+/******************************************************************************
+ * 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. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequestWrapper;
+import javax.servlet.ServletResponseWrapper;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class DispatchtedRequestDispatcher implements RequestDispatcher
+{
+
+ /** . */
+ private final RequestDispatcher realDispatcher;
+
+ /** . */
+ private final String path;
+
+ public DispatchtedRequestDispatcher(RequestDispatcher realDispatcher, String path)
+ {
+ this.realDispatcher = realDispatcher;
+ this.path = path;
+ }
+
+ public void include(ServletRequest req, ServletResponse resp) throws ServletException, IOException
+ {
+ DispatchedHttpServletRequest dreq = unwrap(req);
+ unwrap(resp);
+
+ //
+ dreq.pushDispatch(new Dispatch(DispatchType.INCLUDE, path));
+ try
+ {
+ realDispatcher.include(req, resp);
+ }
+ finally
+ {
+ dreq.popDispatch();
+ }
+ }
+
+ public void forward(ServletRequest req, ServletResponse resp) throws ServletException, IOException
+ {
+ DispatchedHttpServletRequest dreq = unwrap(req);
+ unwrap(resp);
+
+ //
+ dreq.pushDispatch(new Dispatch(DispatchType.FORWARD, path));
+ try
+ {
+ realDispatcher.forward(req, resp);
+ }
+ finally
+ {
+ dreq.popDispatch();
+ }
+ }
+
+ private static DispatchedHttpServletRequest unwrap(ServletRequest wrapped)
+ {
+ while (true)
+ {
+ if (wrapped instanceof DispatchedHttpServletRequest)
+ {
+ return (DispatchedHttpServletRequest)wrapped;
+ }
+ else if (wrapped instanceof ServletRequestWrapper)
+ {
+ ServletRequestWrapper wrapper = (ServletRequestWrapper)wrapped;
+ wrapped = wrapper.getRequest();
+ }
+ else
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+ }
+
+ private static DispatchedHttpServletResponse unwrap(ServletResponse wrapped)
+ {
+ while (true)
+ {
+ if (wrapped instanceof DispatchedHttpServletResponse)
+ {
+ return (DispatchedHttpServletResponse)wrapped;
+ }
+ else if (wrapped instanceof ServletResponseWrapper)
+ {
+ ServletResponseWrapper wrapper = (ServletResponseWrapper)wrapped;
+ wrapped = wrapper.getResponse();
+ }
+ else
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+ }
+}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java 2008-02-03 02:13:01 UTC (rev 9719)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java 2008-02-03 11:59:52 UTC (rev 9720)
@@ -22,8 +22,15 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletRequestImpl;
+
import javax.portlet.PortletMode;
import javax.portlet.WindowState;
+import javax.portlet.PortletRequest;
+import javax.portlet.RenderRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.filter.PortletRequestWrapper;
+import javax.portlet.filter.PortletResponseWrapper;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -116,4 +123,44 @@
tmp.append(SUFFIX);
return tmp.toString();
}
+
+ public static <U extends PortletRequest> U unwrap(PortletRequest wrapped, Class<U> unwrapped)
+ {
+ while (true)
+ {
+ if (wrapped instanceof PortletRequestWrapper)
+ {
+ PortletRequestWrapper wrapper = (PortletRequestWrapper)wrapped;
+ wrapped = wrapper.getRequest();
+ }
+ else if (unwrapped.isInstance(wrapped))
+ {
+ return unwrapped.cast(wrapped);
+ }
+ else
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+ }
+
+ public static <U extends PortletResponse> U unwrap(PortletResponse wrapped, Class<U> unwrapped)
+ {
+ while (true)
+ {
+ if (wrapped instanceof PortletResponseWrapper)
+ {
+ PortletResponseWrapper wrapper = (PortletResponseWrapper)wrapped;
+ wrapped = wrapper.getResponse();
+ }
+ else if (unwrapped.isInstance(wrapped))
+ {
+ return unwrapped.cast(wrapped);
+ }
+ else
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+ }
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java 2008-02-03 02:13:01 UTC (rev 9719)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java 2008-02-03 11:59:52 UTC (rev 9720)
@@ -378,39 +378,36 @@
public PortletSessionImpl getPortletSession(boolean create)
{
- //
- if (create)
+ // Dereference an existing session if it is not valid
+ if (psession != null && !psession.isValid())
{
- // Create the session with the dispatched request
- HttpSession hsession = dreq.getSession(true);
+ psession = null;
+ }
- // Create portlet session
+ // If we have a session here we are sure it is valid and ok to return it
+ if (psession != null)
+ {
+ // So we do nothing
+ }
+ else if (create)
+ {
+ // For sure we need a session we will obtain a valid one
+ HttpSession hsession = dreq.getSession();
PortletApplicationImpl portletApp = (PortletApplicationImpl)container.getApplication();
- psession = new PortletSessionImpl(
- hsession,
- windowContext.getId(),
- portletApp.getPortletContext());
+ psession = new PortletSessionImpl(hsession, windowContext.getId(), portletApp.getPortletContext());
}
- else if (psession == null)
+ else
{
+ // Here we can try an existing session but it may return null
HttpSession hsession = dreq.getSession(false);
//
if (hsession != null)
{
- // Create portlet session
PortletApplicationImpl portletApp = (PortletApplicationImpl)container.getApplication();
- psession = new PortletSessionImpl(
- hsession,
- windowContext.getId(),
- portletApp.getPortletContext());
+ psession = new PortletSessionImpl(hsession, windowContext.getId(), portletApp.getPortletContext());
}
}
- else if (!psession.isValid())
- {
- // If we don't create and the underlying http session is not valid we return null
- psession = null;
- }
//
return psession;
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletSessionImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletSessionImpl.java 2008-02-03 02:13:01 UTC (rev 9719)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletSessionImpl.java 2008-02-03 11:59:52 UTC (rev 9720)
@@ -50,19 +50,11 @@
/** . */
private PortletContext context;
- /** . */
- private HttpPortletSession applicationScopedHttpSession;
-
- /** . */
- private HttpPortletSession portletScopedHttpSession;
-
public PortletSessionImpl(HttpSession session, String id, PortletContext context)
{
this.session = session;
this.prefix = "javax.portlet.p." + id + "?";
this.context = context;
- this.applicationScopedHttpSession = null;
- this.portletScopedHttpSession = null;
}
public Object getAttribute(String s)
@@ -159,9 +151,6 @@
{
// Invalidate the underlying HTTP session
session.invalidate();
-
- // Mark the session as invalid
- // valid = false;
}
public boolean isNew()
@@ -226,35 +215,6 @@
}
/**
- * Returns the an implementation of <code>javax.servlet.http.HttpSession</code> that wraps this
- * portlet session and use the specified scope for manipulating attributes. This session is used
- * during the request dispatch to a servlet.
- *
- * @param scope the scope
- * @return the wrapped session
- */
- public HttpSession getHttpSession(int scope)
- {
- switch (scope)
- {
- case APPLICATION_SCOPE:
- if (applicationScopedHttpSession == null)
- {
- applicationScopedHttpSession = new HttpPortletSession(this, APPLICATION_SCOPE);
- }
- return applicationScopedHttpSession;
- case PORTLET_SCOPE:
- if (portletScopedHttpSession == null)
- {
- portletScopedHttpSession = new HttpPortletSession(this, PORTLET_SCOPE);
- }
- return portletScopedHttpSession;
- default:
- throw new IllegalArgumentException("Unrecognzed session scope " + scope);
- }
- }
-
- /**
* Detect validity of the session based on the underlying session.
*
* @return true if the session is valid
@@ -271,108 +231,4 @@
return false;
}
}
-
- private static class HttpPortletSession implements HttpSession
- {
-
- /** . */
- private final PortletSessionImpl delegate;
-
- /** . */
- private final int scope;
-
- private HttpPortletSession(PortletSessionImpl delegate, int scope)
- {
- this.delegate = delegate;
- this.scope = scope;
- }
-
- public long getCreationTime()
- {
- return delegate.getCreationTime();
- }
-
- public String getId()
- {
- return delegate.getId();
- }
-
- public long getLastAccessedTime()
- {
- return delegate.getLastAccessedTime();
- }
-
- public ServletContext getServletContext()
- {
- return delegate.session.getServletContext();
- }
-
- public void setMaxInactiveInterval(int i)
- {
- delegate.setMaxInactiveInterval(i);
- }
-
- public int getMaxInactiveInterval()
- {
- return delegate.getMaxInactiveInterval();
- }
-
- public HttpSessionContext getSessionContext()
- {
- throw new UnsupportedOperationException();
- }
-
- public Object getAttribute(String s)
- {
- return delegate.getAttribute(s, scope);
- }
-
- public Object getValue(String s)
- {
- return getAttribute(s);
- }
-
- public Enumeration getAttributeNames()
- {
- return delegate.getAttributeNames(scope);
- }
-
- public String[] getValueNames()
- {
- ArrayList<String> names = Collections.list(delegate.getAttributeNames());
-
- //
- return names.toArray(new String[names.size()]);
- }
-
- public void setAttribute(String s, Object o)
- {
- delegate.setAttribute(s, o, scope);
- }
-
- public void putValue(String s, Object o)
- {
- setAttribute(s, o);
- }
-
- public void removeAttribute(String s)
- {
- delegate.removeAttribute(s, scope);
- }
-
- public void removeValue(String s)
- {
- removeAttribute(s);
- }
-
- public void invalidate()
- {
- delegate.invalidate();
- }
-
- public boolean isNew()
- {
- return delegate.isNew();
- }
- }
}
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/session/HTTPSessionInvalidationInvalidesPortletSessionTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/session/HTTPSessionInvalidationInvalidesPortletSessionTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/session/HTTPSessionInvalidationInvalidesPortletSessionTestCase.java 2008-02-03 11:59:52 UTC (rev 9720)
@@ -0,0 +1,95 @@
+/******************************************************************************
+ * 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. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr168.ext.session;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.*;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSession;
+import javax.servlet.http.HttpSessionBindingListener;
+import javax.servlet.http.HttpSessionBindingEvent;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class HTTPSessionInvalidationInvalidesPortletSessionTestCase
+{
+
+ public HTTPSessionInvalidationInvalidesPortletSessionTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ PortletSession session = request.getPortletSession();
+
+ // Invalidates the real http session
+ SessionInvalidator invalidator = new SessionInvalidator();
+ invalidator.invalidate(session);
+
+ // Now it should be null
+ session = request.getPortletSession(false);
+ assertNull(session);
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+
+ private static class SessionInvalidator implements HttpSessionBindingListener
+ {
+
+ /** . */
+ private HttpSession realSession;
+
+ public void valueBound(HttpSessionBindingEvent event)
+ {
+ this.realSession = event.getSession();
+ }
+
+ public void valueUnbound(HttpSessionBindingEvent event)
+ {
+ }
+
+ public void invalidate(PortletSession session)
+ {
+ session.setAttribute("foo", this);
+ realSession.invalidate();
+ }
+ }
+}
\ No newline at end of file
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/session/ObtainNonNullSessionUsingCreateEqualsFalseTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/session/ObtainNonNullSessionUsingCreateEqualsFalseTestCase.java 2008-02-03 02:13:01 UTC (rev 9719)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/session/ObtainNonNullSessionUsingCreateEqualsFalseTestCase.java 2008-02-03 11:59:52 UTC (rev 9720)
@@ -52,6 +52,10 @@
@TestCase
public class ObtainNonNullSessionUsingCreateEqualsFalseTestCase
{
+
+ /** . */
+ private String sessionId;
+
public ObtainNonNullSessionUsingCreateEqualsFalseTestCase(PortletTestCase seq)
{
seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
@@ -60,9 +64,9 @@
{
PortletSession session = request.getPortletSession();
assertNotNull(session);
+ sessionId = session.getId();
session.setAttribute("foo_1", "bar_1");
- InvokeGetResponse igr = new InvokeGetResponse(response.createActionURL().toString());
- return igr;
+ return new InvokeGetResponse(response.createActionURL().toString());
}
});
seq.bindAction(1, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
@@ -71,6 +75,7 @@
{
PortletSession session = request.getPortletSession(false);
assertNotNull(session);
+ assertEquals(sessionId, session.getId());
assertEquals("bar_1", session.getAttribute("foo_1"));
session.setAttribute("foo_2", "bar_2");
}
@@ -81,6 +86,7 @@
{
PortletSession session = request.getPortletSession(false);
assertNotNull(session);
+ assertEquals(sessionId, session.getId());
assertEquals("bar_1", session.getAttribute("foo_1"));
assertEquals("bar_2", session.getAttribute("foo_2"));
return new EndTestResponse();
18 years, 2 months
JBoss Portal SVN: r9719 - in modules/portlet/trunk: test/src/test/resources/jsr286/tck/portletfilter-war/WEB-INF and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-02 21:13:01 -0500 (Sat, 02 Feb 2008)
New Revision: 9719
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletfilter/PropagateDoFilterArgsFilter1.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletfilter/PropagateDoFilterArgsFilter2.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletfilter/PropagateDoFilterArgsTestCase.java
modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletfilter-war/WEB-INF/portlet.xml
Log:
extend filter test case to the 4 life cycles
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletfilter/PropagateDoFilterArgsFilter1.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletfilter/PropagateDoFilterArgsFilter1.java 2008-02-03 01:56:50 UTC (rev 9718)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletfilter/PropagateDoFilterArgsFilter1.java 2008-02-03 02:13:01 UTC (rev 9719)
@@ -25,10 +25,22 @@
import org.jboss.portal.test.portlet.jsr286.common.AbstractPortletFilter;
import org.jboss.portal.test.portlet.jsr286.common.CustomRenderRequest;
import org.jboss.portal.test.portlet.jsr286.common.CustomRenderResponse;
+import org.jboss.portal.test.portlet.jsr286.common.CustomEventRequest;
+import org.jboss.portal.test.portlet.jsr286.common.CustomEventResponse;
+import org.jboss.portal.test.portlet.jsr286.common.CustomActionRequest;
+import org.jboss.portal.test.portlet.jsr286.common.CustomActionResponse;
+import org.jboss.portal.test.portlet.jsr286.common.CustomResourceRequest;
+import org.jboss.portal.test.portlet.jsr286.common.CustomResourceResponse;
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 javax.portlet.filter.FilterChain;
import javax.portlet.filter.RenderFilter;
import java.io.IOException;
@@ -41,11 +53,29 @@
{
/** . */
+ public static CustomActionRequest publishedActionRequest;
+
+ /** . */
+ public static CustomActionResponse publishedActionResponse;
+
+ /** . */
+ public static CustomEventRequest publishedEventRequest;
+
+ /** . */
+ public static CustomEventResponse publishedEventResponse;
+
+ /** . */
public static CustomRenderRequest publishedRenderRequest;
/** . */
public static CustomRenderResponse publishedRenderResponse;
+ /** . */
+ public static CustomResourceRequest publishedResourceRequest;
+
+ /** . */
+ public static CustomResourceResponse publishedResourceResponse;
+
public void doFilter(RenderRequest req, RenderResponse resp, FilterChain chain) throws IOException, PortletException
{
try
@@ -58,4 +88,43 @@
publishedRenderResponse = null;
}
}
+
+ public void doFilter(ActionRequest req, ActionResponse resp, FilterChain chain) throws IOException, PortletException
+ {
+ try
+ {
+ chain.doFilter(publishedActionRequest = new CustomActionRequest(req), publishedActionResponse = new CustomActionResponse(resp));
+ }
+ finally
+ {
+ publishedActionRequest = null;
+ publishedActionResponse = null;
+ }
+ }
+
+ public void doFilter(EventRequest req, EventResponse resp, FilterChain chain) throws IOException, PortletException
+ {
+ try
+ {
+ chain.doFilter(publishedEventRequest = new CustomEventRequest(req), publishedEventResponse = new CustomEventResponse(resp));
+ }
+ finally
+ {
+ publishedEventRequest = null;
+ publishedEventResponse = null;
+ }
+ }
+
+ public void doFilter(ResourceRequest req, ResourceResponse resp, FilterChain chain) throws IOException, PortletException
+ {
+ try
+ {
+ chain.doFilter(publishedResourceRequest = new CustomResourceRequest(req), publishedResourceResponse = new CustomResourceResponse(resp));
+ }
+ finally
+ {
+ publishedResourceRequest = null;
+ publishedResourceResponse = null;
+ }
+ }
}
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletfilter/PropagateDoFilterArgsFilter2.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletfilter/PropagateDoFilterArgsFilter2.java 2008-02-03 01:56:50 UTC (rev 9718)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletfilter/PropagateDoFilterArgsFilter2.java 2008-02-03 02:13:01 UTC (rev 9719)
@@ -25,11 +25,23 @@
import org.jboss.portal.test.portlet.jsr286.common.AbstractPortletFilter;
import org.jboss.portal.test.portlet.jsr286.common.CustomRenderRequest;
import org.jboss.portal.test.portlet.jsr286.common.CustomRenderResponse;
+import org.jboss.portal.test.portlet.jsr286.common.CustomActionRequest;
+import org.jboss.portal.test.portlet.jsr286.common.CustomActionResponse;
+import org.jboss.portal.test.portlet.jsr286.common.CustomEventRequest;
+import org.jboss.portal.test.portlet.jsr286.common.CustomEventResponse;
+import org.jboss.portal.test.portlet.jsr286.common.CustomResourceRequest;
+import org.jboss.portal.test.portlet.jsr286.common.CustomResourceResponse;
import static org.jboss.unit.api.Assert.*;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.PortletException;
+import javax.portlet.ResourceResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.EventResponse;
+import javax.portlet.ActionRequest;
+import javax.portlet.EventRequest;
import javax.portlet.filter.FilterChain;
import javax.portlet.filter.RenderFilter;
import java.io.IOException;
@@ -42,17 +54,53 @@
{
/** . */
+ public static ActionRequest consumedActionRequest;
+
+ /** . */
+ public static ActionResponse consumedActionResponse;
+
+ /** . */
+ public static EventRequest consumedEventRequest;
+
+ /** . */
+ public static EventResponse consumedEventResponse;
+
+ /** . */
public static RenderRequest consumedRenderRequest;
/** . */
public static RenderResponse consumedRenderResponse;
/** . */
+ public static ResourceRequest consumedResourceRequest;
+
+ /** . */
+ public static ResourceResponse consumedResourceResponse;
+
+ /** . */
+ public static CustomActionRequest publishedActionRequest;
+
+ /** . */
+ public static CustomActionResponse publishedActionResponse;
+
+ /** . */
+ public static CustomEventRequest publishedEventRequest;
+
+ /** . */
+ public static CustomEventResponse publishedEventResponse;
+
+ /** . */
public static CustomRenderRequest publishedRenderRequest;
/** . */
public static CustomRenderResponse publishedRenderResponse;
+ /** . */
+ public static CustomResourceRequest publishedResourceRequest;
+
+ /** . */
+ public static CustomResourceResponse publishedResourceResponse;
+
public void doFilter(RenderRequest req, RenderResponse resp, FilterChain chain) throws IOException, PortletException
{
consumedRenderRequest = req;
@@ -71,4 +119,61 @@
publishedRenderResponse = null;
}
}
+
+ public void doFilter(ActionRequest req, ActionResponse resp, FilterChain chain) throws IOException, PortletException
+ {
+ consumedActionRequest = req;
+ consumedActionResponse = resp;
+
+ //
+ try
+ {
+ chain.doFilter(publishedActionRequest = new CustomActionRequest(req), publishedActionResponse = new CustomActionResponse(resp));
+ }
+ finally
+ {
+ consumedActionRequest = null;
+ consumedActionResponse = null;
+ publishedActionRequest = null;
+ publishedActionResponse = null;
+ }
+ }
+
+ public void doFilter(EventRequest req, EventResponse resp, FilterChain chain) throws IOException, PortletException
+ {
+ consumedEventRequest = req;
+ consumedEventResponse = resp;
+
+ //
+ try
+ {
+ chain.doFilter(publishedEventRequest = new CustomEventRequest(req), publishedEventResponse = new CustomEventResponse(resp));
+ }
+ finally
+ {
+ consumedEventRequest = null;
+ consumedEventResponse = null;
+ publishedEventRequest = null;
+ publishedEventResponse = null;
+ }
+ }
+
+ public void doFilter(ResourceRequest req, ResourceResponse resp, FilterChain chain) throws IOException, PortletException
+ {
+ consumedResourceRequest = req;
+ consumedResourceResponse = resp;
+
+ //
+ try
+ {
+ chain.doFilter(publishedResourceRequest = new CustomResourceRequest(req), publishedResourceResponse = new CustomResourceResponse(resp));
+ }
+ finally
+ {
+ consumedResourceRequest = null;
+ consumedResourceResponse = null;
+ publishedResourceRequest = null;
+ publishedResourceResponse = null;
+ }
+ }
}
\ No newline at end of file
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletfilter/PropagateDoFilterArgsTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletfilter/PropagateDoFilterArgsTestCase.java 2008-02-03 01:56:50 UTC (rev 9718)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/portletfilter/PropagateDoFilterArgsTestCase.java 2008-02-03 02:13:01 UTC (rev 9719)
@@ -27,15 +27,25 @@
import org.jboss.portal.unit.Assertion;
import org.jboss.portal.unit.annotations.TestCase;
import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.unit.actions.PortletActionTestAction;
+import org.jboss.portal.unit.actions.PortletEventTestAction;
+import org.jboss.portal.unit.actions.PortletResourceTestAction;
import org.jboss.portal.test.portlet.framework.UTP3;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.response.EndTestResponse;
import static org.jboss.unit.api.Assert.*;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
import javax.portlet.Portlet;
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;
/**
@@ -51,12 +61,55 @@
{
protected DriverResponse run(Portlet portlet, RenderRequest req, RenderResponse resp, PortletTestContext context) throws PortletException, IOException
{
+ return new InvokeGetResponse(resp.createActionURL().toString());
+ }
+ });
+ seq.bindAction(1, UTP3.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest req, ActionResponse resp, PortletTestContext context) throws PortletException, IOException
+ {
+ assertSame(PropagateDoFilterArgsFilter1.publishedActionRequest, PropagateDoFilterArgsFilter2.consumedActionRequest);
+ assertSame(PropagateDoFilterArgsFilter1.publishedActionResponse, PropagateDoFilterArgsFilter2.consumedActionResponse);
+ assertSame(PropagateDoFilterArgsFilter2.publishedActionRequest, req);
+ assertSame(PropagateDoFilterArgsFilter2.publishedActionResponse, resp);
+
+ //
+ resp.setEvent("Event", null);
+ }
+ });
+ seq.bindAction(1, UTP3.EVENT_JOIN_POINT, new PortletEventTestAction()
+ {
+ protected void run(Portlet portlet, EventRequest req, EventResponse resp, PortletTestContext context) throws PortletException, IOException
+ {
+ assertSame(PropagateDoFilterArgsFilter1.publishedEventRequest, PropagateDoFilterArgsFilter2.consumedEventRequest);
+ assertSame(PropagateDoFilterArgsFilter1.publishedEventResponse, PropagateDoFilterArgsFilter2.consumedEventResponse);
+ assertSame(PropagateDoFilterArgsFilter2.publishedEventRequest, req);
+ assertSame(PropagateDoFilterArgsFilter2.publishedEventResponse, resp);
+ }
+ });
+ seq.bindAction(1, UTP3.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest req, RenderResponse resp, PortletTestContext context) throws PortletException, IOException
+ {
assertSame(PropagateDoFilterArgsFilter1.publishedRenderRequest, PropagateDoFilterArgsFilter2.consumedRenderRequest);
assertSame(PropagateDoFilterArgsFilter1.publishedRenderResponse, PropagateDoFilterArgsFilter2.consumedRenderResponse);
assertSame(PropagateDoFilterArgsFilter2.publishedRenderRequest, req);
assertSame(PropagateDoFilterArgsFilter2.publishedRenderResponse, resp);
//
+ return new InvokeGetResponse(resp.createResourceURL().toString());
+ }
+ });
+ seq.bindAction(2, UTP3.RESOURCE_JOIN_POINT, new PortletResourceTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, ResourceRequest req, ResourceResponse resp, PortletTestContext context) throws PortletException, IOException
+ {
+ assertSame(PropagateDoFilterArgsFilter1.publishedResourceRequest, PropagateDoFilterArgsFilter2.consumedResourceRequest);
+ assertSame(PropagateDoFilterArgsFilter1.publishedResourceResponse, PropagateDoFilterArgsFilter2.consumedResourceResponse);
+ assertSame(PropagateDoFilterArgsFilter2.publishedResourceRequest, req);
+ assertSame(PropagateDoFilterArgsFilter2.publishedResourceResponse, resp);
+
+ //
return new EndTestResponse();
}
});
Modified: modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletfilter-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletfilter-war/WEB-INF/portlet.xml 2008-02-03 01:56:50 UTC (rev 9718)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletfilter-war/WEB-INF/portlet.xml 2008-02-03 02:13:01 UTC (rev 9719)
@@ -96,13 +96,19 @@
<filter>
<filter-name>PropagateDoFilterArgsFilter1</filter-name>
<filter-class>org.jboss.portal.test.portlet.jsr286.tck.portletfilter.PropagateDoFilterArgsFilter1</filter-class>
+ <lifecycle>ACTION_PHASE</lifecycle>
+ <lifecycle>EVENT_PHASE</lifecycle>
<lifecycle>RENDER_PHASE</lifecycle>
+ <lifecycle>RESOURCE_PHASE</lifecycle>
</filter>
<filter>
<filter-name>PropagateDoFilterArgsFilter2</filter-name>
<filter-class>org.jboss.portal.test.portlet.jsr286.tck.portletfilter.PropagateDoFilterArgsFilter2</filter-class>
+ <lifecycle>ACTION_PHASE</lifecycle>
+ <lifecycle>EVENT_PHASE</lifecycle>
<lifecycle>RENDER_PHASE</lifecycle>
+ <lifecycle>RESOURCE_PHASE</lifecycle>
</filter>
<filter-mapping>
18 years, 2 months