JBoss Portal SVN: r11419 - in modules/presentation/trunk: build and 2 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-07-11 06:34:43 -0400 (Fri, 11 Jul 2008)
New Revision: 11419
Modified:
modules/presentation/trunk/ajax/pom.xml
modules/presentation/trunk/build/pom.xml
modules/presentation/trunk/classic/pom.xml
modules/presentation/trunk/portal/pom.xml
Log:
My very first contribution to the presenation framework ;)
- removing Maven warning about Sun servlet move in the repo
Modified: modules/presentation/trunk/ajax/pom.xml
===================================================================
--- modules/presentation/trunk/ajax/pom.xml 2008-07-11 09:41:13 UTC (rev 11418)
+++ modules/presentation/trunk/ajax/pom.xml 2008-07-11 10:34:43 UTC (rev 11419)
@@ -21,7 +21,7 @@
</dependency>
<dependency>
- <groupId>sun-servlet</groupId>
+ <groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
Modified: modules/presentation/trunk/build/pom.xml
===================================================================
--- modules/presentation/trunk/build/pom.xml 2008-07-11 09:41:13 UTC (rev 11418)
+++ modules/presentation/trunk/build/pom.xml 2008-07-11 10:34:43 UTC (rev 11419)
@@ -24,7 +24,7 @@
<url>http://www.jboss.com/products/jbossmc</url>
<properties>
- <version.sun.servlet>2.4</version.sun.servlet>
+ <version.javax.servlet>2.4</version.javax.servlet>
<version.apache-log4j>1.2.8</version.apache-log4j>
<version.junit>3.8.1</version.junit>
<version.httpunit>1.6</version.httpunit>
@@ -84,9 +84,9 @@
<!-- The parent pom manages the inter-dependencies of the modules. -->
<dependencies>
<dependency>
- <groupId>sun-servlet</groupId>
+ <groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <version>${version.sun.servlet}</version>
+ <version>${version.javax.servlet}</version>
</dependency>
<dependency>
Modified: modules/presentation/trunk/classic/pom.xml
===================================================================
--- modules/presentation/trunk/classic/pom.xml 2008-07-11 09:41:13 UTC (rev 11418)
+++ modules/presentation/trunk/classic/pom.xml 2008-07-11 10:34:43 UTC (rev 11419)
@@ -21,7 +21,7 @@
</dependency>
<dependency>
- <groupId>sun-servlet</groupId>
+ <groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
Modified: modules/presentation/trunk/portal/pom.xml
===================================================================
--- modules/presentation/trunk/portal/pom.xml 2008-07-11 09:41:13 UTC (rev 11418)
+++ modules/presentation/trunk/portal/pom.xml 2008-07-11 10:34:43 UTC (rev 11419)
@@ -40,7 +40,7 @@
</dependency>
<dependency>
- <groupId>sun-servlet</groupId>
+ <groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
17 years, 10 months
JBoss Portal SVN: r11418 - modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-07-11 05:41:13 -0400 (Fri, 11 Jul 2008)
New Revision: 11418
Modified:
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/Group.java
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/User.java
Log:
cleanup
Modified: modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/Group.java
===================================================================
--- modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/Group.java 2008-07-11 07:40:35 UTC (rev 11417)
+++ modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/Group.java 2008-07-11 09:41:13 UTC (rev 11418)
@@ -23,7 +23,6 @@
package org.jboss.portal.identity.api;
import java.util.Map;
-import java.util.Set;
/**
*
Modified: modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/User.java
===================================================================
--- modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/User.java 2008-07-11 07:40:35 UTC (rev 11417)
+++ modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/User.java 2008-07-11 09:41:13 UTC (rev 11418)
@@ -31,7 +31,7 @@
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public interface User //extends Identity
+public interface User
{
/**
17 years, 10 months
JBoss Portal SVN: r11417 - docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: mmcallis
Date: 2008-07-11 03:40:35 -0400 (Fri, 11 Jul 2008)
New Revision: 11417
Modified:
docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/configuration.xml
docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/installation.xml
docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/xmldescriptors.xml
Log:
changing <screen> to <programlisting>
Modified: docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/configuration.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/configuration.xml 2008-07-10 21:48:41 UTC (rev 11416)
+++ docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/configuration.xml 2008-07-11 07:40:35 UTC (rev 11417)
@@ -247,17 +247,17 @@
JBoss Portal services use a special kind of Model MBean called <emphasis>JBossServiceModelMBean</emphasis>, which allows the un-wrapping of injected dynamic proxies, and replaces them with Plain Old Java Object (POJO) services. This removes the bottleneck when using Java 5, and also provides a performance boost on JDK 1.4. By default this feature is enabled, but it is possible to disable. To do this on Linux operating systems, change into the <filename>$JBOSS_HOME/bin/</filename> directory and run the following command:
</para>
<para>
-<screen>
+<programlisting>
sh run.sh -Dportal.kernel.no_proxies=false
-</screen>
+</programlisting>
</para>
<para>
On Windows, run the following command:
</para>
<para>
-<screen>
+<programlisting>
run.bat -Dportal.kernel.no_proxies=false
-</screen>
+</programlisting>
</para>
</sect1>
</chapter>
Modified: docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/installation.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/installation.xml 2008-07-10 21:48:41 UTC (rev 11416)
+++ docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/installation.xml 2008-07-11 07:40:35 UTC (rev 11417)
@@ -119,9 +119,9 @@
Add the following line to the <filename>~/.bashrc</filename> file. Note: this must be configured while logged in as the user who runs JBoss EAP or JBoss AS:
</para>
<para>
-<screen>
+<programlisting>
export JBOSS_HOME=/path/to/jboss/installation/
-</screen>
+</programlisting>
</para>
</listitem>
<listitem>
@@ -129,9 +129,9 @@
Run the following command to enable the <filename>JBOSS_HOME</filename> environment variable:
</para>
<para>
-<screen>
+<programlisting>
source ~/.bashrc
-</screen>
+</programlisting>
</para>
</listitem>
</orderedlist>
@@ -336,9 +336,9 @@
Add the following line to the <filename>~/.bashrc</filename> file. Note: this must be configured while logged in as the user who runs JBoss EAP or JBoss AS:
</para>
<para>
-<screen>
+<programlisting>
export JBOSS_HOME=/path/to/jboss/installation/
-</screen>
+</programlisting>
</para>
</listitem>
<listitem>
@@ -346,9 +346,9 @@
Run the following command to enable the <filename>JBOSS_HOME</filename> environment variable:
</para>
<para>
-<screen>
+<programlisting>
source ~/.bashrc
-</screen>
+</programlisting>
</para>
</listitem>
</orderedlist>
@@ -368,7 +368,7 @@
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. To define a proxy server, add the following line to the <filename>$JBOSS_HOME/bin/run.conf</filename> file:
</para>
<para>
-<screen><xi:include href="extras/runconf_javaops.xmlt" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include></screen>
+<programlisting><xi:include href="extras/runconf_javaops.xmlt" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include></programlisting>
<!--JAVA_OPTS=-Dhttp.proxyHost=<<replaceable>proxy-hostname </replaceable>>-Dhttp.proxyPort=<<replaceable>proxy-port</replaceable>> -->
</para>
<para>
@@ -404,9 +404,9 @@
Change into the <filename>JBOSS_PORTAL_SOURCE_DIRECTORY/build/</filename> directory, and run the following command:
</para>
<para>
-<screen>
+<programlisting>
sh build.sh main
-</screen>
+</programlisting>
</para>
</listitem>
<listitem>
@@ -414,9 +414,9 @@
Change into the <filename>JBOSS_PORTAL_SOURCE_DIRECTORY/core/</filename> directory, and run the following command:
</para>
<para>
-<screen>
+<programlisting>
sh build.sh deploy-ha
-</screen>
+</programlisting>
</para>
<para>
After the <command>sh 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.
Modified: docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/xmldescriptors.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/xmldescriptors.xml 2008-07-10 21:48:41 UTC (rev 11416)
+++ docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/xmldescriptors.xml 2008-07-11 07:40:35 UTC (rev 11417)
@@ -161,9 +161,9 @@
</para>
</listitem>
</varlistentry>
-<varlistentry><term><screen><![CDATA[
+<varlistentry><term><programlisting><![CDATA[
<!ELEMENT transaction (trans-attribute)>]]>
-</screen></term>
+</programlisting></term>
<listitem>
<para>
The <computeroutput><transaction></computeroutput> element defines how the portlet behaves with regards to the transactional context. The <computeroutput><trans-attribute></computeroutput> element specifies the behavior of the portlet when it is invoked at runtime, with respect to the transactional context. Depending on how the portlet is invoked, a transaction may or may not exist before the portlet is invoked. The portal transaction is usually present in the local context.
@@ -172,58 +172,58 @@
The following is an example of the <computeroutput><transaction></computeroutput> and <computeroutput><trans-attribute></computeroutput> elements:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<transaction>
<trans-attribute>Required</transaction>
<transaction>]]>
-</screen>
+</programlisting>
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT trans-attribute (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
The default value is <computeroutput>NotSupported</computeroutput>, which means that the portal transaction is suspended for the duration of the portlet's invocation. Accepted values are <computeroutput>Required</computeroutput>, <computeroutput>Mandatory</computeroutput>, <computeroutput>Never</computeroutput>, <computeroutput>Supports</computeroutput>, <computeroutput>NotSupported</computeroutput>, and <computeroutput>RequiresNew</computeroutput>.
</para>
</listitem>
</varlistentry>
-<varlistentry><term><screen><![CDATA[
+<varlistentry><term><programlisting><![CDATA[
<!ELEMENT header-content (link|script|meta)*>]]>
-</screen></term>
+</programlisting></term>
<listitem>
<para>
Specify the content to be included in the portal aggregated page when the portlet is present on that page. This setting only applies when the portlet is used in the local mode.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT link EMPTY>]]>
-</screen>
+</programlisting>
</para>
<para>
No content is allowed inside a link element.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT script (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
Use the <computeroutput><script></computeroutput> element for inline script definitions.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT meta EMPTY>]]>
-</screen>
+</programlisting>
</para>
<para>
No content is allowed for the <computeroutput><meta></computeroutput> element.
</para>
</listitem>
</varlistentry>
-<varlistentry><term><screen><![CDATA[
+<varlistentry><term><programlisting><![CDATA[
<!ELEMENT service (service-name,service-class,service-ref)>]]>
-</screen></term>
+</programlisting></term>
<listitem>
<para>
Declare a service that will be injected by the portlet container as an attribute of the portlet context.
@@ -232,45 +232,45 @@
The following is an example of the <computeroutput><service></computeroutput> element:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<service>
<service-name>UserModule</service-name>
<service-class>org.jboss.portal.identity.UserModule</service-class>
<service-ref>:service=Module,type=User</service-ref>
</service>]]>
-</screen>
+</programlisting>
</para>
<para>
To use an injected service in a portlet, perform a lookup of the <computeroutput><service-name></computeroutput>, for example, using the <computeroutput>init()</computeroutput> lifecycle method:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
public void init()
{
UserModule userModule = (UserModule)getPortletContext().getAttribute("UserModule");
}]]>
-</screen>
+</programlisting>
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT service-name (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
The <computeroutput><service-name></computeroutput> element defines the name that binds the service as a portlet context attribute.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT service-class (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
The <computeroutput><service-class></computeroutput> element defines the fully qualified name of the interface that the service implements.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT service-ref (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
The <computeroutput><service-ref></computeroutput> element defines the reference to the service. In the JMX Microkernel environment, this consist of the JMX name of the service MBean. For an MBean reference, if the domain is left out, the current domain of the portal is used.
@@ -287,35 +287,35 @@
</para>
<para>
<variablelist>
- <varlistentry><term><screen><![CDATA[
+ <varlistentry><term><programlisting><![CDATA[
<!ELEMENT deployments (deployment*)>]]>
-</screen></term>
+</programlisting></term>
<listitem>
<para>
The <computeroutput><deployments></computeroutput> element is a container for <computeroutput><deployment></computeroutput> elements.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT deployment (if-exists?,instance)>]]>
-</screen>
+</programlisting>
</para>
<para>
The <computeroutput><deployment></computeroutput> element is a container for the <computeroutput><instance></computeroutput> element.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT if-exists (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
The <computeroutput><if-exists></computeroutput> element defines the action to take if an instance with the same name already exists. Accepted values are <computeroutput>overwrite</computeroutput> and <computeroutput>keep</computeroutput>. The <computeroutput>overwrite</computeroutput> option destroys the existing object, and creates a new one based on the content of the deployment. The <computeroutput>keep</computeroutput> option maintains the existing object deployment, or creates a new one if it does not exist.
</para>
</listitem>
</varlistentry>
-<varlistentry><term><screen><![CDATA[
+<varlistentry><term><programlisting><![CDATA[
<!ELEMENT instance (instance-id,portlet-ref,display-name*,preferences?,
security-constraint?, (display-name* | (resource-bundle, supported-locale+)))>]]>
-</screen></term>
+</programlisting></term>
<listitem>
<para>
The <computeroutput><instance></computeroutput> element is used in the <filename>WEB-INF/portlet-instances.xml</filename> file, which creates instances of portlets. The portlet will only be created and configured if the portlet is present, and if an instance with the same name does not already exist.
@@ -324,7 +324,7 @@
The following is an example of the <computeroutput><instance></computeroutput> element, which also contains the <computeroutput><security-constraint></computeroutput> element. Descriptions of each element follow afterwards:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<instance>
<instance-id>MyPortletInstance</instance-id>
<portlet-ref>MyPortlet</portlet-ref>
@@ -341,68 +341,68 @@
</policy-permission>
</security-constraint>
</instance>]]>
-</screen>
+</programlisting>
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT instance-id (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
The instance identifier. The <computeroutput><instance-id></computeroutput> value can be named anything, but it must match the <computeroutput><instance-ref></computeroutput>value given in the <filename>*-object.xml</filename> file.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT portlet-ref (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
The <computeroutput><portlet-ref></computeroutput> element defines the portlet that an instance represents. The <computeroutput><portlet-ref></computeroutput> value must match the <computeroutput><portlet-name></computeroutput> given in the <filename>WEB-INF/portlet.xml</filename> file.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT preferences (preference+)>]]>
-</screen>
+</programlisting>
</para>
<para>
The <computeroutput><preferences></computeroutput> element configures an instance with a set of preferences.
</para>
</listitem>
</varlistentry>
-<varlistentry><term><screen><![CDATA[
+<varlistentry><term><programlisting><![CDATA[
<!ELEMENT preference (name,value)>]]>
-</screen></term>
+</programlisting></term>
<listitem>
<para>
The <computeroutput><preference></computeroutput> element configures one preference, which is part of a set of preferences. Use the <computeroutput><preferences></computeroutput> element to define a set of preferences.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT name (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
A name.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT value (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
A string value.
</para>
</listitem>
</varlistentry>
-<varlistentry><term><screen><![CDATA[
+<varlistentry><term><programlisting><![CDATA[
<!ELEMENT security-constraint (policy-permission*)>]]>
-</screen></term>
+</programlisting></term>
<listitem>
<para>
The <computeroutput><security-constraint></computeroutput> element is a container for <computeroutput><policy-permission></computeroutput> elements. The following is an example of the <computeroutput><security-constraint></computeroutput> and <computeroutput><policy-permission></computeroutput> elements:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<security-constraint>
<policy-permission>
<role-name>User</role-name>
@@ -416,21 +416,21 @@
<action-name>view</action-name>
</policy-permission>
</security-constraint>]]>
-</screen>
+</programlisting>
</para>
</listitem>
</varlistentry>
-<varlistentry><term><screen><![CDATA[
+<varlistentry><term><programlisting><![CDATA[
<!ELEMENT policy-permission (action-name*,unchecked?,role-name*)>]]>
-</screen></term>
+</programlisting></term>
<listitem>
<para>
The <computeroutput><policy-permission></computeroutput> element secures a specific portlet instance based on a user's role.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT action-name (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
The <computeroutput><action-name></computeroutput> element defines the access rights given to the role defined. Accepted values are:
@@ -460,25 +460,25 @@
</itemizedlist>
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT unchecked EMPTY>]]>
-</screen>
+</programlisting>
</para>
<para>
If present, the <computeroutput><unchecked></computeroutput> element defines anyone can view the instance.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT role-name (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
The <computeroutput><role-name></computeroutput> element defines a role that the security constraint will apply to. The following example only allows users that are part of the <computeroutput>EXAMPLEROLE</computeroutput> role to access the instance:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<role-name>EXAMPLEROLE</role-name>]]>
-</screen>
+</programlisting>
</para>
</listitem>
</varlistentry>
@@ -492,18 +492,18 @@
</para>
<para>
<variablelist>
- <varlistentry><term><screen><![CDATA[
+ <varlistentry><term><programlisting><![CDATA[
<!ELEMENT deployments (deployment*)>]]>
-</screen></term>
+</programlisting></term>
<listitem>
<para>
The <computeroutput><deployments></computeroutput> element is a container for <computeroutput><deployment></computeroutput> elements.
</para>
</listitem>
</varlistentry>
-<varlistentry><term><screen><![CDATA[
+<varlistentry><term><programlisting><![CDATA[
<!ELEMENT deployment (parent-ref?,if-exists?,(context|portal|page|window))>]]>
-</screen></term>
+</programlisting></term>
<listitem>
<para>
The <computeroutput><deployment></computeroutput> element is a generic container for portal object elements. The <computeroutput><parent-ref></computeroutput> child element gives the name of the parent object that the current object will use as parent. The optional <computeroutput><if-exists></computeroutput> element defines the action to take if an instance with the same name already exists. The default behavior of the <computeroutput><if-exists></computeroutput> element is to keep the existing object, and not to create a new object.
@@ -512,14 +512,14 @@
The following is an example of the <computeroutput><deployment></computeroutput> and <computeroutput><parent-ref></computeroutput> elements:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<deployment>
<parent-ref>default</parent-ref>
<page>
...
</page>
</deployment>]]>
-</screen>
+</programlisting>
</para>
<para>
All portal objects have a common configuration which can include:
@@ -544,9 +544,9 @@
</itemizedlist>
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT parent-ref (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
The <computeroutput><parent-ref></computeroutput> element contains a reference to the parent object. The naming convention for naming objects is to concatenate the names of the path to the object, and separate the names using a period. If the path is empty, the empty string must be used. The <computeroutput><parent-ref></computeroutput> element tells the portal where the portlet appears. The syntax for the <computeroutput><parent-ref></computeroutput> element is <computeroutput><replaceable>portal-instance</replaceable>.<replaceable>portal-page</replaceable></computeroutput>.
@@ -555,74 +555,74 @@
The following is an example of the root having an empty path:
</para>
<para>
-<screen>
+<programlisting>
<parent-ref/>
-</screen>
+</programlisting>
</para>
<para>
The following specifies that the portlet appears in the portal instance named <computeroutput>default</computeroutput>:
</para>
<para>
-<screen>
+<programlisting>
<parent-ref>default</parent-ref>
-</screen>
+</programlisting>
</para>
<para>
The following specifies that the portlet appear in the portal instance named <computeroutput>default</computeroutput>, and on the page named <computeroutput>default</computeroutput>:
</para>
<para>
-<screen>
+<programlisting>
<parent-ref>default.default</parent-ref>
-</screen>
+</programlisting>
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT if-exists (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
The <computeroutput><if-exists></computeroutput> element defines the action to take if an instance with the same name already exists. Accepted values are <computeroutput>overwrite</computeroutput> and <computeroutput>keep</computeroutput>. The <computeroutput>overwrite</computeroutput> option destroys the existing object, and creates a new one based on the content of the deployment. The <computeroutput>keep</computeroutput> option matains the existing object deployment, or creates a new one if it does not exist.
</para>
</listitem>
</varlistentry>
-<varlistentry><term><screen><![CDATA[
+<varlistentry><term><programlisting><![CDATA[
<!ELEMENT context (context-name,properties?,listener?,security-constraint?,portal*,
(display-name* | (resource-bundle, supported-locale+)))>]]>
-</screen></term>
+</programlisting></term>
<listitem>
<para>
The context type of the portal object. A context type represent a node in a tree, which does not have a visual representation, and only exists under the root. A context can only have children that use the <emphasis>portal</emphasis> type.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT context-name (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
The context name.
</para>
</listitem>
</varlistentry>
-<varlistentry><term><screen><![CDATA[
+<varlistentry><term><programlisting><![CDATA[
<!ELEMENT portal (portal-name,supported-modes,supported-window-states?,properties?,listener?,
security-constraint?,page*, (display-name* | (resource-bundle, supported-locale+)))>]]>
-</screen></term>
+</programlisting></term>
<listitem>
<para>
A portal object that uses the <emphasis>portal</emphasis> type. A portal type represents a virtual portal, and can only have children that use the <emphasis>page</emphasis> type. In addition to the common portal object elements, it also allows you to declare modes and window states that are supported.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT portal-name (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
The portal name.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT supported-modes (mode*)>]]>
-</screen>
+</programlisting>
</para>
<para>
The <computeroutput><supported-modes></computeroutput> elements defines the supported modes of the portal. Accepted values are <computeroutput>view</computeroutput>, <computeroutput>edit</computeroutput>, and <computeroutput>help</computeroutput>.
@@ -631,73 +631,73 @@
The following is an example of the <computeroutput><supported-mode></computeroutput> and <computeroutput><mode></computeroutput> elements:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<supported-mode>
<mode>view</mode>
<mode>edit</mode>
<mode>help</mode>
</supported-mode>]]>
-</screen>
+</programlisting>
</para>
</listitem>
</varlistentry>
-<varlistentry><term><screen><![CDATA[
+<varlistentry><term><programlisting><![CDATA[
<!ELEMENT mode (#PCDATA)>]]>
-</screen></term>
+</programlisting></term>
<listitem>
<para>
The portlet mode value. If there are no declarations of modes or window states, the default values are <computeroutput>view</computeroutput>, <computeroutput>edit</computeroutput>, <computeroutput>help</computeroutput>, and <computeroutput>normal</computeroutput>, <computeroutput>minimized</computeroutput>, <computeroutput>maximized</computeroutput>, respectively.
</para>
</listitem>
</varlistentry>
-<varlistentry><term><screen><![CDATA[
+<varlistentry><term><programlisting><![CDATA[
<!ELEMENT supported-window-states (window-state*)>]]>
-</screen></term>
+</programlisting></term>
<listitem>
<para>
Use the <computeroutput><supported-window-states></computeroutput> element to define the supported window states of the portal. The following is an example of the <computeroutput><supported-window-states></computeroutput> and <computeroutput><window-state></computeroutput> elements:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<supported-window-states>
<window-state>normal</window-state>
<window-state>minimized</window-state>
<window-state>maximized</window-state>
</supported-window-states>]]>
-</screen>
+</programlisting>
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT window-state (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
Use the <computeroutput><window-state></computeroutput> element to define a window states. Accepted values are <computeroutput>normal</computeroutput>, <computeroutput>minimized</computeroutput>, and <computeroutput>maximized</computeroutput>.
</para>
</listitem>
</varlistentry>
-<varlistentry><term><screen><![CDATA[
+<varlistentry><term><programlisting><![CDATA[
<!ELEMENT page (page-name,properties?,listener?,security-constraint?,(page | window)*,
(display-name* | (resource-bundle, supported-locale+)))>]]>
-</screen></term>
+</programlisting></term>
<listitem>
<para>
A portal object that uses the <emphasis>page</emphasis> type. A page type represents a page, and can only have children that use the <emphasis>page</emphasis> and <emphasis>window</emphasis> types. The children windows are the windows of the page, and the children pages are the subpages of the page.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT page-name (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
The page name.
</para>
</listitem>
</varlistentry>
-<varlistentry><term><screen><![CDATA[
+<varlistentry><term><programlisting><![CDATA[
<!ELEMENT window (window-name,(instance-ref|content),region,height,initial-window-state?,
initial-mode?,properties?,listener?, (display-name* | (resource-bundle, supported-locale+)))>]]>
-</screen></term>
+</programlisting></term>
<listitem>
<para>
A portal object that uses the <emphasis>window</emphasis> type. A window type represents a window. Besides the common properties, a window has content, and belongs to a region on the page.
@@ -706,61 +706,61 @@
The <computeroutput><instance-ref></computeroutput> and <computeroutput><content></computeroutput> elements, configured in the <filename>WEB-INF/*-object.xml</filename> files, define the content of a window. The <computeroutput><content></computeroutput> element is generic, and describes any kind of content. The <computeroutput><instance-ref></computeroutput> element is a shortcut to define the content-type of the portlet, which points to a portlet instance. The value of <computeroutput><instance-ref></computeroutput> must match the value of one of the <computeroutput><instance-id></computeroutput> elements in the <filename>WEB-INF/portlet-instances.xml</filename> file.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT window-name (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
The window name value.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT instance-ref (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
Define the content of the window as a reference to a portlet instance. This value is the ID of a portlet instance, and must much the value of one of the <computeroutput><instance-id></computeroutput> elements in the <filename>WEB-INF/portlet-instances.xml</filename> file. The following is an example of the <computeroutput><instance-ref></computeroutput> element:
</para>
<para>
-<screen>
+<programlisting>
<instance-ref>MyPortletInstance</instance-ref>
-</screen>
+</programlisting>
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT region (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
The region the window belongs to. The <computeroutput><region></computeroutput> element specifies where the window appears on the page.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT height (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
The height of the window in a particular region.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT listener (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
Define a listener for a portal object. This value is the ID of the listener.
</para>
</listitem>
</varlistentry>
-<varlistentry><term><screen><![CDATA[
+<varlistentry><term><programlisting><![CDATA[
<!ELEMENT content (content-type,content-uri)>]]>
-</screen></term>
+</programlisting></term>
<listitem>
<para>
Define the content of a window in a generic manner. The content is defined by the type of content, and a URI, which acts as an identifier for the content. The following is an example of the <computeroutput><content></computeroutput> element, which is configured in the <filename>WEB-INF/*-object.xml</filename> files:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<content>
<content-type>portlet</content-type>
<content-uri>MyPortletInstance</content-uri>
@@ -770,70 +770,70 @@
<content-type>cms</content-type>
<content-uri>/default/index.html</content-uri>
</content>]]>
-</screen>
+</programlisting>
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT content-type (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
The content type of the window. The <computeroutput><content-type></computeroutput> element specifies the content to display, for example, a <computeroutput>portlet</computeroutput>.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT content-uri (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
The content URI of the window. The <computeroutput><content-uri></computeroutput> element specifies which content to display, for example, a portlet instance. To display a file from the CMS, use the <computeroutput><content-uri></computeroutput> element to define the full path to that file in the CMS.
</para>
</listitem>
</varlistentry>
-<varlistentry><term><screen><![CDATA[
+<varlistentry><term><programlisting><![CDATA[
<!ELEMENT properties (property*)>]]>
-</screen></term>
+</programlisting></term>
<listitem>
<para>
A set of generic properties for the portal object. The <computeroutput><properties></computeroutput> elements contains definitions specific to a page. This is commonly used to define the specific theme and layout to use. If not defined, the default portal theme and layout are used.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT property (name,value)>]]>
-</screen>
+</programlisting>
</para>
<para>
A generic string property.
</para>
</listitem>
</varlistentry>
-<varlistentry><term><screen><![CDATA[
+<varlistentry><term><programlisting><![CDATA[
<!ELEMENT name (#PCDATA)>]]>
-</screen></term>
+</programlisting></term>
<listitem>
<para>
A name value.
</para>
</listitem>
</varlistentry>
-<varlistentry><term><screen><![CDATA[
+<varlistentry><term><programlisting><![CDATA[
<!ELEMENT value (#PCDATA)>]]>
-</screen></term>
+</programlisting></term>
<listitem>
<para>
A value.
</para>
</listitem>
</varlistentry>
-<varlistentry><term><screen><![CDATA[
+<varlistentry><term><programlisting><![CDATA[
<!ELEMENT security-constraint (policy-permission*)>]]>
-</screen></term>
+</programlisting></term>
<listitem>
<para>
The <computeroutput><security-constraint></computeroutput> element is a container for <computeroutput><policy-permission></computeroutput> elements. The following is an example of the <computeroutput><security-constraint></computeroutput> and <computeroutput><policy-permission></computeroutput> elements:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<security-constraint>
<policy-permission>
<role-name>User</role-name>
@@ -847,21 +847,21 @@
<action-name>view</action-name>
</policy-permission>
</security-constraint>]]>
-</screen>
+</programlisting>
</para>
</listitem>
</varlistentry>
-<varlistentry><term><screen><![CDATA[
+<varlistentry><term><programlisting><![CDATA[
<!ELEMENT policy-permission (action-name*,unchecked?,role-name*)>]]>
-</screen></term>
+</programlisting></term>
<listitem>
<para>
The <computeroutput><policy-permission></computeroutput> element is secures a specific portlet instance based on a user's role.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT action-name (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
The <computeroutput><action-name></computeroutput> element defines the access rights given to the role defined. Accepted values are:
@@ -891,25 +891,25 @@
</itemizedlist>
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT unchecked EMPTY>]]>
-</screen>
+</programlisting>
</para>
<para>
If present, the <computeroutput><unchecked></computeroutput> element defines that anyone can view the instance.
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT role-name (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
The <computeroutput><role-name></computeroutput> element defines a role that the security constraint applies to. The following example only allows users that are part of the <computeroutput>EXAMPLEROLE</computeroutput> role to access the instance:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<role-name>EXAMPLEROLE</role-name>]]>
-</screen>
+</programlisting>
</para>
</listitem>
</varlistentry>
@@ -923,21 +923,21 @@
</para>
<para>
<variablelist>
- <varlistentry><term><screen><![CDATA[
+ <varlistentry><term><programlisting><![CDATA[
<Element <![CDATA[<!ELEMENT jboss-app (app-name?)>]]>
-</screen></term>
+</programlisting></term>
<listitem>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!DOCTYPE jboss-app PUBLIC
"-//JBoss Portal//DTD JBoss Web Application 2.6//EN"
"http://www.jboss.org/portal/dtd/jboss-app_2_6.dtd">]]>
-</screen>
+</programlisting>
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!ELEMENT app-name (#PCDATA)>]]>
-</screen>
+</programlisting>
</para>
<para>
When a web application is deployed, the context path under which it is deployed
@@ -1075,7 +1075,7 @@
The <filename>portlet-instances.xml</filename> descriptor is JBoss Portal specific, and allows developers to instantiate one-or-many instances of one-or-many portlets. The benefit of this allows one portlet to be instantiated several times, with different preference parameters. The following example instantiates two separate instances of the <computeroutput>NewsPortlet</computeroutput>, both using different parameters. One instance draws feeds from Red Hat announcements, and the other from McDonalds announcements:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE deployments PUBLIC
"-//JBoss Portal//DTD Portlet Instances 2.6//EN"
@@ -1126,7 +1126,7 @@
</instance>
</deployment>
</deployments>
-]]></screen>
+]]></programlisting>
</para>
<para>
<itemizedlist>
@@ -1176,7 +1176,7 @@
The <computeroutput><preference></computeroutput> element configures a preference as a key-value pair. This value can be composed of a single string value, for example, the preference <emphasis>fruit</emphasis> can have the <emphasis>apple</emphasis> value. As well, this value can be composed of multiple strings, for example, the preference <emphasis>fruits</emphasis> can have values of <emphasis>apple</emphasis>, <emphasis>orange</emphasis>, and <emphasis>kiwi</emphasis>:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<preferences>
<preference>
<name>fruits</name>
@@ -1185,7 +1185,7 @@
<value>kiwi</value>
</preference>
</preferences>
-]]></screen>
+]]></programlisting>
</para>
<para>
The <computeroutput><preference></computeroutput> element configures one preference, which is part of a set of preferences. Use the <computeroutput><preferences></computeroutput> element to define a set of preferences.
@@ -1193,12 +1193,12 @@
</listitem>
<listitem>
<para>
-<screen><![CDATA[<security-constraint>
+<programlisting><![CDATA[<security-constraint>
<policy-permission>
<action-name>viewrecursive</action-name>
<unchecked/>
</policy-permission>
-</security-constraint>]]></screen>
+</security-constraint>]]></programlisting>
</para>
<para>
The <computeroutput><security-constraint></computeroutput> element is a container for <computeroutput><policy-permission></computeroutput> elements. This example demonstrates the <computeroutput><security-constraint></computeroutput> and <computeroutput><policy-permission></computeroutput> elements.
@@ -1279,7 +1279,7 @@
The following example injects a specific style sheet, <computeroutput>/images/management/management.css</computeroutput>, allowing the portlet to leverage a specific style:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE portlet-app PUBLIC
"-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
@@ -1293,7 +1293,7 @@
</header-content>
</portlet>
</portlet-app>]]>
-</screen>
+</programlisting>
</para>
<para>
Use the <computeroutput><header-content></computeroutput> and <computeroutput><link></computeroutput> elements to specify a style sheet.
@@ -1305,7 +1305,7 @@
The following example injects the <computeroutput>UserModule</computeroutput> service as an attribute to the portlet context:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE portlet-app PUBLIC
"-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
@@ -1317,17 +1317,17 @@
<service-ref>:service=Module,type=User</service-ref>
</service>
</portlet-app>]]>
-</screen>
+</programlisting>
</para>
<para>
This allows the portlet to leverage the service, for example:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
UserModule userModule = (UserModule) getPortletContext().getAttribute("UserModule");
String userId = request.getParameters().getParameter("userid");
User user = userModule.findUserById(userId);]]>
-</screen>
+</programlisting>
</para>
</sect3>
<sect3>
@@ -1336,7 +1336,7 @@
As of JBoss Portal 2.6.3, icons can be defined for a portlet by using the <computeroutput><icon></computeroutput>, <computeroutput><small-icon></computeroutput>, and <computeroutput><large-icon></computeroutput> elements:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE portlet-app PUBLIC
"-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
@@ -1352,7 +1352,7 @@
</portlet-info>
</portlet>
</portlet-app>]]>
-</screen>
+</programlisting>
</para>
<para>
References to icons can be absolute, for example, <emphasis>http://www.example.com/images/smallIcon.png</emphasis>, or relative to the web application context, for example, <computeroutput>/images/smallIcon.png</computeroutput>. Icons can be used by different parts of the portlet user interface.
@@ -1379,7 +1379,7 @@
The <filename>portlet.xml</filename> descriptor is the standard portlet descriptor covered by the <ulink url="http://www.jcp.org/en/jsr/detail?id=168">JSR-168 Portlet Specification</ulink>. Developers are strongly encouraged to read the <ulink url="http://www.jcp.org/en/jsr/detail?id=168">JSR-168 Portlet Specification</ulink> items covering the correct use of this descriptor, as it is only covered briefly in these sections. Normally the <filename>portlet.xml</filename> descriptor is packaged inside your portlet WAR file, alongside the other descriptors in these sections. The following example is a modified version of the JBoss Portal UserPortlet definition:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<portlet-app
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
@@ -1410,7 +1410,7 @@
</portlet-info>
</portlet>
</portlet-app>]]>
-</screen>
+</programlisting>
</para>
<para>
<itemizedlist>
@@ -1587,11 +1587,11 @@
Note: if the JBoss Portal source was not built as per step 3, the <command>sh build.sh datasource</command> and <command>build.bat datasource</command> commands fail with an error, such as the following:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
BUILD FAILED
java.io.FileNotFoundException: /jboss-portal-2.6.3.GA-src/core/../thirdparty/libraries.ent
(No such file or directory)]]>
-</screen>
+</programlisting>
</para>
<para>
The datasource build process produces the following directory and file structure, with the Datasource descriptors in the <filename>JBOSS_PORTAL_SOURCE_DIRECTORY/core/output/resources/setup</filename> directory:
@@ -1607,7 +1607,7 @@
The following is an example Datasource descriptor for a PostgreSQL database:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
@@ -1618,7 +1618,7 @@
<password>portalpassword</password>
</local-tx-datasource>
</datasources>]]>
-</screen>
+</programlisting>
</para>
<para>
Make sure the <computeroutput>user-name</computeroutput>, <computeroutput>password</computeroutput>, <computeroutput>connection-url</computeroutput>, and <computeroutput>driver-class</computeroutput>, are correct for your chosen database.
@@ -1631,7 +1631,7 @@
By default, JBoss Portal is configured to display all errors. This behavior can be configured by modifying the <filename>jboss-portal.sar/conf/config.xml</filename> file:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!-- When a window has restrictedaccess : show or hide values are permitted -->
<entry key="core.render.window_access_denied">show</entry>
<!-- When a window is unavailable : show or hide values are permitted -->
@@ -1642,7 +1642,7 @@
<entry key="core.render.window_internal_error">show</entry>
<!-- When a window is not found : show or hide values are permitted -->
<entry key="core.render.window_not_found">show</entry>]]>
-</screen>
+</programlisting>
</para>
<para>
For these parameters, accepted values are <computeroutput>show</computeroutput> and <computeroutput>hide</computeroutput>. Depending on the setting, and the actual error, either an error message is displayed, or a full stack trace within the portlet window occurs. Additionally, the <computeroutput>core.render.window_error</computeroutput> property supports the <computeroutput>message_only</computeroutput> value. The <computeroutput>message_only</computeroutput> value will only display an error message, whereas the <computeroutput>show</computeroutput> value will, if available, display the full stack trace.
@@ -1655,11 +1655,11 @@
forward a user to their Dashboard, set the <computeroutput>core.login.namespace</computeroutput> value to <computeroutput>dashboard</computeroutput> in the <filename>jboss-portal.sar/conf/config.xml</filename> file:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<!-- Namespace to use when logging-in, use "dashboard" to directly
log-in the dashboard otherwise use "default" -->
<entry key="core.login.namespace">dashboard</entry>
-]]></screen>
+]]></programlisting>
</para>
</sect2>
</sect1>
@@ -1698,7 +1698,7 @@
The HelloWorldPortalPage portlet is hot-deployable, so the JBoss EAP or JBoss AS server does not have to be restarted after deploying the HelloWorldPortalPage portlet. The following is an example of the <filename>HelloWorldPortalPage/WEB-INF/helloworld-object.xml</filename> descriptor:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE deployments PUBLIC
"-//JBoss Portal//DTD Portal Object 2.6//EN"
@@ -1725,7 +1725,7 @@
</page>
</deployment>
</deployments>]]>
-</screen>
+</programlisting>
</para>
<para>
A depoloyment is composed of a <computeroutput><deployments></computeroutput> element, which is a container for <computeroutput><deployment></computeroutput> elements. In the previous example, a page is defined, the portlet is placed as a window on a page, and an instance of the portlet is created. The Mangement portlet (bundled with JBoss Portal) can modify portal instances, page position, and so on.
@@ -1736,98 +1736,98 @@
<para>
<itemizedlist>
<listitem>
-<screen>
+<programlisting>
<if-exists>
-</screen>
+</programlisting>
<para>
The <computeroutput><if-exists></computeroutput> element defines the action to take if an instance with the same name already exists. Accepted values are <computeroutput>overwrite</computeroutput> and <computeroutput>keep</computeroutput>. The <computeroutput>overwrite</computeroutput> option destroys the existing object, and creates a new one based on the content of the deployment. The <computeroutput>keep</computeroutput> option matains the existing object deployment, or creates a new one if it does not exist.
</para>
</listitem>
<listitem>
-<screen>
+<programlisting>
<parent-ref>
-</screen>
+</programlisting>
<para>
The <computeroutput><parent-ref></computeroutput> element contains a reference to the parent object. The naming convention for naming objects is to concatenate the names of the path to the object, and separate the names using a period. If the path is empty, the empty string must be used. The <computeroutput><parent-ref></computeroutput> element tells the portal where the portlet appears. The syntax for the <computeroutput><parent-ref></computeroutput> element is <computeroutput><replaceable>portal-instance</replaceable>.<replaceable>portal-page</replaceable></computeroutput>.
</para>
</listitem>
<listitem>
-<screen>
+<programlisting>
<properties>
-</screen>
+</programlisting>
<para>
A set of generic properties for the portal object. The <computeroutput><properties></computeroutput> elements contains definitions specific to a page. This is commonly used to define the specific theme and layout to use. If not defined, the default portal theme and layout are used.
</para>
</listitem>
<listitem>
-<screen>
+<programlisting>
<page>
-</screen>
+</programlisting>
<para>
The start of a page definition. Among others, the <computeroutput><page></computeroutput> element is a container for the <computeroutput><page-name></computeroutput>, <computeroutput><window></computeroutput>, and <computeroutput><security-constraint></computeroutput> elements.
</para>
</listitem>
<listitem>
-<screen>
+<programlisting>
<page-name>
-</screen>
+</programlisting>
<para>
The page name.
</para>
</listitem>
<listitem>
-<screen>
+<programlisting>
<window>
-</screen>
+</programlisting>
<para>
The <computeroutput><window></computeroutput> element defines a portlet window. The <computeroutput><window></computeroutput> element requires an <computeroutput><instance-ref></computeroutput> element, which assigns a portal instance to a window.
</para>
</listitem>
<listitem>
-<screen>
+<programlisting>
<window-name>
-</screen>
+</programlisting>
<para>
The <computeroutput><window-name></computeroutput> element defines the <emphasis role="bold">unique name</emphasis> given to a portlet window. This can be named anything.
</para>
</listitem>
<listitem>
-<screen>
+<programlisting>
<instance-ref>
-</screen>
+</programlisting>
<para>
The <computeroutput><instance-ref></computeroutput> elements define the portlet instances that windows represent. This value is the ID of a portlet instance, and must match the value of one of the <computeroutput><instance-id></computeroutput> elements in the <filename>WEB-INF/portlet-instances.xml</filename> file.
</para>
</listitem>
<listitem>
-<screen>
+<programlisting>
<region>...</region>
<height>...</height>
-</screen>
+</programlisting>
<para>
The <computeroutput><region></computeroutput> and <computeroutput><height></computeroutput> elements define where the window appears within the page layout. The <computeroutput><region></computeroutput> element specifies where the window appears on the page. The <computeroutput><region></computeroutput> element often depends on other regions defined in the portal layout. The <computeroutput><height></computeroutput> element can be assigned a value between one and <replaceable>X</replaceable>.
</para>
</listitem>
<listitem>
-<screen>
+<programlisting>
<instance>
-</screen>
+</programlisting>
<para>
The <computeroutput><instance></computeroutput> element creates instances of portlets. The portlet will only be created and configured if the portlet is present, and if an instance with the same name does not already exist.
</para>
</listitem>
<listitem>
-<screen>
+<programlisting>
<instance-name>
-</screen>
+</programlisting>
<para>
The <computeroutput><instance-name></computeroutput> element maps to the <computeroutput><instance-ref></computeroutput> element.
</para>
</listitem>
<listitem>
-<screen>
+<programlisting>
<component-ref>
-</screen>
+</programlisting>
<para>
The <computeroutput><component-ref></computeroutput> element takes the name of the application, followed by the name of the portlet, as defined in the <filename>WEB-INF/portlet.xml</filename> file.
</para>
@@ -1838,7 +1838,7 @@
The <computeroutput><security-constraint></computeroutput> element is a container for <computeroutput><policy-permission></computeroutput> elements. The following is an example of the <computeroutput><security-constraint></computeroutput> and <computeroutput><policy-permission></computeroutput> elements:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<security-constraint>
<policy-permission>
<role-name>User</role-name>
@@ -1852,12 +1852,12 @@
<action-name>view</action-name>
</policy-permission>
</security-constraint>]]>
-</screen>
+</programlisting>
</para>
<para>
-<screen>
+<programlisting>
<action-name>
-</screen>
+</programlisting>
</para>
<para>
The <computeroutput><action-name></computeroutput> element defines the access rights given to the role defined. Accepted values are:
@@ -1887,25 +1887,25 @@
</itemizedlist>
</para>
<para>
-<screen>
+<programlisting>
<unchecked/>
-</screen>
+</programlisting>
</para>
<para>
If present, the <computeroutput><unchecked></computeroutput> element defines that anyone can view the instance.
</para>
<para>
-<screen>
+<programlisting>
<role-name>
-</screen>
+</programlisting>
</para>
<para>
The <computeroutput><role-name></computeroutput> element defines a role that the security constraint will apply to. The following example only allows users that are part of the <computeroutput>EXAMPLEROLE</computeroutput> role to access the instance:
</para>
<para>
-<screen>
+<programlisting>
<role-name>EXAMPLEROLE</role-name>
-</screen>
+</programlisting>
</para>
</sect2>
<sect2 id="desc_example_portal">
@@ -1941,7 +1941,7 @@
The HelloWorldPortal portlet is hot-deployable, so the JBoss EAP or JBoss AS server does not have to be restarted after deploying the HelloWorldPortal portlet. The following is an example of the <filename>HelloWorldPortal/WEB-INF/helloworld-object.xml</filename> descriptor:
</para>
<para>
-<screen><![CDATA[
+<programlisting><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE deployments PUBLIC
"-//JBoss Portal//DTD Portal Object 2.6//EN"
@@ -2025,7 +2025,7 @@
</page>
</deployment>
</deployments>]]>
-</screen>
+</programlisting>
</para>
<para>
When deployed, this example registers a new portal instance, <computeroutput>HelloPortal</computeroutput>, that contains two pages. To view the default page in the <computeroutput>HelloPortal</computeroutput> instance, navigate to <ulink url="http://localhost:8080/portal/portal/HelloPortal" />, and for the second page, <ulink url="http://localhost:8080/portal/portal/HelloPortal/foobar" />.
17 years, 10 months
JBoss Portal SVN: r11416 - in branches/JBoss_Portal_Branch_2_7/wsrp: src/main/org/jboss/portal/test/wsrp/framework/support and 8 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-07-10 17:48:41 -0400 (Thu, 10 Jul 2008)
New Revision: 11416
Added:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/other/AbsoluteURLReplacementGeneratorTestCase.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/ResourceNoEncodeURLPortlet.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/
branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/
branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/jboss-portlet.xml
branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/portlet.xml
branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/web.xml
branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/gif/
branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/gif/logo.gif
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/build.xml
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpServletRequest.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/AbsoluteURLReplacementGenerator.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPPortletInvocationContext.java
Log:
- JBPORTAL-2067: Fixed several issues, added more tests.
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/build.xml 2008-07-10 21:48:11 UTC (rev 11415)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/build.xml 2008-07-10 21:48:41 UTC (rev 11416)
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?><!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ JBoss, a division of Red Hat ~
~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
~ contributors as indicated by the @authors tag. See the ~
@@ -609,6 +610,9 @@
<!-- Resource test portlet -->
<package-test-portlet archiveName="resource" portletName="Resource"/>
+ <!-- Non URL Encoded Resource test portlet -->
+ <package-test-portlet archiveName="resourcenoencodeurl" portletName="ResourceNoEncodeURL"/>
+
<!-- Multipart test portlet -->
<!--<package-test-portlet archiveName="multipart" portletName="Multipart"/>-->
@@ -861,6 +865,8 @@
<execute-tests>
<x-test>
<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.other.WSRPPortletURLTestCase"/>
+ <test todir="${test.reports}"
+ name="org.jboss.portal.test.wsrp.other.AbsoluteURLReplacementGeneratorTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.other.UserContextConverterTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.wsrp.other.RegistrationPropertyDescriptionTestCase"/>
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpServletRequest.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpServletRequest.java 2008-07-10 21:48:11 UTC (rev 11415)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpServletRequest.java 2008-07-10 21:48:41 UTC (rev 11416)
@@ -41,6 +41,9 @@
private HttpSession session;
private Map attrs;
+ public static String scheme = "http";
+ public static String serverName = "test";
+ public static Integer serverPort = 1234;
public MockHttpServletRequest(HttpSession session)
{
@@ -89,7 +92,20 @@
{
String name = (String)args[0];
attrs.remove(name);
+ return null;
}
+ if ("getScheme".equals(methodName))
+ {
+ return scheme;
+ }
+ if ("getServerName".equals(methodName))
+ {
+ return serverName;
+ }
+ if ("getServerPort".equals(methodName))
+ {
+ return serverPort;
+ }
throw new UnsupportedOperationException("MockHttpServletRequest does not support: " + method);
}
}
Added: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/other/AbsoluteURLReplacementGeneratorTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/other/AbsoluteURLReplacementGeneratorTestCase.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/other/AbsoluteURLReplacementGeneratorTestCase.java 2008-07-10 21:48:41 UTC (rev 11416)
@@ -0,0 +1,71 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.wsrp.other;
+
+import junit.framework.TestCase;
+import org.jboss.portal.test.wsrp.framework.support.MockHttpServletRequest;
+import static org.jboss.portal.test.wsrp.framework.support.MockHttpServletRequest.*;
+import org.jboss.portal.wsrp.producer.AbsoluteURLReplacementGenerator;
+import static org.jboss.portal.wsrp.producer.AbsoluteURLReplacementGenerator.PORT_END;
+import static org.jboss.portal.wsrp.producer.AbsoluteURLReplacementGenerator.SCH_END;
+
+import javax.servlet.http.HttpServletRequest;
+import java.lang.reflect.Proxy;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class AbsoluteURLReplacementGeneratorTestCase extends TestCase
+{
+ private AbsoluteURLReplacementGenerator gen;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ MockHttpServletRequest mockRequest = new MockHttpServletRequest(null);
+ HttpServletRequest request = (HttpServletRequest)Proxy.newProxyInstance(getClass().getClassLoader(),
+ new Class[]{HttpServletRequest.class}, mockRequest);
+ gen = new AbsoluteURLReplacementGenerator(request);
+ }
+
+ public void testNonAbsoluteURL()
+ {
+ String url = "foo";
+ assertEquals(url, gen.getAbsoluteURLFor(url));
+ }
+
+ public void testAbsoluteURL()
+ {
+ String url = "/foo";
+ assertEquals(scheme + SCH_END + serverName + PORT_END + serverPort + url, gen.getAbsoluteURLFor(url));
+ }
+
+ public void testWSRPEncodedURL()
+ {
+ String url = "wsrp_rewrite?wsrp-urlType=blockingAction&wsrp-interactionState=JBPNS_/wsrp_rewrite";
+ assertEquals(url, gen.getAbsoluteURLFor(url));
+ }
+}
Added: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/ResourceNoEncodeURLPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/ResourceNoEncodeURLPortlet.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/ResourceNoEncodeURLPortlet.java 2008-07-10 21:48:41 UTC (rev 11416)
@@ -0,0 +1,44 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.wsrp.portlet;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class ResourceNoEncodeURLPortlet extends GenericPortlet
+{
+ protected void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException
+ {
+ response.setContentType("text/html");
+ Writer writer = response.getWriter();
+ writer.write("<img src='" + request.getContextPath() + "/gif/logo.gif'/>");
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java 2008-07-10 21:48:11 UTC (rev 11415)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java 2008-07-10 21:48:41 UTC (rev 11416)
@@ -60,7 +60,7 @@
private static final String DEFAULT_MARKUP_PORTLET_WAR = "test-markup-portlet.war";
public MarkupTestCase()
- throws Exception
+ throws Exception
{
super("MarkupTestCase", DEFAULT_MARKUP_PORTLET_WAR);
}
@@ -115,8 +115,8 @@
MarkupResponse response = markupService.getMarkup(getMarkup);
checkMarkupResponse(response, "<form method='post' action='wsrp_rewrite?wsrp-urlType=blockingAction&wsrp" +
- "-interactionState=JBPNS_/wsrp_rewrite' id='wsrp_rewrite_portfolioManager'><table><tr><td>Stock symbol</t" +
- "d><td><input name='symbol'/></td></tr><tr><td><input type='submit' value='Submit'></td></tr></table></form>");
+ "-interactionState=JBPNS_/wsrp_rewrite' id='wsrp_rewrite_portfolioManager'><table><tr><td>Stock symbol</t" +
+ "d><td><input name='symbol'/></td></tr><tr><td><input type='submit' value='Submit'></td></tr></table></form>");
}
public void testGetMarkupRenderParameters() throws Exception
@@ -154,7 +154,7 @@
// let's see now if we can increment the counter
PerformBlockingInteraction performBlockingInteraction =
- WSRPTypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
+ WSRPTypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
InteractionParams interactionParams = performBlockingInteraction.getInteractionParams();
interactionParams.setInteractionState(incrementAction.getInteractionState().getStringValue());
markupService.performBlockingInteraction(performBlockingInteraction);
@@ -222,7 +222,7 @@
public void testPerformBlockingInteractionRedirect() throws Exception
{
PerformBlockingInteraction performBlockingInteraction =
- WSRPTypeFactory.createDefaultPerformBlockingInteraction(getDefaultHandle());
+ WSRPTypeFactory.createDefaultPerformBlockingInteraction(getDefaultHandle());
InteractionParams interactionParams = performBlockingInteraction.getInteractionParams();
NamedString[] formParams = {new NamedString("symbol", "HELP")}; // crappy way but this is a test! ;)
interactionParams.setFormParameters(formParams);
@@ -436,7 +436,7 @@
MarkupResponse response = markupService.getMarkup(getMarkup);
checkMarkupResponse(response, "wsrp_rewrite?wsrp-urlType=blockingAction&wsrp-interactionState=JBPNS_/wsrp_rewrite\n" +
- "wsrp_rewrite?wsrp-urlType=render&wsrp-navigationalState=JBPNS_/wsrp_rewrite");
+ "wsrp_rewrite?wsrp-urlType=render&wsrp-navigationalState=JBPNS_/wsrp_rewrite");
}
finally
{
@@ -473,7 +473,7 @@
try
{
PerformBlockingInteraction action =
- WSRPTypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
+ WSRPTypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
action.getInteractionParams().setFormParameters(new NamedString[]{new NamedString("multi", "value1")});
BlockingInteractionResponse actionResponse = markupService.performBlockingInteraction(action);
GetMarkup markupRequest = createMarkupRequestForCurrentlyDeployedPortlet();
@@ -482,7 +482,7 @@
checkMarkupResponse(response, "multi: value1");
action.getInteractionParams().setFormParameters(new NamedString[]{
- new NamedString("multi", "value1"), new NamedString("multi", "value2")});
+ new NamedString("multi", "value1"), new NamedString("multi", "value2")});
actionResponse = markupService.performBlockingInteraction(action);
markupRequest = createMarkupRequestForCurrentlyDeployedPortlet();
markupRequest.getMarkupParams().setNavigationalState(actionResponse.getUpdateResponse().getNavigationalState());
@@ -571,6 +571,32 @@
}
}
+ public void testGetMarkupWithNonURLEncodedResource() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String archive = "test-resourcenoencodeurl-portlet.war";
+ deploy(archive);
+
+ try
+ {
+ GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet();
+ MarkupResponse res = markupService.getMarkup(gm);
+ String markupString = res.getMarkupContext().getMarkupString();
+
+ // accept either localhost or 127.0.0.1 for the host part of the generated markup
+ String markupStart = "<img src='http://";
+ String markupEnd = ":8080/test-resourcenoencodeurl-portlet/gif/logo.gif'/>";
+ String localhostMarkup = markupStart + "localhost" + markupEnd;
+ String homeIPMarkup = markupStart + "127.0.0.1" + markupEnd;
+ boolean result = localhostMarkup.equals(markupString) || homeIPMarkup.equals(markupString);
+ ExtendedAssert.assertTrue(result);
+ }
+ finally
+ {
+ undeploy(archive);
+ }
+ }
+
public void testApplicationScopeVariableHandling() throws Exception
{
undeploy(DEFAULT_MARKUP_PORTLET_WAR);
@@ -598,7 +624,7 @@
private String checkPBIAndGetNavigationalState(String symbol) throws Exception
{
PerformBlockingInteraction performBlockingInteraction =
- WSRPTypeFactory.createDefaultPerformBlockingInteraction(getDefaultHandle());
+ WSRPTypeFactory.createDefaultPerformBlockingInteraction(getDefaultHandle());
InteractionParams interactionParams = performBlockingInteraction.getInteractionParams();
NamedString[] formParams = {new NamedString("symbol", symbol)};
interactionParams.setFormParameters(formParams);
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/AbsoluteURLReplacementGenerator.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/AbsoluteURLReplacementGenerator.java 2008-07-10 21:48:11 UTC (rev 11415)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/AbsoluteURLReplacementGenerator.java 2008-07-10 21:48:41 UTC (rev 11416)
@@ -23,6 +23,7 @@
package org.jboss.portal.wsrp.producer;
import org.jboss.portal.common.net.URLTools;
+import org.jboss.portal.wsrp.WSRPRewritingConstants;
import javax.servlet.http.HttpServletRequest;
@@ -33,8 +34,9 @@
public class AbsoluteURLReplacementGenerator extends URLTools.URLReplacementGenerator
{
private String serverAddress;
- static final String SCH_END = "://";
- static final String PORT_END = ":";
+ public static final String SCH_END = "://";
+ public static final String PORT_END = ":";
+ public static final String SLASH = "/";
public AbsoluteURLReplacementGenerator(HttpServletRequest request)
{
@@ -50,13 +52,32 @@
return getAbsoluteURLFor(urlMatch.getURLAsString());
}
+ /**
+ * todo: public only for tests
+ *
+ * @param url
+ * @return
+ */
public String getAbsoluteURLFor(String url)
{
- if (!URLTools.isNetworkURL(url))
+ return getAbsoluteURLFor(url, true);
+ }
+
+ String getAbsoluteURLFor(String url, boolean checkWSRPToken)
+ {
+ // We don't encode URL through this API when it is a wsrp URL
+ if (checkWSRPToken && url.startsWith(WSRPRewritingConstants.BEGIN_WSRP_REWRITE))
{
+ return url;
+ }
+
+ if (!URLTools.isNetworkURL(url) && url.startsWith(SLASH))
+ {
return serverAddress + url;
}
-
- return url;
+ else
+ {
+ return url;
+ }
}
}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPPortletInvocationContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPPortletInvocationContext.java 2008-07-10 21:48:11 UTC (rev 11415)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPPortletInvocationContext.java 2008-07-10 21:48:41 UTC (rev 11416)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.wsrp.producer;
+import org.jboss.portal.common.NotYetImplemented;
import org.jboss.portal.common.net.URLTools;
import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.portlet.ContainerURL;
@@ -95,33 +96,25 @@
/** Override the default behavior in order to avoid to encode when it is producer written URL. */
public String encodeResourceURL(String url)
{
- if (url != null)
+ if (url != null && !url.startsWith(WSRPRewritingConstants.BEGIN_WSRP_REWRITE))
{
- if (url.startsWith(WSRPRewritingConstants.BEGIN_WSRP_REWRITE))
- {
- // We don't encode URL through this API when it is a wsrp URL
- return url;
- }
- else
- {
- // make root relative URLs absolute
- url = new AbsoluteURLReplacementGenerator(getClientRequest()).getAbsoluteURLFor(url);
+ // make root relative URLs absolute. Optimization: we don't recheck the precense of the WSRP token.
+ url = new AbsoluteURLReplacementGenerator(getClientRequest()).getAbsoluteURLFor(url, false);
- // properly encode the URL
- url = URLTools.encodeXWWWFormURL(url);
+ // properly encode the URL
+ url = URLTools.encodeXWWWFormURL(url);
- // build the WSRP resource URL with rewrite tokens
- StringBuffer sb = new StringBuffer(url.length() * 2);
- sb.append(WSRPRewritingConstants.BEGIN_WSRP_REWRITE).append(WSRPRewritingConstants.URL_TYPE_NAME)
- .append(EQ).append(WSRPRewritingConstants.URL_TYPE_RESOURCE).append(AMP)
- .append(WSRPRewritingConstants.RESOURCE_URL).append(EQ).append(url)
- .append(AMP).append(WSRPRewritingConstants.RESOURCE_REQUIRES_REWRITE)
- .append(EQ_TRUE).append(WSRPRewritingConstants.END_WSRP_REWRITE);
- return sb.toString();
- }
+ // build the WSRP resource URL with rewrite tokens
+ StringBuffer sb = new StringBuffer(url.length() * 2);
+ sb.append(WSRPRewritingConstants.BEGIN_WSRP_REWRITE).append(WSRPRewritingConstants.URL_TYPE_NAME)
+ .append(EQ).append(WSRPRewritingConstants.URL_TYPE_RESOURCE).append(AMP)
+ .append(WSRPRewritingConstants.RESOURCE_URL).append(EQ).append(url)
+ .append(AMP).append(WSRPRewritingConstants.RESOURCE_REQUIRES_REWRITE)
+ .append(EQ_TRUE).append(WSRPRewritingConstants.END_WSRP_REWRITE);
+ return sb.toString();
}
- return null;
+ return url;
}
/**
@@ -152,7 +145,7 @@
else if (containerURL instanceof ResourceURL)
{
ResourceURL resourceURL = (ResourceURL)containerURL;
- // todo: do something
+ throw new NotYetImplemented("ResourceURL support not implemented. Requested URL: " + resourceURL);
}
}
return null;
Added: branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/jboss-portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/jboss-portlet.xml (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/jboss-portlet.xml 2008-07-10 21:48:41 UTC (rev 11416)
@@ -0,0 +1,28 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2007, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app>
+ <portlet>
+ <portlet-name>Resource Non URL Encoded Test Portlet</portlet-name>
+ <remotable>true</remotable>
+ </portlet>
+</portlet-app>
\ No newline at end of file
Added: branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/portlet.xml (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/portlet.xml 2008-07-10 21:48:41 UTC (rev 11416)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" version="1.0">
+ <portlet>
+ <portlet-name>Resource Non URL Encoded Test Portlet</portlet-name>
+ <portlet-class>org.jboss.portal.test.wsrp.portlet.ResourceNoEncodeURLPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <portlet-info>
+ <title>Non URL Encoded Resource Test</title>
+ </portlet-info>
+ </portlet>
+
+</portlet-app>
\ No newline at end of file
Added: branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/web.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/web.xml (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/web.xml 2008-07-10 21:48:41 UTC (rev 11416)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
Added: branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/gif/logo.gif
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/gif/logo.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
17 years, 10 months
JBoss Portal SVN: r11415 - in branches/JBoss_Portal_Branch_2_6/wsrp: src/main/org/jboss/portal/test/wsrp/framework/support and 8 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-07-10 17:48:11 -0400 (Thu, 10 Jul 2008)
New Revision: 11415
Added:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/other/AbsoluteURLReplacementGeneratorTestCase.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/ResourceNoEncodeURLPortlet.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/
branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/
branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/jboss-portlet.xml
branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/portlet.xml
branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/web.xml
branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/gif/
branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/gif/logo.gif
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/build.xml
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpServletRequest.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/AbsoluteURLReplacementGenerator.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPPortletInvocationContext.java
Log:
- JBPORTAL-2067: Fixed several issues, added more tests.
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/build.xml 2008-07-10 18:20:05 UTC (rev 11414)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/build.xml 2008-07-10 21:48:11 UTC (rev 11415)
@@ -23,13 +23,13 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<!DOCTYPE project [
- <!ENTITY libraries SYSTEM "../thirdparty/libraries.ent">
- <!ENTITY buildmagic SYSTEM "../tools/etc/buildfragments/buildmagic.ent">
- <!ENTITY tools SYSTEM "../tools/etc/buildfragments/tools.ent">
- <!ENTITY modules SYSTEM "../tools/etc/buildfragments/modules.ent">
- <!ENTITY defaults SYSTEM "../tools/etc/buildfragments/defaults.ent">
- <!ENTITY targets SYSTEM "../tools/etc/buildfragments/targets.ent">
- ]>
+ <!ENTITY libraries SYSTEM "../thirdparty/libraries.ent">
+ <!ENTITY buildmagic SYSTEM "../tools/etc/buildfragments/buildmagic.ent">
+ <!ENTITY tools SYSTEM "../tools/etc/buildfragments/tools.ent">
+ <!ENTITY modules SYSTEM "../tools/etc/buildfragments/modules.ent">
+ <!ENTITY defaults SYSTEM "../tools/etc/buildfragments/defaults.ent">
+ <!ENTITY targets SYSTEM "../tools/etc/buildfragments/targets.ent">
+ ]>
<!-- $Id$ -->
@@ -45,11 +45,7 @@
<project default="main" name="WSRP for JBoss Portal" xmlns:server="http://jboss.org/ns/test/ant/server">
- <!--| Include the common build elements. |-->
- <!--| |-->
- <!--| This defines several different targets, properties and paths. |-->
- <!--| It also sets up the basic extention tasks amoung other things. |-->
- <!--+====================================================================+-->
+ <!--| Include the common build elements. |--><!--| |--><!--| This defines several different targets, properties and paths. |--><!--| It also sets up the basic extention tasks amoung other things. |--><!--+====================================================================+-->
&buildmagic;
&modules;
@@ -57,9 +53,7 @@
&tools;
&targets;
- <!-- ================================================================== -->
- <!-- Initialization -->
- <!-- ================================================================== -->
+ <!-- ================================================================== --><!-- Initialization --><!-- ================================================================== -->
<!--
| Initialize the build system. Must depend on '_buildmagic:init'.
@@ -78,24 +72,19 @@
<pathelement location="${project.tools}/lib/cargo-core-uberjar-0.8.jar"/>
</path>
<taskdef
- name="deploy"
- classname="org.jboss.portal.common.ant.Deploy"
- classpathref="portal.task.classpath"/>
+ name="deploy"
+ classname="org.jboss.portal.common.ant.Deploy"
+ classpathref="portal.task.classpath"/>
<taskdef
- name="undeploy"
- classname="org.jboss.portal.common.ant.Undeploy"
- classpathref="portal.task.classpath"/>
+ name="undeploy"
+ classname="org.jboss.portal.common.ant.Undeploy"
+ classpathref="portal.task.classpath"/>
<target name="init" depends="_buildmagic:init">
<!-- Add module specific elements here -->
</target>
- <!--+====================================================================+-->
- <!--| Configuration |-->
- <!--| |-->
- <!--| This target is invoked by the Buildmagic initialization logic |-->
- <!--| and should contain module specific configuration elements. |-->
- <!--+====================================================================+-->
+ <!--+====================================================================+--><!--| Configuration |--><!--| |--><!--| This target is invoked by the Buildmagic initialization logic |--><!--| and should contain module specific configuration elements. |--><!--+====================================================================+-->
<target name="configure" unless="configure.disable">
@@ -174,9 +163,7 @@
<path refid="jboss.portal-faces.classpath"/>
</path>
- <!--+=======================================+-->
- <!--| Override any default properties here. |-->
- <!--+=======================================+-->
+ <!--+=======================================+--><!--| Override any default properties here. |--><!--+=======================================+-->
<!-- Classes generated from WSDL are in a non-standard location so need to override properties -->
<property name="build.gen" value="${module.source}"/>
@@ -202,9 +189,7 @@
<call target="configure-explode"/>
<call target="configure-jbossaop"/>
- <!--+=======================================+-->
- <!--| Define module specific elements here. |-->
- <!--+=======================================+-->
+ <!--+=======================================+--><!--| Define module specific elements here. |--><!--+=======================================+-->
<property name="javadoc.private" value="true"/>
<property name="javadoc.protected" value="false"/>
@@ -224,9 +209,9 @@
<path refid="qdox.qdox.classpath"/>
</path>
<taskdef
- name="aopc"
- classname="org.jboss.aop.ant.AopC"
- classpathref="jbossaop.task.classpath"/>
+ name="aopc"
+ classname="org.jboss.aop.ant.AopC"
+ classpathref="jbossaop.task.classpath"/>
</target>
<target name="configure-explode">
@@ -239,13 +224,7 @@
classpathref="explode.task.classpath"/>
</target>
- <!--+====================================================================+-->
- <!--| Compile |-->
- <!--| |-->
- <!--| This target should depend on other compile-* targets for each |-->
- <!--| different type of compile that needs to be performed, short of |-->
- <!--| documentation compiles. |-->
- <!--+====================================================================+-->
+ <!--+====================================================================+--><!--| Compile |--><!--| |--><!--| This target should depend on other compile-* targets for each |--><!--| different type of compile that needs to be performed, short of |--><!--| documentation compiles. |--><!--+====================================================================+-->
<target name="compile"
description="Compile all source files."
@@ -285,13 +264,7 @@
<property name="compile.disable" value="true"/>
</target>
- <!--+====================================================================+-->
- <!--| Generate Output |-->
- <!--| |-->
- <!--| Generates the target output for this module. Target output is |-->
- <!--| the output which is meant to be released or used by external |-->
- <!--| modules. |-->
- <!--+====================================================================+-->
+ <!--+====================================================================+--><!--| Generate Output |--><!--| |--><!--| Generates the target output for this module. Target output is |--><!--| the output which is meant to be released or used by external |--><!--| modules. |--><!--+====================================================================+-->
<target name="output" description="Generate WSRP Service archive." depends="compile">
<mkdir dir="${build.lib}"/>
@@ -339,9 +312,7 @@
name="portal-wsrp-exploded.sar"/>
</target>
- <!-- ================================================================== -->
- <!-- Cleaning -->
- <!-- ================================================================== -->
+ <!-- ================================================================== --><!-- Cleaning --><!-- ================================================================== -->
<!-- Clean up all build output -->
<target name="clean" depends="_default:clean">
@@ -349,28 +320,20 @@
<!-- Add module specific elements here. -->
</target>
- <!--+====================================================================+-->
- <!--| Documents |-->
- <!--| |-->
- <!--| Generate all documentation for this module. |-->
- <!--+====================================================================+-->
+ <!--+====================================================================+--><!--| Documents |--><!--| |--><!--| Generate all documentation for this module. |--><!--+====================================================================+-->
<target name="docs" depends="_default:docs">
<!-- Add module specific elements here. -->
</target>
- <!-- ================================================================== -->
- <!-- Misc. -->
- <!-- ================================================================== -->
+ <!-- ================================================================== --><!-- Misc. --><!-- ================================================================== -->
<target name="main" depends="most"/>
<target name="all" depends="_default:all, explode"/>
<target name="most" depends="_default:most"/>
<target name="help" depends="_default:help"/>
- <!-- ================================================================== -->
- <!-- Deployment -->
- <!-- ================================================================== -->
+ <!-- ================================================================== --><!-- Deployment --><!-- ================================================================== -->
<!-- Deployment of test agent -->
<target name="agent-deploy" depends="init">
@@ -418,9 +381,7 @@
<undeploy file="${build.lib.test}/test-wsrp-consumer.sar" config="default"/>
</target>
- <!-- ================================================================== -->
- <!-- Tests -->
- <!-- ================================================================== -->
+ <!-- ================================================================== --><!-- Tests --><!-- ================================================================== -->
<target name="package-deployment-test" description="Generates the deployment test artifacts" depends="compile">
<jar jarfile="${build.lib.test}/test-deployment-lib.jar">
@@ -627,9 +588,11 @@
<!-- Resourceportlet test portlet -->
<package-test-portlet archiveName="resource" portletName="Resource"/>
- <!-- Multipart test portlet -->
- <!--<package-test-portlet archiveName="multipart" portletName="Multipart"/>-->
+ <!-- Non URL Encoded Resource test portlet -->
+ <package-test-portlet archiveName="resourcenoencodeurl" portletName="ResourceNoEncodeURL"/>
+ <!-- Multipart test portlet --><!--<package-test-portlet archiveName="multipart" portletName="Multipart"/>-->
+
<!-- Application scope test portlet -->
<jar jarfile="${build.lib.test}/test-applicationscope-portlet.war">
<fileset dir="${build.resources.test}/test-applicationscope-portlet-war"/>
@@ -646,9 +609,7 @@
description="Packages all the test-related artifacts. Does NOT compile classes so this should be done before
calling this task."/>
- <!-- ================================================================== -->
- <!-- Tests -->
- <!-- ================================================================== -->
+ <!-- ================================================================== --><!-- Tests --><!-- ================================================================== -->
<target name="clean-test">
<!-- remove generated test xml files -->
@@ -887,6 +848,8 @@
<execute-tests>
<x-test>
<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.other.WSRPPortletURLTestCase"/>
+ <test todir="${test.reports}"
+ name="org.jboss.portal.test.wsrp.other.AbsoluteURLReplacementGeneratorTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.other.UserContextConverterTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.wsrp.other.RegistrationPropertyDescriptionTestCase"/>
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpServletRequest.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpServletRequest.java 2008-07-10 18:20:05 UTC (rev 11414)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpServletRequest.java 2008-07-10 21:48:11 UTC (rev 11415)
@@ -41,6 +41,9 @@
private HttpSession session;
private Map attrs;
+ public static String scheme = "http";
+ public static String serverName = "test";
+ public static Integer serverPort = 1234;
public MockHttpServletRequest(HttpSession session)
{
@@ -89,7 +92,20 @@
{
String name = (String)args[0];
attrs.remove(name);
+ return null;
}
+ if ("getScheme".equals(methodName))
+ {
+ return scheme;
+ }
+ if ("getServerName".equals(methodName))
+ {
+ return serverName;
+ }
+ if ("getServerPort".equals(methodName))
+ {
+ return serverPort;
+ }
throw new UnsupportedOperationException("MockHttpServletRequest does not support: " + method);
}
}
Added: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/other/AbsoluteURLReplacementGeneratorTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/other/AbsoluteURLReplacementGeneratorTestCase.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/other/AbsoluteURLReplacementGeneratorTestCase.java 2008-07-10 21:48:11 UTC (rev 11415)
@@ -0,0 +1,71 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.wsrp.other;
+
+import junit.framework.TestCase;
+import org.jboss.portal.test.wsrp.framework.support.MockHttpServletRequest;
+import static org.jboss.portal.test.wsrp.framework.support.MockHttpServletRequest.*;
+import org.jboss.portal.wsrp.producer.AbsoluteURLReplacementGenerator;
+import static org.jboss.portal.wsrp.producer.AbsoluteURLReplacementGenerator.PORT_END;
+import static org.jboss.portal.wsrp.producer.AbsoluteURLReplacementGenerator.SCH_END;
+
+import javax.servlet.http.HttpServletRequest;
+import java.lang.reflect.Proxy;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class AbsoluteURLReplacementGeneratorTestCase extends TestCase
+{
+ private AbsoluteURLReplacementGenerator gen;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ MockHttpServletRequest mockRequest = new MockHttpServletRequest(null);
+ HttpServletRequest request = (HttpServletRequest)Proxy.newProxyInstance(getClass().getClassLoader(),
+ new Class[]{HttpServletRequest.class}, mockRequest);
+ gen = new AbsoluteURLReplacementGenerator(request);
+ }
+
+ public void testNonAbsoluteURL()
+ {
+ String url = "foo";
+ assertEquals(url, gen.getAbsoluteURLFor(url));
+ }
+
+ public void testAbsoluteURL()
+ {
+ String url = "/foo";
+ assertEquals(scheme + SCH_END + serverName + PORT_END + serverPort + url, gen.getAbsoluteURLFor(url));
+ }
+
+ public void testWSRPEncodedURL()
+ {
+ String url = "wsrp_rewrite?wsrp-urlType=blockingAction&wsrp-interactionState=JBPNS_/wsrp_rewrite";
+ assertEquals(url, gen.getAbsoluteURLFor(url));
+ }
+}
Added: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/ResourceNoEncodeURLPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/ResourceNoEncodeURLPortlet.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/ResourceNoEncodeURLPortlet.java 2008-07-10 21:48:11 UTC (rev 11415)
@@ -0,0 +1,44 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.wsrp.portlet;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class ResourceNoEncodeURLPortlet extends GenericPortlet
+{
+ protected void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException
+ {
+ response.setContentType("text/html");
+ Writer writer = response.getWriter();
+ writer.write("<img src='" + request.getContextPath() + "/gif/logo.gif'/>");
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java 2008-07-10 18:20:05 UTC (rev 11414)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/MarkupTestCase.java 2008-07-10 21:48:11 UTC (rev 11415)
@@ -60,7 +60,7 @@
private static final String DEFAULT_MARKUP_PORTLET_WAR = "test-markup-portlet.war";
public MarkupTestCase()
- throws Exception
+ throws Exception
{
super("MarkupTestCase", DEFAULT_MARKUP_PORTLET_WAR);
}
@@ -115,8 +115,8 @@
MarkupResponse response = markupService.getMarkup(getMarkup);
checkMarkupResponse(response, "<form method='post' action='wsrp_rewrite?wsrp-urlType=blockingAction&wsrp" +
- "-interactionState=JBPNS_/wsrp_rewrite' id='wsrp_rewrite_portfolioManager'><table><tr><td>Stock symbol</t" +
- "d><td><input name='symbol'/></td></tr><tr><td><input type='submit' value='Submit'></td></tr></table></form>");
+ "-interactionState=JBPNS_/wsrp_rewrite' id='wsrp_rewrite_portfolioManager'><table><tr><td>Stock symbol</t" +
+ "d><td><input name='symbol'/></td></tr><tr><td><input type='submit' value='Submit'></td></tr></table></form>");
}
public void testGetMarkupRenderParameters() throws Exception
@@ -154,7 +154,7 @@
// let's see now if we can increment the counter
PerformBlockingInteraction performBlockingInteraction =
- WSRPTypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
+ WSRPTypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
InteractionParams interactionParams = performBlockingInteraction.getInteractionParams();
interactionParams.setInteractionState(incrementAction.getInteractionState().getStringValue());
markupService.performBlockingInteraction(performBlockingInteraction);
@@ -222,7 +222,7 @@
public void testPerformBlockingInteractionRedirect() throws Exception
{
PerformBlockingInteraction performBlockingInteraction =
- WSRPTypeFactory.createDefaultPerformBlockingInteraction(getDefaultHandle());
+ WSRPTypeFactory.createDefaultPerformBlockingInteraction(getDefaultHandle());
InteractionParams interactionParams = performBlockingInteraction.getInteractionParams();
NamedString[] formParams = {new NamedString("symbol", "HELP")}; // crappy way but this is a test! ;)
interactionParams.setFormParameters(formParams);
@@ -389,7 +389,7 @@
MarkupResponse response = markupService.getMarkup(getMarkup);
checkMarkupResponse(response, "wsrp_rewrite?wsrp-urlType=blockingAction&wsrp-interactionState=JBPNS_/wsrp_rewrite\n" +
- "wsrp_rewrite?wsrp-urlType=render&wsrp-navigationalState=JBPNS_/wsrp_rewrite");
+ "wsrp_rewrite?wsrp-urlType=render&wsrp-navigationalState=JBPNS_/wsrp_rewrite");
}
finally
{
@@ -426,7 +426,7 @@
try
{
PerformBlockingInteraction action =
- WSRPTypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
+ WSRPTypeFactory.createDefaultPerformBlockingInteraction(getHandleForCurrentlyDeployedArchive());
action.getInteractionParams().setFormParameters(new NamedString[]{new NamedString("multi", "value1")});
BlockingInteractionResponse actionResponse = markupService.performBlockingInteraction(action);
GetMarkup markupRequest = createMarkupRequestForCurrentlyDeployedPortlet();
@@ -435,7 +435,7 @@
checkMarkupResponse(response, "multi: value1");
action.getInteractionParams().setFormParameters(new NamedString[]{
- new NamedString("multi", "value1"), new NamedString("multi", "value2")});
+ new NamedString("multi", "value1"), new NamedString("multi", "value2")});
actionResponse = markupService.performBlockingInteraction(action);
markupRequest = createMarkupRequestForCurrentlyDeployedPortlet();
markupRequest.getMarkupParams().setNavigationalState(actionResponse.getUpdateResponse().getNavigationalState());
@@ -524,6 +524,32 @@
}
}
+ public void testGetMarkupWithNonURLEncodedResource() throws Exception
+ {
+ undeploy(DEFAULT_MARKUP_PORTLET_WAR);
+ String archive = "test-resourcenoencodeurl-portlet.war";
+ deploy(archive);
+
+ try
+ {
+ GetMarkup gm = createMarkupRequestForCurrentlyDeployedPortlet();
+ MarkupResponse res = markupService.getMarkup(gm);
+ String markupString = res.getMarkupContext().getMarkupString();
+
+ // accept either localhost or 127.0.0.1 for the host part of the generated markup
+ String markupStart = "<img src='http://";
+ String markupEnd = ":8080/test-resourcenoencodeurl-portlet/gif/logo.gif'/>";
+ String localhostMarkup = markupStart + "localhost" + markupEnd;
+ String homeIPMarkup = markupStart + "127.0.0.1" + markupEnd;
+ boolean result = localhostMarkup.equals(markupString) || homeIPMarkup.equals(markupString);
+ ExtendedAssert.assertTrue(result);
+ }
+ finally
+ {
+ undeploy(archive);
+ }
+ }
+
public void testApplicationScopeVariableHandling() throws Exception
{
undeploy(DEFAULT_MARKUP_PORTLET_WAR);
@@ -566,7 +592,7 @@
private String checkPBIAndGetNavigationalState(String symbol) throws Exception
{
PerformBlockingInteraction performBlockingInteraction =
- WSRPTypeFactory.createDefaultPerformBlockingInteraction(getDefaultHandle());
+ WSRPTypeFactory.createDefaultPerformBlockingInteraction(getDefaultHandle());
InteractionParams interactionParams = performBlockingInteraction.getInteractionParams();
NamedString[] formParams = {new NamedString("symbol", symbol)};
interactionParams.setFormParameters(formParams);
@@ -633,4 +659,4 @@
{
return DEFAULT_MARKUP_PORTLET_WAR;
}
-}
\ No newline at end of file
+}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/AbsoluteURLReplacementGenerator.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/AbsoluteURLReplacementGenerator.java 2008-07-10 18:20:05 UTC (rev 11414)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/AbsoluteURLReplacementGenerator.java 2008-07-10 21:48:11 UTC (rev 11415)
@@ -23,6 +23,7 @@
package org.jboss.portal.wsrp.producer;
import org.jboss.portal.common.net.URLTools;
+import org.jboss.portal.wsrp.WSRPRewritingConstants;
import javax.servlet.http.HttpServletRequest;
@@ -33,8 +34,9 @@
public class AbsoluteURLReplacementGenerator extends URLTools.URLReplacementGenerator
{
private String serverAddress;
- static final String SCH_END = "://";
- static final String PORT_END = ":";
+ public static final String SCH_END = "://";
+ public static final String PORT_END = ":";
+ public static final String SLASH = "/";
public AbsoluteURLReplacementGenerator(HttpServletRequest request)
{
@@ -50,13 +52,32 @@
return getAbsoluteURLFor(urlMatch.getURLAsString());
}
+ /**
+ * todo: public only for tests
+ *
+ * @param url
+ * @return
+ */
public String getAbsoluteURLFor(String url)
{
- if (!URLTools.isNetworkURL(url))
+ return getAbsoluteURLFor(url, true);
+ }
+
+ String getAbsoluteURLFor(String url, boolean checkWSRPToken)
+ {
+ // We don't encode URL through this API when it is a wsrp URL
+ if (checkWSRPToken && url.startsWith(WSRPRewritingConstants.BEGIN_WSRP_REWRITE))
{
+ return url;
+ }
+
+ if (!URLTools.isNetworkURL(url) && url.startsWith(SLASH))
+ {
return serverAddress + url;
}
-
- return url;
+ else
+ {
+ return url;
+ }
}
}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPPortletInvocationContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPPortletInvocationContext.java 2008-07-10 18:20:05 UTC (rev 11414)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPPortletInvocationContext.java 2008-07-10 21:48:11 UTC (rev 11415)
@@ -100,33 +100,25 @@
/** Override the default behavior in order to avoid to encode when it is producer written URL. */
public String encodeResourceURL(String url)
{
- if (url != null)
+ if (url != null && !url.startsWith(WSRPRewritingConstants.BEGIN_WSRP_REWRITE))
{
- if (url.startsWith(WSRPRewritingConstants.BEGIN_WSRP_REWRITE))
- {
- // We don't encode URL through this API when it is a wsrp URL
- return url;
- }
- else
- {
- // make root relative URLs absolute
- url = new AbsoluteURLReplacementGenerator(getClientRequest()).getAbsoluteURLFor(url);
+ // make root relative URLs absolute. Optimization: we don't recheck the precense of the WSRP token.
+ url = new AbsoluteURLReplacementGenerator(getClientRequest()).getAbsoluteURLFor(url, false);
- // properly encode the URL
- url = URLTools.encodeXWWWFormURL(url);
+ // properly encode the URL
+ url = URLTools.encodeXWWWFormURL(url);
- // build the WSRP resource URL with rewrite tokens
- StringBuffer sb = new StringBuffer(url.length() * 2);
- sb.append(WSRPRewritingConstants.BEGIN_WSRP_REWRITE).append(WSRPRewritingConstants.URL_TYPE_NAME)
- .append(EQ).append(WSRPRewritingConstants.URL_TYPE_RESOURCE).append(AMP)
- .append(WSRPRewritingConstants.RESOURCE_URL).append(EQ).append(url)
- .append(AMP).append(WSRPRewritingConstants.RESOURCE_REQUIRES_REWRITE)
- .append(EQ_TRUE).append(WSRPRewritingConstants.END_WSRP_REWRITE);
- return sb.toString();
- }
+ // build the WSRP resource URL with rewrite tokens
+ StringBuffer sb = new StringBuffer(url.length() * 2);
+ sb.append(WSRPRewritingConstants.BEGIN_WSRP_REWRITE).append(WSRPRewritingConstants.URL_TYPE_NAME)
+ .append(EQ).append(WSRPRewritingConstants.URL_TYPE_RESOURCE).append(AMP)
+ .append(WSRPRewritingConstants.RESOURCE_URL).append(EQ).append(url)
+ .append(AMP).append(WSRPRewritingConstants.RESOURCE_REQUIRES_REWRITE)
+ .append(EQ_TRUE).append(WSRPRewritingConstants.END_WSRP_REWRITE);
+ return sb.toString();
}
- return null;
+ return url;
}
/**
Added: branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/jboss-portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/jboss-portlet.xml (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/jboss-portlet.xml 2008-07-10 21:48:11 UTC (rev 11415)
@@ -0,0 +1,28 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2007, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app>
+ <portlet>
+ <portlet-name>Resource Non URL Encoded Test Portlet</portlet-name>
+ <remotable>true</remotable>
+ </portlet>
+</portlet-app>
Added: branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/portlet.xml (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/portlet.xml 2008-07-10 21:48:11 UTC (rev 11415)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" version="1.0">
+ <portlet>
+ <portlet-name>Resource Non URL Encoded Test Portlet</portlet-name>
+ <portlet-class>org.jboss.portal.test.wsrp.portlet.ResourceNoEncodeURLPortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <portlet-info>
+ <title>Non URL Encoded Resource Test</title>
+ </portlet-info>
+ </portlet>
+
+</portlet-app>
Added: branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/web.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/web.xml (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/WEB-INF/web.xml 2008-07-10 21:48:11 UTC (rev 11415)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
Added: branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/gif/logo.gif
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/tests/test-resourcenoencodeurl-portlet-war/gif/logo.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
17 years, 10 months
JBoss Portal SVN: r11414 - branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/other.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-07-10 14:20:05 -0400 (Thu, 10 Jul 2008)
New Revision: 11414
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java
Log:
- Fixed tests as we now sanitize doubly-encoded ampersands.
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java 2008-07-10 18:19:51 UTC (rev 11413)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java 2008-07-10 18:20:05 UTC (rev 11414)
@@ -94,13 +94,20 @@
{
String message = "Should have detected invalid parameter: ";
- String invalid = "wsrp_rewrite?wsrp-urlType=render&amp;wsrp-url=http%3A%2F%2Flocalhost%2F/wsrp_rewrite";
- checkInvalidURL(invalid, message, "amp;wsrp-url");
-
- invalid = "wsrp_rewrite?wsrp-urlType=render&foo=bar/wsrp_rewrite";
+ String invalid = "wsrp_rewrite?wsrp-urlType=render&foo=bar/wsrp_rewrite";
checkInvalidURL(invalid, message, "foo");
}
+ public void testDoublyEncodedAmpersand()
+ {
+ String expected = "wsrp_rewrite?wsrp-urlType=render&amp;wsrp-mode=wsrp:help&amp;wsrp-windowState=wsrp:maximized/wsrp_rewrite";
+ WSRPPortletURL url = WSRPPortletURL.create(expected);
+
+ assertTrue(url instanceof WSRPRenderURL);
+ assertEquals(Mode.HELP, url.getMode());
+ assertEquals(WindowState.MAXIMIZED, url.getWindowState());
+ }
+
/** Relax validation and test that we now accept normally invalid URLs. */
public void testExtraParametersRelaxedValidation()
{
17 years, 10 months
JBoss Portal SVN: r11413 - branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/other.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-07-10 14:19:51 -0400 (Thu, 10 Jul 2008)
New Revision: 11413
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java
Log:
- Fixed tests as we now sanitize doubly-encoded ampersands.
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java 2008-07-10 16:53:49 UTC (rev 11412)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java 2008-07-10 18:19:51 UTC (rev 11413)
@@ -94,13 +94,20 @@
{
String message = "Should have detected invalid parameter: ";
- String invalid = "wsrp_rewrite?wsrp-urlType=render&amp;wsrp-url=http%3A%2F%2Flocalhost%2F/wsrp_rewrite";
- checkInvalidURL(invalid, message, "amp;wsrp-url");
-
- invalid = "wsrp_rewrite?wsrp-urlType=render&foo=bar/wsrp_rewrite";
+ String invalid = "wsrp_rewrite?wsrp-urlType=render&foo=bar/wsrp_rewrite";
checkInvalidURL(invalid, message, "foo");
}
+ public void testDoublyEncodedAmpersand()
+ {
+ String expected = "wsrp_rewrite?wsrp-urlType=render&amp;wsrp-mode=wsrp:help&amp;wsrp-windowState=wsrp:maximized/wsrp_rewrite";
+ WSRPPortletURL url = WSRPPortletURL.create(expected);
+
+ assertTrue(url instanceof WSRPRenderURL);
+ assertEquals(Mode.HELP, url.getMode());
+ assertEquals(WindowState.MAXIMIZED, url.getWindowState());
+ }
+
/** Relax validation and test that we now accept normally invalid URLs. */
public void testExtraParametersRelaxedValidation()
{
17 years, 10 months
JBoss Portal SVN: r11412 - branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-jsp-samples-war/WEB-INF.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-07-10 12:53:49 -0400 (Thu, 10 Jul 2008)
New Revision: 11412
Added:
branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jboss-portlet.xml
Log:
- Make JSP portlet sample remotable for test purposes.
Copied: branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jboss-portlet.xml (from rev 11370, branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jboss-portlet.xml)
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jboss-portlet.xml (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jboss-portlet.xml 2008-07-10 16:53:49 UTC (rev 11412)
@@ -0,0 +1,32 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2008, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE portlet-app PUBLIC "-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
+ "http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
+
+<portlet-app>
+ <remotable>true</remotable>
+ <portlet>
+ <portlet-name>JSPPortlet</portlet-name>
+ </portlet>
+</portlet-app>
Property changes on: branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jboss-portlet.xml
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ LastChangedDate LastChangedBy LastChangedRevision Id
Name: svn:mergeinfo
+
17 years, 10 months
JBoss Portal SVN: r11411 - branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-jsp-samples-war/WEB-INF.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-07-10 12:53:33 -0400 (Thu, 10 Jul 2008)
New Revision: 11411
Added:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jboss-portlet.xml
Log:
- Make JSP portlet sample remotable for test purposes.
Added: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jboss-portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jboss-portlet.xml (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-jsp-samples-war/WEB-INF/jboss-portlet.xml 2008-07-10 16:53:33 UTC (rev 11411)
@@ -0,0 +1,32 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2008, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE portlet-app PUBLIC "-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
+ "http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
+
+<portlet-app>
+ <remotable>true</remotable>
+ <portlet>
+ <portlet-name>JSPPortlet</portlet-name>
+ </portlet>
+</portlet-app>
17 years, 10 months
JBoss Portal SVN: r11410 - branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-07-10 12:52:39 -0400 (Thu, 10 Jul 2008)
New Revision: 11410
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java
Log:
- JBPORTAL-2067: retrieve the HttpServletRequest properly.
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java 2008-07-10 16:51:47 UTC (rev 11409)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java 2008-07-10 16:52:39 UTC (rev 11410)
@@ -54,6 +54,7 @@
import org.jboss.portal.wsrp.core.UnsupportedMimeTypeFault;
import org.jboss.portal.wsrp.core.UnsupportedModeFault;
import org.jboss.portal.wsrp.core.UnsupportedWindowStateFault;
+import org.jboss.portal.wsrp.servlet.ServletAccess;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
@@ -189,7 +190,7 @@
PortletUtils.SUFFIX,
WSRPRewritingConstants.WSRP_REWRITE_TOKEN);
- result = URLTools.replaceURLsBy(result, new AbsoluteURLReplacementGenerator(invocation.getDispatchedRequest()));
+ result = URLTools.replaceURLsBy(result, new AbsoluteURLReplacementGenerator(ServletAccess.getRequest()));
return result;
}
}
17 years, 10 months