JBoss Portal SVN: r10123 - docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: mmcallis
Date: 2008-02-26 18:13:42 -0500 (Tue, 26 Feb 2008)
New Revision: 10123
Modified:
docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/xmldescriptors.xml
Log:
6.1.3. The JBoss Portal Object DTD
revising lists, replacing itemizedlists with variablelists
Modified: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/xmldescriptors.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/xmldescriptors.xml 2008-02-26 20:03:02 UTC (rev 10122)
+++ docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/xmldescriptors.xml 2008-02-26 23:13:42 UTC (rev 10123)
@@ -614,7 +614,7 @@
</para>
<para>
<screen><![CDATA[
-<![CDATA[<!ELEMENT context-name (#PCDATA)>]]>
+<!ELEMENT context-name (#PCDATA)>]]>
</screen>
</para>
<para>
@@ -622,7 +622,7 @@
</para>
<para>
<screen><![CDATA[
-<![CDATA[<!ELEMENT portal (portal-name,supported-modes,supported-window-states?,properties?,
+<!ELEMENT portal (portal-name,supported-modes,supported-window-states?,properties?,
listener?,security-constraint?,page*)>]]>
</screen>
</para>
@@ -660,7 +660,7 @@
</listitem>
</varlistentry>
<varlistentry><term><screen><![CDATA[
-<![CDATA[<!ELEMENT mode (#PCDATA)>]]>
+<!ELEMENT mode (#PCDATA)>]]>
</screen></term>
<listitem>
<para>
@@ -669,7 +669,7 @@
</listitem>
</varlistentry>
<varlistentry><term><screen><![CDATA[
-<![CDATA[<!ELEMENT supported-window-states (window-state*)>]]>
+<!ELEMENT supported-window-states (window-state*)>]]>
</screen></term>
<listitem>
<para>
@@ -682,60 +682,110 @@
<window-state>minimized</window-state>
<window-state>maximized</window-state>
</supported-window-states>]]>
-</screen></para>
+</screen>
+ </para>
+ <para>
+<screen><![CDATA[
+<!ELEMENT window-state (#PCDATA)>]]>
+</screen>
+ </para>
+ <para>
+ A window state value.
+ </para>
</listitem>
</varlistentry>
-</variablelist>
-</para>
-</sect2>
-<!--<para>
-Element <![CDATA[<!ELEMENT window-state (#PCDATA)>]]>
-</para><para><programlisting><![CDATA[A window state value.]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT page (page-name,properties?,listener?,security-constraint?,(page | window)*)>]]>
-</para><para><programlisting><![CDATA[A portal object of type page. A page type represents a page which can have children of
-type page and window. The children windows are the windows of the page and the children
-pages are the subpages of this page.]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT page-name (#PCDATA)>]]>
-</para><para><programlisting><![CDATA[The page name value.]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT window (window-name,(instance-ref | content),region,height,properties?,listener?)>
-
-]]>
-</para><para><programlisting><![CDATA[A portal object of type window. A window type represents a window. Beside the common
-properties a window has a content and belong to a region on the page.
-
-The instance-ref or content tags are used to define the content of the window. The
-usage of the content tag is generic and can be used to describe any kind of content.
-The instance-ref is a shortcut to define a content type of portlet which points to a
-portlet instance.
-
-The region and height defines how the window is placed in the page.]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT window-name (#PCDATA)>]]>
-</para><para><programlisting><![CDATA[The window name value.]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT instance-ref (#PCDATA)>]]>
-</para><para><programlisting><![CDATA[Define the content of the window as a reference to a portlet instance. The value
-is the id of the instance.
-
-Example:
-
-<instance-ref>MyPortletInstance</instance-ref>]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT content (content-type,content-uri)>]]>
-</para><para><programlisting><![CDATA[Define the content of the window in a generic manner. The content is define by
-the type of the content and an URI which acts as an identificator for the content.
-
-Example:
-
+<varlistentry><term><screen><![CDATA[
+<!ELEMENT page (page-name,properties?,listener?,security-constraint?,(page | window)*)>]]>
+</screen></term>
+<listitem>
+ <para>
+ A portal object of type page. A page type represents a page which can have children of type page and window. The children windows are the windows of the page and the children pages are the subpages of this page.
+ </para>
+ <para>
+<screen><![CDATA[
+<!ELEMENT page-name (#PCDATA)>]]>
+</screen>
+ </para>
+ <para>
+ The page name value.
+ </para>
+</listitem>
+</varlistentry>
+<varlistentry><term><screen><![CDATA[
+<!ELEMENT window (window-name,(instance-ref | content),region,height,properties?,listener?)>]]>
+</screen></term>
+<listitem>
+ <para>
+ A portal object of type window. A window type represents a window. Beside the common properties a window has a content and belong to a region on the page.
+ </para>
+ <para>
+ The instance-ref or content tags are used to define the content of the window. The usage of the content tag is generic and can be used to describe any kind of content. The instance-ref is a shortcut to define a content type of portlet which points to a portlet instance.
+ </para>
+ <para>
+ The region and height defines how the window is placed in the page.
+ </para>
+ <para>
+<screen><![CDATA[
+<!ELEMENT window-name (#PCDATA)>]]>
+</screen>
+ </para>
+ <para>
+ The window name value.
+ </para>
+ <para>
+<screen><![CDATA[
+<!ELEMENT instance-ref (#PCDATA)>]]>
+</screen>
+ </para>
+ <para>
+ Define the content of the window as a reference to a portlet instance. The value is the id of the instance.
+ </para>
+ <para>
+ The following is an example of the <computeroutput><instance-ref></computeroutput> element:
+ </para>
+ <para>
+<screen>
+<instance-ref>MyPortletInstance</instance-ref>
+</screen>
+ </para>
+ <para>
+<screen><![CDATA[
+<!ELEMENT region (#PCDATA)>]]>
+</screen>
+ </para>
+ <para>
+ The region the window belongs to.
+ </para>
+ <para>
+<screen><![CDATA[
+<!ELEMENT height (#PCDATA)>]]>
+</screen>
+ </para>
+ <para>
+ The height of the window in the particular region.
+ </para>
+ <para>
+<screen><![CDATA[
+<!ELEMENT listener (#PCDATA)>]]>
+</screen>
+ </para>
+ <para>
+ Define a listener for a portal object. The value is the id of the listener.
+ </para>
+</listitem>
+</varlistentry>
+<varlistentry><term><screen><![CDATA[
+<!ELEMENT content (content-type,content-uri)>]]>
+</screen></term>
+<listitem>
+ <para>
+ Define the content of the window in a generic manner. The content is define by the type of the content and an URI which acts as an identificator for the content.
+ </para>
+ <para>
+ The following is an example of the <computeroutput><content></computeroutput> element:
+ </para>
+ <para>
+<screen><![CDATA[
<content>
<content-type>portlet</content-type>
<content-uri>MyPortletInstance</content-uri>
@@ -744,50 +794,74 @@
<content>
<content-type>cms</content-type>
<content-uri>/default/index.html</content-uri>
-</content>]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT content-type (#PCDATA)>]]>
-</para><para><programlisting><![CDATA[The content type of the window.]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT content-uri (#PCDATA)>]]>
-</para><para><programlisting><![CDATA[The content URI of the window.]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT region (#PCDATA)>]]>
-</para><para><programlisting><![CDATA[The region the window belongs to.]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT height (#PCDATA)>]]>
-</para><para><programlisting><![CDATA[The height of the window in the particular region.]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT listener (#PCDATA)>]]>
-</para><para><programlisting><![CDATA[Define a listener for a portal object. The value is the id of the listener.]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT properties (property*)>]]>
-</para><para><programlisting><![CDATA[A set of generic properties for the portal object.]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT property (name,value)>]]>
-</para><para><programlisting><![CDATA[A generic string property.]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT name (#PCDATA)>]]>
-</para><para><programlisting><![CDATA[A name value.]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT value (#PCDATA)>]]>
-</para><para><programlisting><![CDATA[A value.]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT security-constraint (policy-permission*)>]]>
-</para><para><programlisting><![CDATA[The security-constraint element is a container for policy-permission elements
-
-Examples:
-
+</content>]]>
+</screen>
+ </para>
+ <para>
+<screen><![CDATA[
+<!ELEMENT content-type (#PCDATA)>]]>
+</screen>
+ </para>
+ <para>
+ The content type of the window.
+ </para>
+ <para>
+<screen><![CDATA[
+<!ELEMENT content-uri (#PCDATA)>]]>
+</screen>
+ </para>
+ <para>
+ The content URI of the window.
+ </para>
+</listitem>
+</varlistentry>
+<varlistentry><term><screen><![CDATA[
+<!ELEMENT properties (property*)>]]>
+</screen></term>
+<listitem>
+ <para>
+ A set of generic properties for the portal object.
+ </para>
+ <para>
+<screen><![CDATA[
+<!ELEMENT property (name,value)>]]>
+</screen>
+ </para>
+ <para>
+ A generic string property.
+ </para>
+</listitem>
+</varlistentry>
+<varlistentry><term><screen><![CDATA[
+<!ELEMENT name (#PCDATA)>]]>
+</screen></term>
+<listitem>
+ <para>
+ A name value.
+ </para>
+</listitem>
+</varlistentry>
+<varlistentry><term><screen><![CDATA[
+<!ELEMENT value (#PCDATA)>]]>
+</screen></term>
+<listitem>
+ <para>
+ A value.
+ </para>
+</listitem>
+</varlistentry>
+<varlistentry><term><screen><![CDATA[
+<!ELEMENT security-constraint (policy-permission*)>]]>
+</screen></term>
+<listitem>
+ <para>
+ The security-constraint element is a container for policy-permission elements
+ </para>
+ <para>
+ The following is an example of the <computeroutput><security-constraint></computeroutput> element:
+ </para>
+ <para>
+<screen><![CDATA[
<security-constraint>
<policy-permission>
<role-name>User</role-name>
@@ -800,32 +874,55 @@
<unchecked/>
<action-name>view</action-name>
</policy-permission>
-</security-constraint>]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT policy-permission (action-name*,unchecked?,role-name*)>]]>
-</para><para><programlisting><![CDATA[The policy-permission element is used to secure a specific portal page based on a user's role.]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT action-name (#PCDATA)>]]>
-</para><para><programlisting><![CDATA[The role-name element is used to define a role that this security constraint will apply to
-
- * <role-name>SOMEROLE</role-name> Access to this portal page is limited to the defined role.]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT unchecked EMPTY>]]>
-</para><para><programlisting><![CDATA[The unchecked element is used to define (if present) that anyone can view this portal page]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT role-name (#PCDATA)>]]>
-</para><para><programlisting><![CDATA[The action-name element is used to define the access rights given to the role defined.
-Possible values are:
-
- * view - Users can view the page.]]></programlisting></para>
-</listitem></itemizedlist>
-
- </para>
- </sect2> -->
+</security-constraint>]]>
+</screen>
+ </para>
+</listitem>
+</varlistentry>
+<varlistentry><term><screen><![CDATA[
+<!ELEMENT policy-permission (action-name*,unchecked?,role-name*)>]]>
+</screen></term>
+<listitem>
+ <para>
+ The <computeroutput><policy-permission></computeroutput> element is used to secure a specific portal page based on a user's role.
+ </para>
+ <para>
+<screen><![CDATA[
+<!ELEMENT action-name (#PCDATA)>]]>
+</screen>
+ </para>
+ <para>
+ The <computeroutput><role-name></computeroutput> element is used to define a role that this security constraint will apply to.
+ </para>
+ <para>
+ Example>:Access to this portal page is limited to the defined role.
+ </para>
+ <para>
+<screen>
+<role-name>SOMEROLE</role-name>
+</screen>
+ </para>
+ <para>
+<screen><![CDATA[
+<!ELEMENT unchecked EMPTY>]]>
+</screen>
+ </para>
+ <para>
+ The unchecked element is used to define (if present) that anyone can view this portal page.
+ </para>
+ <para>
+<screen><![CDATA[
+<!ELEMENT role-name (#PCDATA)>]]>
+</screen>
+ </para>
+ <para>
+ The action-name element is used to define the access rights given to the role defined. Possible value is: view - Users can view the page.
+ </para>
+</listitem>
+</varlistentry>
+</variablelist>
+</para>
+ </sect2>
<sect2>
<title>JBoss App DTD</title>
<para>
16 years, 8 months
JBoss Portal SVN: r10122 - modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-26 15:03:02 -0500 (Tue, 26 Feb 2008)
New Revision: 10122
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java
Log:
make final 2 methods (just in case of)
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java 2008-02-26 19:59:17 UTC (rev 10121)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java 2008-02-26 20:03:02 UTC (rev 10122)
@@ -515,13 +515,13 @@
// ******
- public void setRequest(ServletRequest servletRequest)
+ public final void setRequest(ServletRequest servletRequest)
{
// That's a trick
dreq.setRequest(servletRequest);
}
- public ServletRequest getRequest()
+ public final ServletRequest getRequest()
{
// That's a trick
return dreq.getRequest();
16 years, 8 months
JBoss Portal SVN: r10121 - modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-26 14:59:17 -0500 (Tue, 26 Feb 2008)
New Revision: 10121
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java
Log:
make dispatched http servlet response not use impl of portlet API in order to work with wrappers
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java 2008-02-26 18:15:26 UTC (rev 10120)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java 2008-02-26 19:59:17 UTC (rev 10121)
@@ -26,6 +26,7 @@
import org.jboss.portal.portlet.impl.jsr168.api.StateAwareResponseImpl;
import javax.portlet.PortletResponse;
+import javax.portlet.MimeResponse;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
@@ -186,15 +187,9 @@
public static final class StateAware extends DispatchedHttpServletResponse
{
- /** . */
- private final StateAwareResponseImpl saresp;
-
public StateAware(DispatchedHttpServletRequest req, StateAwareResponseImpl saresp, HttpServletResponse dresp)
{
super(req, saresp, dresp);
-
- //
- this.saresp = saresp;
}
// Must return null
@@ -289,7 +284,7 @@
{
/** . */
- private final MimeResponseImpl mresp;
+ private final MimeResponse mresp;
/** . */
private ServletOutputStream sos;
16 years, 8 months
JBoss Portal SVN: r10120 - in modules/portlet/trunk/portlet/src: test/java/org/jboss/portal/test/portlet/jsr168/api/portletpreferences and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-26 13:15:26 -0500 (Tue, 26 Feb 2008)
New Revision: 10120
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletPreferencesImpl.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/api/portletpreferences/ZeroLengthArrayValueTestCase.java
Log:
change wrong interpretation of the spec when a prefs has no values
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletPreferencesImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletPreferencesImpl.java 2008-02-26 13:54:30 UTC (rev 10119)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletPreferencesImpl.java 2008-02-26 18:15:26 UTC (rev 10120)
@@ -198,13 +198,21 @@
throw new IllegalArgumentException("key must not be null");
}
Value value = getValue(key);
- if (value != null)
+// if (value != null)
+// {
+// return value.asStringArray();
+// }
+// else
+// {
+// return def;
+// }
+ if (value == null || value.isEmpty())
{
- return value.asStringArray();
+ return def;
}
else
{
- return def;
+ return value.asStringArray();
}
}
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/api/portletpreferences/ZeroLengthArrayValueTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/api/portletpreferences/ZeroLengthArrayValueTestCase.java 2008-02-26 13:54:30 UTC (rev 10119)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/api/portletpreferences/ZeroLengthArrayValueTestCase.java 2008-02-26 18:15:26 UTC (rev 10120)
@@ -62,7 +62,7 @@
// With the default value coming from the portlet.xml descriptor
String value = prefs.getValue("empty", "other");
assertEquals("other", value);
- assertEquals(new String[0], prefs.getValues("empty", new String[]{"other"}));
+ assertEquals(new String[]{"other"}, prefs.getValues("empty", new String[]{"other"}));
//
PortletURL url = response.createActionURL();
@@ -82,14 +82,14 @@
// Set the value to the empty array and check we get the other value
prefs.setValues("dynamic", new String[0]);
assertEquals("other", prefs.getValue("dynamic", "other"));
- assertEquals(new String[0], prefs.getValues("dynamic", new String[]{"other"}));
+ assertEquals(new String[]{"other"}, prefs.getValues("dynamic", new String[]{"other"}));
// Commit change
prefs.store();
// Check we still have the other value
assertEquals("other", prefs.getValue("dynamic", "other"));
- assertEquals(new String[0], prefs.getValues("dynamic", new String[]{"other"}));
+ assertEquals(new String[]{"other"}, prefs.getValues("dynamic", new String[]{"other"}));
}
});
seq.bindAction(1, UTP2.RENDER_JOIN_POINT, new PortletRenderTestAction()
@@ -100,7 +100,7 @@
// Check we still have the other value
assertEquals("other", prefs.getValue("dynamic", "other"));
- assertEquals(new String[0], prefs.getValues("dynamic", new String[]{"other"}));
+ assertEquals(new String[]{"other"}, prefs.getValues("dynamic", new String[]{"other"}));
//
return new EndTestResponse();
16 years, 8 months
JBoss Portal SVN: r10119 - branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/instance.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-02-26 08:54:30 -0500 (Tue, 26 Feb 2008)
New Revision: 10119
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/instance/InstanceContextImpl.java
Log:
API change
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/instance/InstanceContextImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/instance/InstanceContextImpl.java 2008-02-26 12:05:03 UTC (rev 10118)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/instance/InstanceContextImpl.java 2008-02-26 13:54:30 UTC (rev 10119)
@@ -80,12 +80,12 @@
public void onStateEvent(StateEvent event)
{
- StateEvent.StateEventType type = event.getType();
- if (StateEvent.PORTLET_CLONED_EVENT.equals(type))
+ StateEvent.Type type = event.getType();
+ if (StateEvent.Type.PORTLET_CLONED_EVENT.equals(type))
{
clonedContext = event.getPortletContext();
}
- else if (StateEvent.PORTLET_MODIFIED_EVENT.equals(type))
+ else if (StateEvent.Type.PORTLET_MODIFIED_EVENT.equals(type))
{
modifiedContext = event.getPortletContext();
}
16 years, 8 months
JBoss Portal SVN: r10118 - in modules/portlet/trunk/portlet/src: main/java/org/jboss/portal/portlet/impl/jsr168/api and 5 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-26 07:05:03 -0500 (Tue, 26 Feb 2008)
New Revision: 10118
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletresponses/SetContentTypeAfterStreamIsObtainedTestCase.java
Removed:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/SetContentTypeBeforeOutputStreamOrWriterTestCase.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/MimeResponseImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/RenderResponseImpl.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/FiltersTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromRenderObjectsTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletResourceTestAction.java
Log:
JBPORTAL-1900 : setContentType is now optional in JSR 286
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java 2008-02-26 03:41:50 UTC (rev 10117)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java 2008-02-26 12:05:03 UTC (rev 10118)
@@ -87,11 +87,6 @@
// Must perform no operations
- public final void setContentType(String s)
- {
- //TODO: forward from render should use RenderResponse.setContentType()
- }
-
public final void setContentLength(int i)
{
}
@@ -164,6 +159,8 @@
// Defined by subclasses
+ public abstract void setContentType(String contentType);
+
public abstract String getCharacterEncoding();
public abstract Locale getLocale();
@@ -276,6 +273,10 @@
{
}
+ public void setContentType(String contentType)
+ {
+ }
+
// Must return true for include and false for forward
public boolean isCommitted()
@@ -381,6 +382,11 @@
{
return mresp.getContentType();
}
+
+ public void setContentType(String contentType)
+ {
+ mresp.setContentType(contentType);
+ }
}
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/MimeResponseImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/MimeResponseImpl.java 2008-02-26 03:41:50 UTC (rev 10117)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/MimeResponseImpl.java 2008-02-26 12:05:03 UTC (rev 10118)
@@ -28,23 +28,16 @@
import org.jboss.portal.portlet.invocation.response.RevalidateMarkupResponse;
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.info.CacheInfo;
-import org.jboss.portal.portlet.info.CapabilitiesInfo;
-import org.jboss.portal.portlet.info.ModeInfo;
import org.jboss.portal.portlet.cache.CacheScope;
-import org.jboss.portal.common.util.MediaType;
-import org.jboss.portal.common.util.ContentInfo;
-import org.jboss.portal.Mode;
import javax.portlet.MimeResponse;
import javax.portlet.PortletURL;
import javax.portlet.ResourceURL;
import javax.portlet.CacheControl;
-import javax.activation.MimeTypeParseException;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Locale;
-import java.util.Set;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -62,6 +55,9 @@
/** The cache control. */
protected CacheControlImpl cacheControl;
+ /** . */
+ private boolean contentTypeSet;
+
public MimeResponseImpl(PortletInvocation invocation, PortletRequestImpl preq)
{
super(invocation, preq);
@@ -85,6 +81,7 @@
// 0 means no buffering - we say no buffering
this.bufferSize = 0;
this.fragment = fragment;
+ this.contentTypeSet = false;
}
public PortletInvocationResponse getResponse()
@@ -105,70 +102,37 @@
public String getContentType()
{
- return fragment.getContentType();
+ return contentTypeSet ? fragment.getContentType() : null;
}
public void setContentType(String contentType)
{
- try
+ if (fragment.getContentType() == null)
{
- // Remove the unused appended charset first
- int index = contentType.indexOf(';');
- if (index != -1)
- {
- contentType = contentType.substring(0, index);
- }
-
- // Find the content type among the media type we know
- MediaType requestedMediaType = MediaType.parseMimeType(contentType);
-
- // Get the response media type
-// ContentInfo info = invocation.getContext().getMarkupInfo();
-// MediaType responseMediaType = info.getContentType();
-
- // Check if the requested media type is allowed as a subtype of the main response
-// if (!responseMediaType.isAllowedSubType(requestedMediaType))
-// {
-// throw new IllegalArgumentException("Content type not accepted");
-// }
-
- //
- Mode currentMode = preq.invocation.getMode();
-
- PortletInfo info = preq.container.getInfo();
- CapabilitiesInfo capabilities = info.getCapabilities();
- Set<ModeInfo> compatibleModes = capabilities.getModes(contentType);
- for (ModeInfo modeInfo : compatibleModes)
- {
- if (currentMode.equals(modeInfo.getMode()))
- {
- // Set the content type
- fragment.setContentType(contentType);
-
- //
- return;
- }
- }
-
- //
- throw new IllegalArgumentException("Mime type " + contentType + " not accepted as content type");
-
+ fragment.setContentType(contentType);
+ contentTypeSet = true;
}
- catch (MimeTypeParseException e)
- {
- IllegalArgumentException ex = new IllegalArgumentException("Content type not accepted");
- ex.initCause(e);
- throw ex;
- }
}
public PrintWriter getWriter() throws IOException
{
+ if (fragment.getContentType() == null)
+ {
+ fragment.setContentType(preq.getResponseContentType());
+ }
+
+ //
return fragment.getWriter();
}
public OutputStream getPortletOutputStream() throws IOException
{
+ if (fragment.getContentType() == null)
+ {
+ fragment.setContentType(preq.getResponseContentType());
+ }
+
+ //
return fragment.getOutputStream();
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/RenderResponseImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/RenderResponseImpl.java 2008-02-26 03:41:50 UTC (rev 10117)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/RenderResponseImpl.java 2008-02-26 12:05:03 UTC (rev 10118)
@@ -25,10 +25,15 @@
import org.jboss.portal.portlet.invocation.RenderInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.info.CapabilitiesInfo;
+import org.jboss.portal.portlet.info.ModeInfo;
import org.jboss.portal.Mode;
+import org.jboss.portal.common.util.MediaType;
import javax.portlet.RenderResponse;
import javax.portlet.PortletMode;
+import javax.activation.MimeTypeParseException;
import java.util.Collection;
import java.util.Set;
import java.util.LinkedHashSet;
@@ -87,6 +92,60 @@
}
}
+ public void setContentType(String contentType)
+ {
+ try
+ {
+ // Remove the unused appended charset first
+ int index = contentType.indexOf(';');
+ if (index != -1)
+ {
+ contentType = contentType.substring(0, index);
+ }
+
+ // Find the content type among the media type we know
+ MediaType requestedMediaType = MediaType.parseMimeType(contentType);
+
+ // Get the response media type
+// ContentInfo info = invocation.getContext().getMarkupInfo();
+// MediaType responseMediaType = info.getContentType();
+
+ // Check if the requested media type is allowed as a subtype of the main response
+// if (!responseMediaType.isAllowedSubType(requestedMediaType))
+// {
+// throw new IllegalArgumentException("Content type not accepted");
+// }
+
+ //
+ Mode currentMode = preq.invocation.getMode();
+
+ PortletInfo info = preq.container.getInfo();
+ CapabilitiesInfo capabilities = info.getCapabilities();
+ Set<ModeInfo> compatibleModes = capabilities.getModes(contentType);
+ for (ModeInfo modeInfo : compatibleModes)
+ {
+ if (currentMode.equals(modeInfo.getMode()))
+ {
+ // Set the content type
+ super.setContentType(contentType);
+
+ //
+ return;
+ }
+ }
+
+ //
+ throw new IllegalArgumentException("Mime type " + contentType + " not accepted as content type");
+
+ }
+ catch (MimeTypeParseException e)
+ {
+ IllegalArgumentException ex = new IllegalArgumentException("Content type not accepted");
+ ex.initCause(e);
+ throw ex;
+ }
+ }
+
public PortletInvocationResponse getResponse()
{
PortletInvocationResponse response = super.getResponse();
Deleted: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/SetContentTypeBeforeOutputStreamOrWriterTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/SetContentTypeBeforeOutputStreamOrWriterTestCase.java 2008-02-26 03:41:50 UTC (rev 10117)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/SetContentTypeBeforeOutputStreamOrWriterTestCase.java 2008-02-26 12:05:03 UTC (rev 10118)
@@ -1,85 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.test.portlet.jsr168.tck.portletresponses;
-
-import org.jboss.portal.unit.PortletTestCase;
-import org.jboss.portal.unit.PortletTestContext;
-import org.jboss.portal.unit.actions.PortletRenderTestAction;
-import org.jboss.portal.test.portlet.framework.UTP1;
-import org.jboss.portal.unit.annotations.TestCase;
-import org.jboss.portal.unit.Assertion;
-import org.jboss.portal.unit.PortletTestContext;
-import org.jboss.unit.driver.DriverResponse;
-import org.jboss.unit.driver.response.EndTestResponse;
-import static org.jboss.unit.api.Assert.fail;
-import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
-
-import javax.portlet.Portlet;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import java.io.IOException;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-(a)TestCase({Assertion.JSR168_77})
-public class SetContentTypeBeforeOutputStreamOrWriterTestCase
-{
- public SetContentTypeBeforeOutputStreamOrWriterTestCase(PortletTestCase seq)
- {
- seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException
- {
- try
- {
- response.getWriter();
- fail();
- }
- catch (IllegalStateException e)
- {
- //expected as no content type was set
- }
- return new InvokeGetResponse(response.createRenderURL().toString());
- }
- });
-
- seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException
- {
- try
- {
- response.getPortletOutputStream();
- fail();
- }
- catch (IllegalStateException e)
- {
- //expected as no content type was set
- }
- return new EndTestResponse();
- }
- });
- }
-}
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/FiltersTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/FiltersTestCase.java 2008-02-26 03:41:50 UTC (rev 10117)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/FiltersTestCase.java 2008-02-26 12:05:03 UTC (rev 10118)
@@ -33,6 +33,7 @@
import org.jboss.unit.driver.response.EndTestResponse;
import static org.jboss.unit.api.Assert.assertNotNull;
import static org.jboss.unit.api.Assert.assertEquals;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
import javax.portlet.Portlet;
import javax.portlet.RenderRequest;
@@ -62,21 +63,42 @@
assertEquals(Tools.toSet("INCLUDE_URL_PATTERN_FILTER", "INCLUDE_NAMED_FILTER"), ServletFilter.ids);
//
- prd = request.getPortletSession().getPortletContext().getNamedDispatcher("NoopServlet");
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ PortletRequestDispatcher prd = request.getPortletSession().getPortletContext().getNamedDispatcher("NoopServlet");
assertNotNull(prd);
ServletFilter.ids.clear();
prd.include(request, response);
assertEquals(Collections.singleton("INCLUDE_NAMED_FILTER"), ServletFilter.ids);
//
- prd = request.getPortletSession().getPortletContext().getRequestDispatcher("/noop");
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+ seq.bindAction(2, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ PortletRequestDispatcher prd = request.getPortletSession().getPortletContext().getRequestDispatcher("/noop");
assertNotNull(prd);
ServletFilter.ids.clear();
prd.forward(request, response);
assertEquals(Tools.toSet("FORWARD_URL_PATTERN_FILTER", "FORWARD_NAMED_FILTER"), ServletFilter.ids);
//
- prd = request.getPortletSession().getPortletContext().getNamedDispatcher("NoopServlet");
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+ seq.bindAction(3, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ PortletRequestDispatcher prd = request.getPortletSession().getPortletContext().getNamedDispatcher("NoopServlet");
assertNotNull(prd);
ServletFilter.ids.clear();
prd.forward(request, response);
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletresponses/SetContentTypeAfterStreamIsObtainedTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletresponses/SetContentTypeAfterStreamIsObtainedTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/portletresponses/SetContentTypeAfterStreamIsObtainedTestCase.java 2008-02-26 12:05:03 UTC (rev 10118)
@@ -0,0 +1,121 @@
+/******************************************************************************
+ * 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.portlet.jsr286.ext.portletresponses;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.unit.actions.PortletResourceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.*;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import java.io.IOException;
+
+/**
+ * Not setting the content type before getting a stream will use the content type defined
+ * by the portlet request response content type.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class SetContentTypeAfterStreamIsObtainedTestCase
+{
+ public SetContentTypeAfterStreamIsObtainedTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ response.getWriter();
+
+ //
+ response.setContentType("text/html");
+
+ //
+ assertNull(response.getContentType());
+
+ //
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ response.getPortletOutputStream();
+
+ //
+ response.setContentType("text/html");
+
+ //
+ assertNull(response.getContentType());
+
+ //
+ return new InvokeGetResponse(response.createResourceURL().toString());
+ }
+ });
+ seq.bindAction(2, UTP1.RESOURCE_JOIN_POINT, new PortletResourceTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, ResourceRequest request, ResourceResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ response.getWriter();
+
+ //
+ response.setContentType("text/html");
+
+ //
+ assertNull(response.getContentType());
+
+ //
+ return new InvokeGetResponse(response.createResourceURL().toString());
+ }
+ });
+ seq.bindAction(3, UTP1.RESOURCE_JOIN_POINT, new PortletResourceTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, ResourceRequest request, ResourceResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ response.getPortletOutputStream();
+
+ //
+ response.setContentType("text/html");
+
+ //
+ assertNull(response.getContentType());
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromRenderObjectsTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromRenderObjectsTestCase.java 2008-02-26 03:41:50 UTC (rev 10117)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromRenderObjectsTestCase.java 2008-02-26 12:05:03 UTC (rev 10118)
@@ -131,7 +131,6 @@
//SPEC:117
//Those should do nothing - some of the getters will be checked later
- response.setContentType("lolo");
response.setContentLength(22);
response.setLocale(Locale.TRADITIONAL_CHINESE);
response.addCookie(new Cookie("lolo", "bobo"));
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletResourceTestAction.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletResourceTestAction.java 2008-02-26 03:41:50 UTC (rev 10117)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/actions/PortletResourceTestAction.java 2008-02-26 12:05:03 UTC (rev 10118)
@@ -93,11 +93,38 @@
}
finally
{
- if (sendResponse && response.getContentType() == null)
+ if (sendResponse)
{
- response.setContentType("text/html");
- Writer writer = response.getWriter();
- IOTools.safeClose(writer);
+ if (response.getContentType() == null)
+ {
+ response.setContentType("text/html");
+ }
+
+ //
+ boolean gotWriter = false;
+ try
+ {
+ Writer writer = response.getWriter();
+ gotWriter = true;
+ IOTools.safeClose(writer);
+ }
+ catch (IllegalStateException ignore)
+ {
+ }
+ if (!gotWriter)
+ {
+ try
+ {
+ OutputStream out = response.getPortletOutputStream();
+ IOTools.safeClose(out);
+ }
+ catch (IllegalStateException ignore)
+ {
+ }
+ catch (IOException ignore)
+ {
+ }
+ }
}
}
}
16 years, 8 months
JBoss Portal SVN: r10117 - docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: mmcallis
Date: 2008-02-25 22:41:50 -0500 (Mon, 25 Feb 2008)
New Revision: 10117
Modified:
docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/xmldescriptors.xml
Log:
6.1.3. The JBoss Portal Object DTD
replacing itemizedlist with variablelist
Note: large section commented out so as not to
break the nightly build
Modified: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/xmldescriptors.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/xmldescriptors.xml 2008-02-26 02:47:19 UTC (rev 10116)
+++ docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/xmldescriptors.xml 2008-02-26 03:41:50 UTC (rev 10117)
@@ -302,7 +302,7 @@
<sect2>
<title>The JBoss Portlet Instance DTD</title>
<para>
- The following items refer to elements found in the JBoss Portlet Instance DTD, <filename>$JBOSS_HOME/server/configuration/deploy/jboss-portal.sar/dtd/portlet-instances_<replaceable>version_number</replaceable>.dtd</filename>:
+ The following items refer to elements found in the JBoss Portlet Instance DTD, <filename>$JBOSS_HOME/server/<replaceable>configuration</replaceable>/deploy/jboss-portal.sar/dtd/portlet-instances_<replaceable>version_number</replaceable>.dtd</filename>:
</para>
<para>
<variablelist>
@@ -487,7 +487,7 @@
</screen>
</para>
<para>
- If present, the <computeroutput><unchecked></computeroutput> element is used to define that anyone can view the instance.
+ If present, the <computeroutput><unchecked></computeroutput> element is used to define that anyone can view this instance.
</para>
<para>
<screen><![CDATA[
@@ -495,7 +495,7 @@
</screen>
</para>
<para>
- The <computeroutput><role-name></computeroutput> element is used to define 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:
+ The <computeroutput><role-name></computeroutput> element is used to define 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 this instance:
</para>
<para>
<screen><![CDATA[
@@ -508,117 +508,187 @@
</para>
</sect2>
<sect2>
- <title>Portal Object DTD</title>
+ <title>The JBoss Portal Object DTD</title>
<para>
-<itemizedlist>
+ The following items refer to elements found in the JBoss Portal Object DTD, <filename>$JBOSS_HOME/server/<replaceable>configuration</replaceable>/deploy/jboss-portal.sar/dtd/portal-object_<replaceable>version_number</replaceable>.dtd</filename>:
+ </para>
+ <para>
+ <variablelist>
+ <varlistentry><term><screen><![CDATA[
+<!ELEMENT deployments (deployment*)>]]>
+</screen></term>
<listitem>
-<para>
-Element <![CDATA[<!ELEMENT deployments (deployment*)>]]>
-</para><para><programlisting><![CDATA[The deployements element is a generic container for deployment elements.]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT deployment (parent-ref,if-exists?,(context | portal | page | window))>]]>
-</para><para><programlisting><![CDATA[The deployment is a generic container for portal object elements. The parent-ref
-child gives the name of the parent object that the current object will use as parent.
-The optional if-exists element define the behavior when a portal object which
-an identical name is already child of the parent element. The default behavior of
-the if-exist tag is to keep the existing object and not create a new object. The
-last element is the portal object itself.
-
-Example:
-
+ <para>
+ The <computeroutput><deployments></computeroutput> element is a container for the <computeroutput><deployment></computeroutput> element.
+ </para>
+</listitem>
+</varlistentry>
+<varlistentry><term><screen><![CDATA[
+<!ELEMENT deployment (parent-ref,if-exists?,(context | portal | page | window))>]]>
+</screen></term>
+<listitem>
+ <para>
+ The <computeroutput><deployment></computeroutput> element is a generic container for portal object elements. The <computeroutput><parent-ref></computeroutput> child gives the name of the parent object that the current object will use as parent. The optional <computeroutput><if-exists></computeroutput> element defines the behavior when a portal object which an identical name is already child of the parent element. The default behavior of the <computeroutput><if-exists></computeroutput> element is to keep the existing object and not create a new object. The last element is the portal object itself.
+ </para>
+ <para>
+ The following is an example of the <computeroutput><deployment></computeroutput> and <computeroutput><parent-ref></computeroutput> elements:
+ </para>
+ <para>
+<screen><![CDATA[
<deployment>
<parent-ref>default</parent-ref>
<page>
...
</page>
-</deployment>
-
-All portal objects have a common configuration which can be :
-
-1/ a listener : specifies the id of a listener is the listener registry. A listener
-object is able to listen portal events which apply to the portal node hierarchy.
-
-2/ properties : a set of generic properties owned by the portal object. Some
-properties can drive the behavior of the object.
-
-3/ security-constraint : defines security configuration of the portal object.]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT parent-ref (#PCDATA)>]]>
-</para><para><programlisting><![CDATA[Contains a reference to the parent object. The naming convention for naming object
-is to concatenate the names of the path to the object and separate the names by a dot.
-If the path is empty then the empty string must be used.
-
-Example:
-
-<parent-ref/> the root having an empty path
-
-<parent-ref>default</parent-ref> the object with the name default under the root
-having the path (default)
-
-<parent-ref>default.default</parent-ref> the object with the path (default,default)]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT if-exists (#PCDATA)>]]>
-</para><para><programlisting><![CDATA[The authorized values are overwrite and keep. Overwrite means that the existing
-object will be destroyed and the current declaration will be used. Keep means that
-the existing object will not be destroyed and no creation hence will be done.]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT context (context-name,properties?,listener?,security-constraint?,portal*)>]]>
-</para><para><programlisting><![CDATA[A portal object of type context. A context type represent a node in the tree which
-does not have a visual representation. It can exist only under the root. A context can
-only have children with the portal type.]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT context-name (#PCDATA)>]]>
-</para><para><programlisting><![CDATA[The context name value.]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT portal (portal-name,supported-modes,supported-window-states?,properties?,listener?,security-constraint?,page*)>]]>
-</para><para><programlisting><![CDATA[
-A portal object of type portal. A portal type represents a virtual portal and can
-have children of type page. In addition of the common portal object elements it support
-also the declaration of the modes and the window states it supports. If no declaration
-of modes or window states is done then the default value will be respectively
-(view,edit,help) and (normal,minimized,maximized).]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT portal-name (#PCDATA)>]]>
-</para><para><programlisting><![CDATA[The portal name value.]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT supported-modes (mode*)>]]>
-</para><para><programlisting><![CDATA[The supported modes of a portal.
-
-Example:
-
+</deployment>]]>
+</screen>
+ </para>
+ <para>
+ All portal objects have a common configuration which can include:
+ </para>
+ <para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ a listener: specifies the id of a listener is the listener registry. A listener object is able to listen portal events which apply to the portal node hierarchy.
+ </para>
+ </listitem>
+ <listitem>
+ <para> properties : a set of generic properties owned by the portal object. Some properties can drive the behavior of the object.
+ </para>
+ </listitem>
+ <listitem>
+ <para> security-constraint : defines security configuration of the portal object.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+<screen><![CDATA[
+<!ELEMENT parent-ref (#PCDATA)>]]>
+</screen>
+ </para>
+ <para>
+ Contains a reference to the parent object. The naming convention for naming object is to concatenate the names of the path to the object and separate the names by a dot. If the path is empty then the empty string must be used. The <computeroutput><parent-ref></computeroutput> element tells the portal where the portlet should appear.
+ </para>
+ <para>
+ The following is an example of the root having an empty path:
+ </para>
+ <para>
+<screen>
+<parent-ref/>
+</screen>
+ </para>
+ <para>
+ The following specifies that the portlet will appear on the <computeroutput>default</computeroutput> page:
+ </para>
+ <para>
+<screen>
+<parent-ref>default</parent-ref>
+</screen>
+ </para>
+ <para>
+ The following specifies that the portlet will apear in the portal instance named <computeroutput>default</computeroutput>, and on the page named <computeroutput>default</computeroutput>:
+ </para>
+ <para>
+<screen>
+<parent-ref>default.default</parent-ref>
+</screen>
+ </para>
+ <para>
+<screen><![CDATA[
+<!ELEMENT if-exists (#PCDATA)>]]>
+</screen>
+ </para>
+ <para>
+ The <computeroutput><if-exists></computeroutput> element is used to define 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 will destroy the existing object and create a new one based on the content of the deployment. The <computeroutput>keep</computeroutput> option will maintain the existing object deployment, or create a new one if it does not exist.
+ </para>
+</listitem>
+</varlistentry>
+<varlistentry><term><screen><![CDATA[
+<!ELEMENT context (context-name,properties?,listener?,security-constraint?,portal*)>]]>
+</screen></term>
+<listitem>
+ <para>
+ A portal object of type context. A context type represent a node in the tree which does not have a visual representation. It can exist only under the root. A context can only have children with the portal type.
+ </para>
+ <para>
+<screen><![CDATA[
+<![CDATA[<!ELEMENT context-name (#PCDATA)>]]>
+</screen>
+ </para>
+ <para>
+ The context name value.
+ </para>
+ <para>
+<screen><![CDATA[
+<![CDATA[<!ELEMENT portal (portal-name,supported-modes,supported-window-states?,properties?,
+listener?,security-constraint?,page*)>]]>
+</screen>
+ </para>
+ <para>
+ A portal object of type portal. A portal type represents a virtual portal and can have children of type page. In addition of the common portal object elements it support also the declaration of the modes and the window states it supports. If no declaration of modes or window states is done then the default value will be respectively (view,edit,help) and (normal,minimized,maximized).
+ </para>
+ <para>
+<screen><![CDATA[
+<!ELEMENT portal-name (#PCDATA)>]]>
+</screen>
+ </para>
+ <para>
+ The portal name value.
+ </para>
+ <para>
+<screen><![CDATA[
+<!ELEMENT supported-modes (mode*)>]]>
+</screen>
+ </para>
+ <para>
+ The supported modes of a portal.
+ </para>
+ <para>
+ The following is an example of the <computeroutput><supported-mode></computeroutput> element:
+ </para>
+ <para>
+<screen><![CDATA[
<supported-mode>
<mode>view</mode>
<mode>edit</mode>
<mode>help</mode>
-</supported-mode>]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT mode (#PCDATA)>]]>
-</para><para><programlisting><![CDATA[
-A portlet mode value.]]></programlisting></para>
-</listitem><listitem>
-<para>
-Element <![CDATA[<!ELEMENT supported-window-states (window-state*)>]]>
-</para><para><programlisting><![CDATA[
-The supported window states of a portal.
-
-Example:
-
+</supported-mode>]]>
+</screen>
+ </para>
+</listitem>
+</varlistentry>
+<varlistentry><term><screen><![CDATA[
+<![CDATA[<!ELEMENT mode (#PCDATA)>]]>
+</screen></term>
+<listitem>
+ <para>
+ A portlet mode value.
+ </para>
+</listitem>
+</varlistentry>
+<varlistentry><term><screen><![CDATA[
+<![CDATA[<!ELEMENT supported-window-states (window-state*)>]]>
+</screen></term>
+<listitem>
+ <para>
+ The supported window states of a portal. The following is an example of the <computeroutput><supported-window-states></computeroutput> element:
+ </para>
+ <para>
+<screen><![CDATA[
<supported-window-states>
<window-state>normal</window-state>
<window-state>minimized</window-state>
<window-state>maximized</window-state>
-</supported-window-states>]]></programlisting></para>
-</listitem><listitem>
-<para>
+</supported-window-states>]]>
+</screen></para>
+</listitem>
+</varlistentry>
+</variablelist>
+</para>
+</sect2>
+<!--<para>
Element <![CDATA[<!ELEMENT window-state (#PCDATA)>]]>
</para><para><programlisting><![CDATA[A window state value.]]></programlisting></para>
</listitem><listitem>
@@ -755,7 +825,7 @@
</listitem></itemizedlist>
</para>
- </sect2>
+ </sect2> -->
<sect2>
<title>JBoss App DTD</title>
<para>
16 years, 8 months
JBoss Portal SVN: r10116 - in modules/portlet/trunk: controller/src/test/java/org/jboss/portal/portlet/controller and 6 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-25 21:47:19 -0500 (Mon, 25 Feb 2008)
New Revision: 10116
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractRendererContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RendererContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RendererContextImpl.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKPageNavigationalStateSerialization.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKPortletControllerContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKRendererContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKStateControllerContext.java
Removed:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKPageRenderer.java
Modified:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/ControllerRequestFactory.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/ControllerRequestParameterMapFactory.java
modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerContextSupport.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractMarkupRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractPortletControllerContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ErrorResponseRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletControllerContextImpl.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RedirectResponseRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/Renderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvocationContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKPageNavigationalState.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKServlet.java
modules/portlet/trunk/test/src/test/build.xml
Log:
improve TCK stuff
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/ControllerRequestFactory.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/ControllerRequestFactory.java 2008-02-26 00:52:13 UTC (rev 10115)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/ControllerRequestFactory.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.controller.impl.request;
-import org.jboss.portal.portlet.controller.state.StateControllerContext;
-import org.jboss.portal.portlet.controller.state.PageNavigationalStateSerialization;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
import org.jboss.portal.portlet.controller.request.ControllerRequest;
@@ -55,15 +53,11 @@
{
/** . */
- private final StateControllerContext stateControllerContext;
+ private final Serialization<PageNavigationalState> serialization;
- /** . */
- private final PageNavigationalStateSerialization serialization;
-
- public ControllerRequestFactory(StateControllerContext stateControllerContext)
+ public ControllerRequestFactory(Serialization<PageNavigationalState> serialization)
{
- this.stateControllerContext = stateControllerContext;
- this.serialization = new PageNavigationalStateSerialization(stateControllerContext);
+ this.serialization = serialization;
}
public ControllerRequest createRequest(WebRequest req)
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/ControllerRequestParameterMapFactory.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/ControllerRequestParameterMapFactory.java 2008-02-26 00:52:13 UTC (rev 10115)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/ControllerRequestParameterMapFactory.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.controller.impl.request;
-import org.jboss.portal.portlet.controller.state.StateControllerContext;
-import org.jboss.portal.portlet.controller.state.PageNavigationalStateSerialization;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.portlet.ContainerURL;
import org.jboss.portal.portlet.ActionURL;
@@ -48,15 +46,11 @@
{
/** . */
- private final StateControllerContext stateControllerContext;
+ private final Serialization<PageNavigationalState> serialization;
- /** . */
- private final PageNavigationalStateSerialization serialization;
-
- public ControllerRequestParameterMapFactory(StateControllerContext stateControllerContext)
+ public ControllerRequestParameterMapFactory(Serialization<PageNavigationalState> serialization)
{
- this.stateControllerContext = stateControllerContext;
- this.serialization = new PageNavigationalStateSerialization(stateControllerContext);
+ this.serialization = serialization;
}
public Map<String, String> blah(PageNavigationalState pageNS, String windowId, ContainerURL containerURL)
Modified: modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerContextSupport.java
===================================================================
--- modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerContextSupport.java 2008-02-26 00:52:13 UTC (rev 10115)
+++ modules/portlet/trunk/controller/src/test/java/org/jboss/portal/portlet/controller/PortletControllerContextSupport.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -33,16 +33,12 @@
import org.jboss.portal.portlet.invocation.ResourceInvocation;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.NoSuchPortletException;
import org.jboss.portal.portlet.PortletContext;
-import org.jboss.portal.portlet.support.info.PortletInfoSupport;
import org.jboss.portal.portlet.support.PortletInvokerSupport;
import org.jboss.portal.portlet.support.PortletSupport;
import javax.servlet.http.Cookie;
import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java 2008-02-26 00:52:13 UTC (rev 10115)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -31,6 +31,8 @@
import org.jboss.portal.portlet.test.controller.PageRenderer;
import org.jboss.portal.portlet.test.controller.PortletControllerContextImpl;
import org.jboss.portal.portlet.test.controller.Renderer;
+import org.jboss.portal.portlet.test.controller.AbstractRendererContext;
+import org.jboss.portal.portlet.test.controller.RendererContextImpl;
import org.jboss.portal.web.WebRequest;
import javax.servlet.ServletException;
@@ -83,7 +85,7 @@
if (URLParameterConstants.PORTLET_TYPE.equals(type))
{
WebRequest wr = new WebRequest(req);
- ControllerRequestFactory factory = new ControllerRequestFactory(context.getStateControllerContext());
+ ControllerRequestFactory factory = new ControllerRequestFactory(context.getPageNavigationalStateSerialization());
ControllerRequest request = factory.createRequest(wr);
//
@@ -93,7 +95,7 @@
Renderer renderer = ControllerResponseRendererFactory.getRenderer(response);
//
- renderer.render(context);
+ renderer.render(new RendererContextImpl(context));
}
else
{
@@ -101,7 +103,7 @@
PageRenderer renderer = new PageRenderer(new ResponseProperties(), context.getStateControllerContext().createPageState(false));
//
- renderer.render(context);
+ renderer.render(new RendererContextImpl(context));
}
}
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractMarkupRenderer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractMarkupRenderer.java 2008-02-26 00:52:13 UTC (rev 10115)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractMarkupRenderer.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -47,7 +47,7 @@
this.properties = properties;
}
- public void render(PortletControllerContextImpl context) throws IOException
+ public void render(RendererContext context) throws IOException
{
prepareRendering(context);
HttpServletResponse resp = context.getClientResponse();
@@ -85,7 +85,7 @@
}
}
- protected void prepareRendering(PortletControllerContextImpl context)
+ protected void prepareRendering(RendererContext context)
{
// default behavior does nothing
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractPortletControllerContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractPortletControllerContext.java 2008-02-26 00:52:13 UTC (rev 10115)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractPortletControllerContext.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -25,10 +25,12 @@
import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.common.util.MediaType;
+import org.jboss.portal.common.io.Serialization;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.controller.PortletControllerContext;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.controller.state.PageNavigationalStateSerialization;
import org.jboss.portal.portlet.impl.spi.AbstractClientContext;
import org.jboss.portal.portlet.impl.spi.AbstractRequestContext;
import org.jboss.portal.portlet.impl.spi.AbstractSecurityContext;
@@ -113,6 +115,8 @@
protected abstract PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException;
+ protected abstract Serialization<PageNavigationalState> getPageNavigationalStateSerialization();
+
public PortletInvocationResponse invoke(ActionInvocation actionInvocation) throws PortletInvokerException
{
@@ -182,6 +186,6 @@
public PortletInvocationContext createPortletInvocationContext(String windowId, PageNavigationalState pageState)
{
- return new TestPortletInvocationContext(getStateControllerContext(), req, resp, windowId, pageState, MARKUP_INFO);
+ return new TestPortletInvocationContext(getPageNavigationalStateSerialization(), req, resp, windowId, pageState, MARKUP_INFO);
}
}
\ No newline at end of file
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractRendererContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractRendererContext.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/AbstractRendererContext.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -0,0 +1,67 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.test.controller;
+
+import org.jboss.portal.portlet.controller.PortletControllerContext;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.PortletInvokerException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class AbstractRendererContext implements RendererContext
+{
+
+ /** . */
+ private final AbstractPortletControllerContext portletControllerContext;
+
+ public AbstractRendererContext(AbstractPortletControllerContext portletControllerContext)
+ {
+ this.portletControllerContext = portletControllerContext;
+ }
+
+ public HttpServletRequest getClientRequest()
+ {
+ return portletControllerContext.getClientRequest();
+ }
+
+ public HttpServletResponse getClientResponse()
+ {
+ return portletControllerContext.getClientResponse();
+ }
+
+ public PortletControllerContext getPortletControllerContext()
+ {
+ return portletControllerContext;
+ }
+
+ public PortletInvocationResponse render(RenderInvocation render) throws PortletInvokerException
+ {
+ return portletControllerContext.invoke(render);
+ }
+}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ErrorResponseRenderer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ErrorResponseRenderer.java 2008-02-26 00:52:13 UTC (rev 10115)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/ErrorResponseRenderer.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -46,7 +46,7 @@
this.response = response;
}
- public void render(PortletControllerContextImpl context) throws IOException
+ public void render(RendererContext context) throws IOException
{
if (response.getCause() != null)
{
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderer.java 2008-02-26 00:52:13 UTC (rev 10115)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PageRenderer.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -44,7 +44,6 @@
import org.jboss.portal.portlet.invocation.response.ResponseProperties;
import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
-import org.jboss.portal.portlet.controller.PortletControllerContext;
import org.w3c.dom.Element;
import javax.servlet.http.HttpServletRequest;
@@ -125,7 +124,7 @@
writer.print("</body></html>");
}
- protected void prepareRendering(PortletControllerContextImpl context)
+ protected void prepareRendering(RendererContext context)
{
// What we collect during the different renders
@@ -134,90 +133,88 @@
ResponseProperties renderProperties = new ResponseProperties();
//
- try
- {
- Collection<Portlet> portlets = ((PortletControllerContextImpl)context).getPortlets();
+ Collection<Portlet> portlets = context.getPortlets();
- int capacity = portlets.size();
- fragments = new ArrayList<FragmentResponse>(capacity);
- errors = new ArrayList<ErrorResponse>(capacity);
+ int capacity = portlets.size();
+ fragments = new ArrayList<FragmentResponse>(capacity);
+ errors = new ArrayList<ErrorResponse>(capacity);
- for (Portlet portlet : portlets)
- {
- WindowNavigationalState windowNS = pageState.getWindowNavigationalState(portlet.getContext().getId());
+ for (Portlet portlet : portlets)
+ {
+ WindowNavigationalState windowNS = pageState.getWindowNavigationalState(portlet.getContext().getId());
- //
- Mode mode = Mode.VIEW;
- WindowState windowState = WindowState.NORMAL;
- StateString portletNS = null;
+ //
+ Mode mode = Mode.VIEW;
+ WindowState windowState = WindowState.NORMAL;
+ StateString portletNS = null;
- //
- if (windowNS != null)
+ //
+ if (windowNS != null)
+ {
+ if (windowNS.getMode() != null)
{
- if (windowNS.getMode() != null)
- {
- mode = windowNS.getMode();
- }
- if (windowNS.getWindowState() != null)
- {
- windowState = windowNS.getWindowState();
- }
- if (windowNS.getPortletNavigationalState() != null)
- {
- portletNS = windowNS.getPortletNavigationalState();
- }
+ mode = windowNS.getMode();
}
+ if (windowNS.getWindowState() != null)
+ {
+ windowState = windowNS.getWindowState();
+ }
+ if (windowNS.getPortletNavigationalState() != null)
+ {
+ portletNS = windowNS.getPortletNavigationalState();
+ }
+ }
- //
- ParameterMap publicNS = pageState.getPublicNavigationalState(portlet.getContext().getId());
+ //
+ ParameterMap publicNS = pageState.getPublicNavigationalState(portlet.getContext().getId());
- RenderInvocation render = createRenderInvocation(context, properties, pageState, portlet, windowNS, mode, windowState, portletNS, publicNS);
+ RenderInvocation render = createRenderInvocation(context, properties, pageState, portlet, windowNS, mode, windowState, portletNS, publicNS);
- //
- try
+ //
+ try
+ {
+ PortletInvocationResponse response = context.render(render);
+
+ if (response instanceof FragmentResponse)
{
- PortletInvocationResponse response = ((PortletControllerContextImpl)context).invoke(render);
+ FragmentResponse fragment = (FragmentResponse)response;
- if (response instanceof FragmentResponse)
- {
- FragmentResponse fragment = (FragmentResponse)response;
+ //
+ fragments.add(fragment);
- //
- fragments.add(fragment);
-
- //
- ResponseProperties fragmentProperties = fragment.getProperties();
- if (fragmentProperties != null)
- {
- renderProperties.append(fragmentProperties);
- }
- }
- else if (response instanceof ErrorResponse)
+ //
+ ResponseProperties fragmentProperties = fragment.getProperties();
+ if (fragmentProperties != null)
{
- ErrorResponse error = (ErrorResponse)response;
- errors.add(error);
+ renderProperties.append(fragmentProperties);
}
-
}
- catch (PortletInvokerException e)
+ else if (response instanceof ErrorResponse)
{
- e.printStackTrace();
+ ErrorResponse error = (ErrorResponse)response;
+ errors.add(error);
}
}
+ catch (PortletInvokerException e)
+ {
+ e.printStackTrace();
+ }
}
- catch (PortletInvokerException e)
- {
- // todo
- e.printStackTrace();
- }
// Now we combine the render properties with the page properties
properties.append(renderProperties);
}
protected RenderInvocation createRenderInvocation(
- PortletControllerContextImpl context, ResponseProperties pageProperties, PageNavigationalState pageNS, Portlet portlet,
- WindowNavigationalState windowNS, Mode mode, WindowState windowState, StateString portletNS, ParameterMap publicNS)
+ RendererContext context,
+ ResponseProperties pageProperties,
+ PageNavigationalState pageNS,
+ Portlet portlet,
+ WindowNavigationalState windowNS,
+ Mode mode,
+ WindowState windowState,
+ StateString portletNS,
+ ParameterMap publicNS)
{
HttpServletRequest req = context.getClientRequest();
HttpServletResponse resp = context.getClientResponse();
@@ -225,7 +222,7 @@
//
TestInstanceContext instanceContext = new TestInstanceContext(req, portlet.getContext(), false);
- PortletInvocationContext renderContext = context.createPortletInvocationContext(portlet.getContext().getId(), pageNS);
+ PortletInvocationContext renderContext = context.getPortletControllerContext().createPortletInvocationContext(portlet.getContext().getId(), pageNS);
//
RenderInvocation render = new RenderInvocation(renderContext);
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletControllerContextImpl.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletControllerContextImpl.java 2008-02-26 00:52:13 UTC (rev 10115)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletControllerContextImpl.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -31,9 +31,12 @@
import org.jboss.portal.portlet.controller.impl.event.EventControllerContextImpl;
import org.jboss.portal.portlet.controller.impl.state.StateControllerContextImpl;
import org.jboss.portal.portlet.controller.state.StateControllerContext;
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.controller.state.PageNavigationalStateSerialization;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.web.IllegalRequestException;
+import org.jboss.portal.common.io.Serialization;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
@@ -57,6 +60,9 @@
/** . */
private final StateControllerContext stateControllerContext;
+ /** . */
+ private final Serialization<PageNavigationalState> serialization;
+
public PortletControllerContextImpl(HttpServletRequest req, HttpServletResponse resp, ServletContext servletContext)
throws IllegalRequestException, IOException, ClassNotFoundException
{
@@ -66,6 +72,7 @@
this.invoker = (PortletInvoker)servletContext.getAttribute("ConsumerPortletInvoker");
this.eventControllerContext = new EventControllerContextImpl(invoker);
this.stateControllerContext = new StateControllerContextImpl(this);
+ this.serialization = new PageNavigationalStateSerialization(stateControllerContext);
}
protected Portlet getPortlet(String windowId) throws PortletInvokerException
@@ -93,4 +100,8 @@
return invoker.getPortlets();
}
+ public Serialization<PageNavigationalState> getPageNavigationalStateSerialization()
+ {
+ return serialization;
+ }
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java 2008-02-26 00:52:13 UTC (rev 10115)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -25,14 +25,13 @@
import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.common.io.SerializationFilter;
+import org.jboss.portal.common.io.Serialization;
import org.jboss.portal.common.text.CharBuffer;
import org.jboss.portal.common.text.FastURLEncoder;
import org.jboss.portal.common.util.Base64;
import org.jboss.portal.portlet.ContainerURL;
import org.jboss.portal.portlet.URLFormat;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
-import org.jboss.portal.portlet.controller.state.PageNavigationalStateSerialization;
-import org.jboss.portal.portlet.controller.state.StateControllerContext;
import org.jboss.portal.portlet.controller.impl.request.ControllerRequestParameterNames;
import org.jboss.portal.portlet.controller.impl.request.ControllerRequestParameterMapFactory;
import static org.jboss.portal.portlet.test.URLParameterConstants.*;
@@ -50,12 +49,9 @@
{
/** . */
- final StateControllerContext stateContext;
+ final Serialization<PageNavigationalState> serialization;
/** . */
- final PageNavigationalStateSerialization serialization;
-
- /** . */
final HttpServletRequest clientReq;
/** . */
@@ -65,16 +61,15 @@
final PageNavigationalState pageNS;
public PortletURLRenderer(
- StateControllerContext stateContext,
PageNavigationalState pageNS,
HttpServletRequest clientReq,
- HttpServletResponse clientResp)
+ HttpServletResponse clientResp,
+ Serialization<PageNavigationalState> serialization)
{
- this.stateContext = stateContext;
this.pageNS = pageNS;
this.clientReq = clientReq;
this.clientResp = clientResp;
- this.serialization = new PageNavigationalStateSerialization(stateContext);
+ this.serialization = serialization;
}
private String renderURL(Map<String, String> parameters, URLFormat format)
@@ -141,7 +136,7 @@
public String renderURL(String windowId, ContainerURL containerURL, URLFormat format)
{
- ControllerRequestParameterMapFactory factory = new ControllerRequestParameterMapFactory(stateContext);
+ ControllerRequestParameterMapFactory factory = new ControllerRequestParameterMapFactory(serialization);
//
Map<String, String> parameters = factory.blah(pageNS, windowId, containerURL);
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RedirectResponseRenderer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RedirectResponseRenderer.java 2008-02-26 00:52:13 UTC (rev 10115)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RedirectResponseRenderer.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -42,7 +42,7 @@
this.response = response;
}
- public void render(PortletControllerContextImpl context) throws IOException
+ public void render(RendererContext context) throws IOException
{
context.getClientResponse().sendRedirect(response.getLocation());
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/Renderer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/Renderer.java 2008-02-26 00:52:13 UTC (rev 10115)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/Renderer.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -33,5 +33,5 @@
*/
public interface Renderer
{
- void render(PortletControllerContextImpl context) throws IOException;
+ void render(RendererContext context) throws IOException;
}
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RendererContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RendererContext.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RendererContext.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -0,0 +1,52 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.test.controller;
+
+import org.jboss.portal.portlet.controller.PortletControllerContext;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface RendererContext
+{
+
+ HttpServletRequest getClientRequest();
+
+ HttpServletResponse getClientResponse();
+
+ PortletControllerContext getPortletControllerContext();
+
+ Collection<Portlet> getPortlets();
+
+ PortletInvocationResponse render(RenderInvocation render) throws PortletInvokerException;
+
+}
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RendererContextImpl.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RendererContextImpl.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/RendererContextImpl.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -0,0 +1,52 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.test.controller;
+
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class RendererContextImpl extends AbstractRendererContext
+{
+
+ /** . */
+ private final Collection<Portlet> portlets;
+
+ public RendererContextImpl(PortletControllerContextImpl portletControllerContext) throws PortletInvokerException
+ {
+ super(portletControllerContext);
+
+ //
+ this.portlets = portletControllerContext.getPortlets();
+ }
+
+ public Collection<Portlet> getPortlets()
+ {
+ return portlets;
+ }
+}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvocationContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvocationContext.java 2008-02-26 00:52:13 UTC (rev 10115)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/TestPortletInvocationContext.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -26,10 +26,10 @@
import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
import org.jboss.portal.common.invocation.resolver.PrincipalAttributeResolver;
import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.common.io.Serialization;
import org.jboss.portal.portlet.ContainerURL;
import org.jboss.portal.portlet.URLFormat;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
-import org.jboss.portal.portlet.controller.state.StateControllerContext;
import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
import org.jboss.portal.portlet.invocation.PortletInvocation;
@@ -44,25 +44,19 @@
{
/** . */
- private final StateControllerContext stateContext;
-
- /** . */
private final PortletURLRenderer urlRenderer;
/** . */
private final String windowId;
/** . */
- private final PageNavigationalState pageState;
-
- /** . */
private final HttpServletRequest clientRequest;
/** . */
private final HttpServletResponse clientResponse;
public TestPortletInvocationContext(
- StateControllerContext stateContext,
+ Serialization<PageNavigationalState> serialization,
HttpServletRequest clientRequest,
HttpServletResponse clientResponse,
String windowId,
@@ -72,12 +66,10 @@
super(markupInfo);
//
- this.stateContext = stateContext;
this.clientRequest = clientRequest;
this.clientResponse = clientResponse;
this.windowId = windowId;
- this.pageState = pageState;
- this.urlRenderer = new PortletURLRenderer(stateContext, pageState, clientRequest, clientResponse);
+ this.urlRenderer = new PortletURLRenderer(pageState, clientRequest, clientResponse, serialization);
//
addResolver(PortletInvocation.PRINCIPAL_SCOPE, new PrincipalAttributeResolver(clientRequest));
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-26 00:52:13 UTC (rev 10115)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -35,7 +35,6 @@
import org.jboss.portal.portlet.controller.impl.request.ControllerRequestFactory;
import org.jboss.portal.portlet.controller.request.ControllerRequest;
import org.jboss.portal.portlet.controller.impl.request.ControllerRequestParameterNames;
-import org.jboss.portal.portlet.controller.impl.state.StateControllerContextImpl;
import org.jboss.portal.portlet.controller.response.ControllerResponse;
import org.jboss.portal.portlet.controller.response.PageUpdateResponse;
import org.jboss.portal.portlet.controller.response.ResourceResponse;
@@ -114,7 +113,7 @@
if (URLParameterConstants.PORTLET_TYPE.equals(type))
{
WebRequest wr = new WebRequest(req);
- ControllerRequestFactory factory = new ControllerRequestFactory(context.getStateControllerContext());
+ ControllerRequestFactory factory = new ControllerRequestFactory(context.getPageNavigationalStateSerialization());
ControllerRequest request = factory.createRequest(wr);
ControllerResponse controllerResponse;
@@ -137,10 +136,10 @@
{
//
PortletURLRenderer renderer = new PortletURLRenderer(
- (StateControllerContextImpl)context.getStateControllerContext(),
pageUpdate.getPageState(),
context.getClientRequest(),
- context.getClientResponse());
+ context.getClientResponse(),
+ context.getPageNavigationalStateSerialization());
//
String url = renderer.renderURL(new URLFormat(null, null, true, null));
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java 2008-02-26 00:52:13 UTC (rev 10115)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PagePortletControllerContext.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -28,11 +28,14 @@
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.controller.event.EventControllerContext;
import org.jboss.portal.portlet.controller.state.StateControllerContext;
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.controller.state.PageNavigationalStateSerialization;
import org.jboss.portal.portlet.controller.impl.state.StateControllerContextImpl;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.test.controller.AbstractPortletControllerContext;
import org.jboss.portal.web.IllegalRequestException;
+import org.jboss.portal.common.io.Serialization;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
@@ -56,6 +59,9 @@
private final StateControllerContext stateControllerContext;
/** . */
+ private final Serialization<PageNavigationalState> serialization;
+
+ /** . */
private final PortalPrepareResponse prepareResponse;
/** . */
@@ -91,6 +97,7 @@
this.prepareResponse = prepareResponse;
this.stateControllerContext = new StateControllerContextImpl(this);
this.eventControllerContext = new PageEventControllerContext(this, prepareResponse);
+ this.serialization = new PageNavigationalStateSerialization(stateControllerContext);
}
public Portlet findPortlet(String applicationName, String portletName)
@@ -121,6 +128,11 @@
return stateControllerContext;
}
+ public Serialization<PageNavigationalState> getPageNavigationalStateSerialization()
+ {
+ return serialization;
+ }
+
private static class Key
{
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java 2008-02-26 00:52:13 UTC (rev 10115)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletURLTag.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -27,7 +27,6 @@
import org.jboss.portal.portlet.test.jsp.PortalRenderResponse;
import org.jboss.portal.portlet.test.jsp.PagePortletControllerContext;
import org.jboss.portal.portlet.test.controller.PortletURLRenderer;
-import org.jboss.portal.portlet.controller.impl.state.StateControllerContextImpl;
import org.jboss.portal.portlet.RenderURL;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.URLFormat;
@@ -95,10 +94,10 @@
}
PortletURLRenderer renderer = new PortletURLRenderer(
- context.getStateControllerContext(),
renderResponse.getPageState(),
context.getClientRequest(),
- context.getClientResponse());
+ context.getClientResponse(),
+ context.getPageNavigationalStateSerialization());
final WindowState ws = windowState;
final Mode md = mode;
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKPageNavigationalState.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKPageNavigationalState.java 2008-02-26 00:52:13 UTC (rev 10115)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKPageNavigationalState.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -24,39 +24,79 @@
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
-import org.jboss.portal.portlet.controller.impl.state.StateControllerContextImpl;
-import org.jboss.portal.portlet.controller.impl.state.PageNavigationalStateImpl;
-import org.jboss.portal.portlet.info.PortletInfo;
-import org.jboss.portal.portlet.info.ParameterInfo;
-import org.jboss.portal.portlet.info.NavigationInfo;
-import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.common.util.ParameterMap;
import javax.xml.namespace.QName;
-import java.io.Serializable;
import java.util.Map;
+import java.util.Set;
import java.util.HashMap;
-import java.util.Set;
-import java.util.List;
-import java.util.Collection;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public class TCKPageNavigationalState extends PageNavigationalStateImpl
+public class TCKPageNavigationalState implements PageNavigationalState
{
- Collection<Portlet> involvedPortlets;
+ /** . */
+ final PageNavigationalState defaultState;
- public TCKPageNavigationalState(StateControllerContextImpl context, boolean modifiable, Collection<Portlet> involvedPortlets)
+ /** . */
+ final Set<String> involvedPortlets;
+
+ public TCKPageNavigationalState(PageNavigationalState defaultState, Set<String> involvedPortlets)
{
- super(context, modifiable);
+ this.defaultState = defaultState;
this.involvedPortlets = involvedPortlets;
}
- public Collection<Portlet> getInvolvedPortlets()
+ public Set<String> getInvolvedPortlets()
{
return involvedPortlets;
}
+
+ public Set<String> getWindowIds()
+ {
+ return defaultState.getWindowIds();
+ }
+
+ public WindowNavigationalState getWindowNavigationalState(String windowId) throws IllegalArgumentException
+ {
+ return defaultState.getWindowNavigationalState(windowId);
+ }
+
+ public void setWindowNavigationalState(String windowId, WindowNavigationalState windowState) throws IllegalArgumentException, IllegalStateException
+ {
+ defaultState.setWindowNavigationalState(windowId, windowState);
+ }
+
+ public ParameterMap getPublicNavigationalState(String windowId) throws IllegalArgumentException
+ {
+ return defaultState.getPublicNavigationalState(windowId);
+ }
+
+ public Set<QName> getPublicNames()
+ {
+ return defaultState.getPublicNames();
+ }
+
+ public void setPublicNavigationalState(String windowId, Map<String, String[]> update) throws IllegalArgumentException, IllegalStateException
+ {
+ defaultState.setPublicNavigationalState(windowId, update);
+ }
+
+ public String[] getPublicNavigationalState(QName name) throws IllegalArgumentException
+ {
+ return defaultState.getPublicNavigationalState(name);
+ }
+
+ public void setPublicNavigationalState(QName name, String[] value) throws IllegalArgumentException, IllegalStateException
+ {
+ defaultState.setPublicNavigationalState(name, value);
+ }
+
+ public void removePublicNavigationalState(QName name) throws IllegalArgumentException, IllegalStateException
+ {
+ defaultState.removePublicNavigationalState(name);
+ }
}
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKPageNavigationalStateSerialization.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKPageNavigationalStateSerialization.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKPageNavigationalStateSerialization.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -0,0 +1,93 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.test.tck;
+
+import org.jboss.portal.portlet.controller.state.PageNavigationalStateSerialization;
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.common.io.Serialization;
+
+import java.io.OutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.DataOutputStream;
+import java.io.DataInputStream;
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class TCKPageNavigationalStateSerialization implements Serialization<PageNavigationalState>
+{
+
+ /** . */
+ private final PageNavigationalStateSerialization defaultSerialization;
+
+ public TCKPageNavigationalStateSerialization(TCKStateControllerContext context)
+ {
+ this.defaultSerialization = new PageNavigationalStateSerialization(context.defaultStateControllerContext);
+ }
+
+ public void serialize(PageNavigationalState pageNavigationalState, OutputStream out) throws IOException, IllegalArgumentException
+ {
+ TCKPageNavigationalState tckPageNavigationalState = (TCKPageNavigationalState)pageNavigationalState;
+
+ //
+ DataOutputStream data = out instanceof DataOutputStream ? (DataOutputStream)out : new DataOutputStream(out);
+
+ //
+ defaultSerialization.serialize(tckPageNavigationalState.defaultState, out);
+
+ //
+ data.writeInt(tckPageNavigationalState.involvedPortlets.size());
+ for (String involvedPortlet : tckPageNavigationalState.involvedPortlets)
+ {
+ data.writeUTF(involvedPortlet);
+ }
+
+ // Need a flush
+ data.flush();
+ }
+
+ public PageNavigationalState unserialize(InputStream in) throws IOException, IllegalArgumentException
+ {
+ //
+ DataInputStream data = in instanceof DataInputStream ? (DataInputStream)in : new DataInputStream(in);
+
+ //
+ PageNavigationalState defaultState = defaultSerialization.unserialize(in);
+
+ //
+ int size = data.readInt();
+ Set<String> involvedPortlets = new HashSet<String>(size);
+ while (size-- > 0)
+ {
+ String involvedPortlet = data.readUTF();
+ involvedPortlets.add(involvedPortlet);
+ }
+
+ //
+ return new TCKPageNavigationalState(defaultState, involvedPortlets);
+ }
+}
Deleted: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKPageRenderer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKPageRenderer.java 2008-02-26 00:52:13 UTC (rev 10115)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKPageRenderer.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -1,146 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.portal.portlet.test.tck;
-
-import org.jboss.portal.portlet.test.controller.PageRenderer;
-import org.jboss.portal.portlet.test.controller.PortletControllerContextImpl;
-import org.jboss.portal.portlet.invocation.response.ResponseProperties;
-import org.jboss.portal.portlet.invocation.response.FragmentResponse;
-import org.jboss.portal.portlet.invocation.response.ErrorResponse;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.controller.state.PageNavigationalState;
-import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
-import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-import org.jboss.portal.common.util.ParameterMap;
-
-import java.util.Collection;
-import java.util.ArrayList;
-
-/**
- * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class TCKPageRenderer extends PageRenderer
-{
- TCKPageNavigationalState tckPageState;
-
- public TCKPageRenderer(ResponseProperties properties, TCKPageNavigationalState pageState)
- {
- super(properties, pageState);
- tckPageState = pageState;
- }
-
- protected void prepareRendering(PortletControllerContextImpl context)
- {
- // What we collect during the different renders
- // we don't reuse the render properties argument since we want to avoid that
- // a portlet rendition affects another rendition of a portlet on the same page
- ResponseProperties renderProperties = new ResponseProperties();
-
- //
- try
- {
- Collection<Portlet> portlets = tckPageState.getInvolvedPortlets();
-
- int capacity = portlets.size();
- fragments = new ArrayList<FragmentResponse>(capacity);
- errors = new ArrayList<ErrorResponse>(capacity);
-
- for (Portlet portlet : portlets)
- {
- WindowNavigationalState windowNS = pageState.getWindowNavigationalState(portlet.getContext().getId());
-
- //
- Mode mode = Mode.VIEW;
- WindowState windowState = WindowState.NORMAL;
- StateString portletNS = null;
-
- //
- if (windowNS != null)
- {
- if (windowNS.getMode() != null)
- {
- mode = windowNS.getMode();
- }
- if (windowNS.getWindowState() != null)
- {
- windowState = windowNS.getWindowState();
- }
- if (windowNS.getPortletNavigationalState() != null)
- {
- portletNS = windowNS.getPortletNavigationalState();
- }
- }
-
- //
- ParameterMap publicNS = pageState.getPublicNavigationalState(portlet.getContext().getId());
-
- RenderInvocation render = createRenderInvocation(context, properties, pageState, portlet, windowNS, mode, windowState, portletNS, publicNS);
-
- //
- try
- {
- PortletInvocationResponse response = context.invoke(render);
-
- if (response instanceof FragmentResponse)
- {
- FragmentResponse fragment = (FragmentResponse)response;
-
- //
- fragments.add(fragment);
-
- //
- ResponseProperties fragmentProperties = fragment.getProperties();
- if (fragmentProperties != null)
- {
- renderProperties.append(fragmentProperties);
- }
- }
- else if (response instanceof ErrorResponse)
- {
- ErrorResponse error = (ErrorResponse)response;
- errors.add(error);
- }
-
- }
- catch (PortletInvokerException e)
- {
- e.printStackTrace();
- }
- }
- }
- catch (Exception e)
- {
- // todo
- e.printStackTrace();
- }
-
- // Now we combine the render properties with the page properties
- properties.append(renderProperties);
- }
-}
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKPortletControllerContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKPortletControllerContext.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKPortletControllerContext.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -0,0 +1,109 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.test.tck;
+
+import org.jboss.portal.portlet.test.controller.AbstractPortletControllerContext;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.controller.event.EventControllerContext;
+import org.jboss.portal.portlet.controller.state.StateControllerContext;
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.controller.impl.state.StateControllerContextImpl;
+import org.jboss.portal.portlet.controller.impl.event.EventControllerContextImpl;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.web.IllegalRequestException;
+import org.jboss.portal.common.io.Serialization;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletContext;
+import java.io.IOException;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class TCKPortletControllerContext extends AbstractPortletControllerContext
+{
+
+ /** . */
+ private final PortletInvoker invoker;
+
+ /** . */
+ private final TCKStateControllerContext stateControllerContext;
+
+ /** . */
+ private final EventControllerContext eventControllerContext;
+
+ /** . */
+ private final Serialization<PageNavigationalState> serialization;
+
+ public TCKPortletControllerContext(
+ HttpServletRequest req,
+ HttpServletResponse resp,
+ ServletContext servletContext) throws IllegalRequestException, IOException
+ {
+ super(req, resp);
+
+ //
+ this.invoker = (PortletInvoker)servletContext.getAttribute("ConsumerPortletInvoker");
+ this.stateControllerContext = new TCKStateControllerContext(new StateControllerContextImpl(this));
+ this.eventControllerContext = new EventControllerContextImpl(invoker);
+ this.serialization = new TCKPageNavigationalStateSerialization(stateControllerContext);
+ }
+
+ public Set<Portlet> getPortlets() throws PortletInvokerException
+ {
+ return invoker.getPortlets();
+ }
+
+ protected Portlet getPortlet(String windowId) throws PortletInvokerException
+ {
+ return invoker.getPortlet(PortletContext.createPortletContext(windowId));
+ }
+
+ protected PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException
+ {
+ return invoker.invoke(invocation);
+ }
+
+ protected Serialization<PageNavigationalState> getPageNavigationalStateSerialization()
+ {
+ return serialization;
+ }
+
+ public EventControllerContext getEventControllerContext()
+ {
+ return eventControllerContext;
+ }
+
+ public StateControllerContext getStateControllerContext()
+ {
+ return stateControllerContext;
+ }
+}
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKRendererContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKRendererContext.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKRendererContext.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.test.tck;
+
+import org.jboss.portal.portlet.test.controller.AbstractRendererContext;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
+
+import java.util.Collection;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class TCKRendererContext extends AbstractRendererContext
+{
+
+ /** . */
+ private final Collection<Portlet> involvedPortlets;
+
+ public TCKRendererContext(
+ TCKPortletControllerContext portletControllerContext,
+ TCKPageNavigationalState pageState) throws PortletInvokerException
+ {
+ super(portletControllerContext);
+
+ //
+ Collection<Portlet> involvedPortlets = new ArrayList<Portlet>();
+ for (String involvedPortletId : pageState.getInvolvedPortlets())
+ {
+ Portlet involvedPortlet = portletControllerContext.getPortlet(involvedPortletId);
+ involvedPortlets.add(involvedPortlet);
+ }
+
+ //
+ this.involvedPortlets = involvedPortlets;
+ }
+
+ public Collection<Portlet> getPortlets()
+ {
+ return involvedPortlets;
+ }
+}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKServlet.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKServlet.java 2008-02-26 00:52:13 UTC (rev 10115)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKServlet.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -22,16 +22,15 @@
package org.jboss.portal.portlet.test.tck;
-import org.jboss.portal.portlet.test.controller.PortletControllerContextImpl;
import org.jboss.portal.portlet.test.controller.Renderer;
import org.jboss.portal.portlet.test.controller.ControllerResponseRendererFactory;
import org.jboss.portal.portlet.test.controller.PageRenderer;
+import org.jboss.portal.portlet.test.controller.AbstractRendererContext;
import org.jboss.portal.portlet.test.URLParameterConstants;
import org.jboss.portal.portlet.controller.PortletController;
import org.jboss.portal.portlet.controller.response.ControllerResponse;
import org.jboss.portal.portlet.controller.request.ControllerRequest;
import org.jboss.portal.portlet.controller.impl.request.ControllerRequestFactory;
-import org.jboss.portal.portlet.controller.impl.state.StateControllerContextImpl;
import org.jboss.portal.portlet.invocation.response.ResponseProperties;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.web.WebRequest;
@@ -43,9 +42,7 @@
import java.io.IOException;
import java.util.Collection;
import java.util.Set;
-import java.util.HashSet;
-import java.util.List;
-import java.util.LinkedList;
+import java.util.LinkedHashSet;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
@@ -82,20 +79,24 @@
protected void _service(HttpServletRequest req, HttpServletResponse resp) throws Exception
{
- PortletControllerContextImpl context = new PortletControllerContextImpl(req, resp, getServletContext());
+ TCKPortletControllerContext context = new TCKPortletControllerContext(req, resp, getServletContext());
//
PortletController controller = new PortletController();
+ //
String type = req.getParameter(URLParameterConstants.TYPE);
//
if (URLParameterConstants.PORTLET_TYPE.equals(type))
{
WebRequest wr = new WebRequest(req);
- ControllerRequestFactory factory = new ControllerRequestFactory(context.getStateControllerContext());
+ ControllerRequestFactory factory = new ControllerRequestFactory(context.getPageNavigationalStateSerialization());
ControllerRequest request = factory.createRequest(wr);
+ // We must have one!!!
+ TCKPageNavigationalState tckPageState = (TCKPageNavigationalState)request.getPageState();
+
//
ControllerResponse response = controller.process(context, request);
@@ -103,32 +104,26 @@
Renderer renderer = ControllerResponseRendererFactory.getRenderer(response);
//
- renderer.render(context);
+ renderer.render(new TCKRendererContext(context, tckPageState));
}
else
{
-
String[] tckParamers = req.getParameterValues(TCK_PORTLET_NAME);
-
Collection<Portlet> portlets = context.getPortlets();
-
- List<Portlet> involvedPortlets = new LinkedList<Portlet>();
-
- for (int i = 0; i < tckParamers.length; i++)
+ Set<String> involvedPortlets = new LinkedHashSet<String>();
+ for (String tckParamer : tckParamers)
{
- String tckParamer = tckParamers[i];
-
String[] parts = tckParamer.split("/");
-
String portletAppName = parts[0];
String portletName = parts[1];
+ //
for (Portlet portlet : portlets)
{
if (portlet.getInfo().getApplicationName().equals(portletAppName)
- && portlet.getInfo().getName().equals(portletName))
+ && portlet.getInfo().getName().equals(portletName))
{
- involvedPortlets.add(portlet);
+ involvedPortlets.add(portlet.getContext().getId());
}
}
}
@@ -138,12 +133,13 @@
throw new IllegalStateException("Portlets requested by TCK were not found");
}
- TCKPageNavigationalState tckPageState = new TCKPageNavigationalState((StateControllerContextImpl)context.getStateControllerContext(), false, involvedPortlets);
+ TCKPageNavigationalState tckPageState = new TCKPageNavigationalState(context.getStateControllerContext().createPageState(false), involvedPortlets);
- PageRenderer renderer = new TCKPageRenderer(new ResponseProperties(), tckPageState);
+ //
+ PageRenderer renderer = new PageRenderer(new ResponseProperties(), tckPageState);
//
- renderer.render(context);
+ renderer.render(new TCKRendererContext(context, tckPageState));
}
}
}
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKStateControllerContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKStateControllerContext.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKStateControllerContext.java 2008-02-26 02:47:19 UTC (rev 10116)
@@ -0,0 +1,58 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.test.tck;
+
+import org.jboss.portal.portlet.controller.state.StateControllerContext;
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class TCKStateControllerContext implements StateControllerContext
+{
+
+ final StateControllerContext defaultStateControllerContext;
+
+ public TCKStateControllerContext(StateControllerContext defaultStateControllerContext)
+ {
+ this.defaultStateControllerContext = defaultStateControllerContext;
+ }
+
+ public PageNavigationalState clonePageState(PageNavigationalState pageState, boolean modifiable)
+ {
+ TCKPageNavigationalState tckPageState = (TCKPageNavigationalState)pageState;
+
+ //
+ return new TCKPageNavigationalState(
+ defaultStateControllerContext.clonePageState(tckPageState.defaultState, modifiable),
+ new HashSet<String>(tckPageState.involvedPortlets));
+ }
+
+ public PageNavigationalState createPageState(boolean modifiable)
+ {
+ return new TCKPageNavigationalState(defaultStateControllerContext.createPageState(modifiable), new HashSet<String>());
+ }
+}
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-02-26 00:52:13 UTC (rev 10115)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-02-26 02:47:19 UTC (rev 10116)
@@ -754,7 +754,6 @@
<path refid="mc.jboss_xb"/>
<path refid="mc.jboss_aop"/>
<path refid="mc.jboss_microcontainer"/>
- <path refid="mc.jaxb-api"/>
</copy>
@@ -772,7 +771,8 @@
<path location="${dependency.portal-common-portal.jar}"/>
<path location="${dependency.portal-portlet.jar}"/>
<path location="${dependency.portal-web.jar}"/>
- <!--<path location="${dependency.jsr168api.jar}"/>-->
+ <path location="${dependency.jsr168api.jar}"/>
+ <path location="${dependency.jaxb-api.jar}"/>
<path location="${dependency.jboss-unit.jar}"/>
<path location="${dependency.jboss-unit-remote.jar}"/>
@@ -780,13 +780,7 @@
</copy>
- <copy todir="${tck}" flatten="true">
- <path location="${dependency.jsr168api.jar}"/>
-
- </copy>
-
-
<delete file="${target}/portlet-test-lib.jar"/>
</target>
16 years, 8 months
JBoss Portal SVN: r10115 - docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: mmcallis
Date: 2008-02-25 19:52:13 -0500 (Mon, 25 Feb 2008)
New Revision: 10115
Modified:
docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/tutorials.xml
docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/xmldescriptors.xml
Log:
6.1.2. The JBoss Portlet Instance DTD
last revisions for this section
Modified: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/tutorials.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/tutorials.xml 2008-02-26 00:00:22 UTC (rev 10114)
+++ docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/tutorials.xml 2008-02-26 00:52:13 UTC (rev 10115)
@@ -427,7 +427,7 @@
</screen></term>
<listitem>
<para>
- Instructs the portal to overwrite or keep this object if it already exists. Accepted values are <computeroutput>overwrite</computeroutput> and <computeroutput>keep</computeroutput>. The <computeroutput>overwrite</computeroutput> value will destroy the existing object and create a new one based on the content of the deployment. The <computeroutput>keep</computeroutput> option will maintain the existing object deployment, or create a new one if it does not exist.
+ Instructs the portal to overwrite or keep this object if it already exists. Accepted values are <computeroutput>overwrite</computeroutput> and <computeroutput>keep</computeroutput>. The <computeroutput>overwrite</computeroutput> option will destroy the existing object and create a new one based on the content of the deployment. The <computeroutput>keep</computeroutput> option will maintain the existing object deployment, or create a new one if it does not exist.
</para>
</listitem>
</varlistentry>
Modified: docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/xmldescriptors.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/xmldescriptors.xml 2008-02-26 00:00:22 UTC (rev 10114)
+++ docs/branches/JBoss_Portal_Branch_2_6/referenceGuide/en/modules/xmldescriptors.xml 2008-02-26 00:52:13 UTC (rev 10115)
@@ -327,7 +327,7 @@
</screen>
</para>
<para>
- The <computeroutput><if-exists></computeroutput> element is used to define 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> value will destroy the existing object and create a new one based on the content of the deployment. The <computeroutput>keep</computeroutput> option will maintain the existing object deployment, or create a new one if it does not exist.
+ The <computeroutput><if-exists></computeroutput> element is used to define 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 will destroy the existing object and create a new one based on the content of the deployment. The <computeroutput>keep</computeroutput> option will maintain the existing object deployment, or create a new one if it does not exist.
</para>
</listitem>
</varlistentry>
@@ -376,7 +376,7 @@
</screen>
</para>
<para>
- The reference to the portlet, which is the portlet name. The <computeroutput><portlet-ref></computeroutput> value must match the <computeroutput><portlet-name></computeroutput> give in the <filename>WEB-INF/portlet.xml</filename> file.
+ The reference to the portlet, which is the name of the portlet. The <computeroutput><portlet-ref></computeroutput> value must match the <computeroutput><portlet-name></computeroutput> give in the <filename>WEB-INF/portlet.xml</filename> file.
</para>
<para>
<screen><![CDATA[
@@ -487,7 +487,7 @@
</screen>
</para>
<para>
- If present. the <computeroutput><unchecked></computeroutput> element is used to define that anyone can view the instance.
+ If present, the <computeroutput><unchecked></computeroutput> element is used to define that anyone can view the instance.
</para>
<para>
<screen><![CDATA[
@@ -495,7 +495,7 @@
</screen>
</para>
<para>
- The <computeroutput><role-name></computeroutput> element is used to define a role that this security constraint will apply to. The following example only allows users that are part of the <computeroutput>EXAMPLEROLE</computeroutput> role, to access the instance:
+ The <computeroutput><role-name></computeroutput> element is used to define 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[
16 years, 8 months
JBoss Portal SVN: r10114 - modules/portlet/trunk/test/src/test/resources/portlet-tck-war/WEB-INF.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-25 19:00:22 -0500 (Mon, 25 Feb 2008)
New Revision: 10114
Modified:
modules/portlet/trunk/test/src/test/resources/portlet-tck-war/WEB-INF/jboss-beans.xml
Log:
update jboss-beans that is stale
Modified: modules/portlet/trunk/test/src/test/resources/portlet-tck-war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/portlet-tck-war/WEB-INF/jboss-beans.xml 2008-02-25 23:59:04 UTC (rev 10113)
+++ modules/portlet/trunk/test/src/test/resources/portlet-tck-war/WEB-INF/jboss-beans.xml 2008-02-26 00:00:22 UTC (rev 10114)
@@ -35,6 +35,7 @@
</bean>
<bean name="PortletApplicationDeployer" class="org.jboss.portal.portlet.test.TestPortletApplicationDeployer">
+ <alias>PortletApplicationRegistry</alias>
<property name="servletContainer"><inject bean="ServletContainer"/></property>
<property name="driver"><inject bean="TestDriverServer"/></property>
<property name="portletContainerInvoker"><inject bean="PortletContainerInvoker"/></property>
@@ -70,7 +71,9 @@
</bean>
<!-- Container stack -->
- <bean name="ValveInterceptor" class="org.jboss.portal.portlet.aspects.portlet.ValveInterceptor"/>
+ <bean name="ValveInterceptor" class="org.jboss.portal.portlet.aspects.portlet.ValveInterceptor">
+ <property name="portletApplicationRegistry"><inject bean="PortletApplicationRegistry" state="Instantiated"/></property>
+ </bean>
<bean name="SecureTransportInterceptor" class="org.jboss.portal.portlet.aspects.portlet.SecureTransportInterceptor"/>
<bean name="ContextDispatcherInterceptor"
class="org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor">
16 years, 8 months