JBoss Portal SVN: r10547 - in branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal: test/core/portlet and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-12 06:36:56 -0400 (Sat, 12 Apr 2008)
New Revision: 10547
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestDecoder.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestEncoder.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/portlet/PortletRequestDecoderTestCase.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/portlet/PortletRequestEncoderTestCase.java
Log:
start to add support for resource serving
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestDecoder.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestDecoder.java 2008-04-11 22:45:56 UTC (rev 10546)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestDecoder.java 2008-04-12 10:36:56 UTC (rev 10547)
@@ -28,6 +28,7 @@
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.ParametersStateString;
import org.jboss.portal.portlet.OpaqueStateString;
+import org.jboss.portal.portlet.cache.CacheLevel;
import java.util.Map;
@@ -41,18 +42,30 @@
public class PortletRequestDecoder
{
+ /** The action phase. */
+ public static final int ACTION_PHASE = 1;
+
+ /** The render phase. */
+ public static final int RENDER_PHASE = 2;
+
+ /** The resource phase. */
+ public static final int RESOURCE_PHASE = 3;
+
/** The mask for action. */
- public static final int ACTION_MASK = 0x00000001;
+ public static final int PHASE_MASK = 0x00000003;
- /** The mask for render. */
- public static final int RENDER_MASK = 0x00000002;
-
/** The mask for mode. */
public static final int MODE_MASK = 0x00000004;
+ /** The mask for resource id. */
+ public static final int RESOURCE_ID_MASK = 0x00000004;
+
/** The mask for window state. */
public static final int WINDOW_STATE_MASK = 0x00000008;
+ /** The mask for cacheability. */
+ public static final int CACHEABILITY_MASK = 0x00000008;
+
/** The mask for opacity. */
public static final int OPAQUE_MASK = 0x00000010;
@@ -68,6 +81,15 @@
/** The name of the URL parameter containing the navigational state. */
public static final String NAVIGATIONAL_STATE_PARAMETER = "ns";
+ /** The name of the URL parameter containing the resource state. */
+ public static final String RESOURCE_STATE_PARAMETER = "rs";
+
+ /** The name of the URL parameter containing the cacheability. */
+ public static final String CACHEABILITY_PARAMETER = "cacheability";
+
+ /** The name of the URL parameter containing the resource id. */
+ public static final String RESOURCE_ID_PARAMETER = "id";
+
/** The name of the URL parameter containing the meta information. */
public static final String META_PARAMETER = "action";
@@ -81,25 +103,45 @@
public static final int NAV_TYPE = 2;
/** . */
+ public static final int RESOURCE_TYPE = 3;
+
+ /** . */
private Mode mode;
/** . */
private WindowState windowState;
/** . */
- private StateString navigationalstate;
+ private StateString navigationalState;
/** . */
private StateString interactionState;
/** . */
+ private StateString resourceState;
+
+ /** . */
private ParameterMap form;
/** . */
+ private String resourceId;
+
+ /** . */
+ private CacheLevel cacheability;
+
+ /** . */
private int type;
public void decode(Map<String, String[]> queryParams, Map<String, String[]> bodyParams) throws IllegalArgumentException
{
+ mode = null;
+ windowState = null;
+ navigationalState = null;
+ interactionState = null;
+ form = null;
+ resourceId = null;
+ cacheability = null;
+
// The meta info from the URL
int meta = 0;
String[] metaParam = queryParams.get(META_PARAMETER);
@@ -116,55 +158,76 @@
}
//
- if ((meta & (ACTION_MASK | RENDER_MASK)) != 0)
+ int phase = meta & PHASE_MASK;
+
+ //
+ if (phase != 0)
{
- // Check validity
- if ((meta & (ACTION_MASK | RENDER_MASK)) == (ACTION_MASK | RENDER_MASK))
+ switch (phase)
{
- throw new IllegalArgumentException("Cannot have both action and render in the mask at the same time");
+ case ACTION_PHASE:
+ type = ACTION_TYPE;
+ break;
+ case RENDER_PHASE:
+ type = RENDER_TYPE;
+ break;
+ case RESOURCE_PHASE:
+ type = RESOURCE_TYPE;
+ break;
+ default:
+ throw new AssertionError();
}
//
- if ((meta & ACTION_MASK) != 0)
+ if (type == RESOURCE_TYPE)
{
- type = ACTION_TYPE;
- }
- else
- {
- type = RENDER_TYPE;
- }
+ // Get the resource id from the parameters if it exists
+ if ((meta & RESOURCE_ID_MASK) != 0)
+ {
+ String[] resourceIdParam = queryParams.get(RESOURCE_ID_PARAMETER);
+ if (resourceIdParam == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ resourceId = resourceIdParam[0];
+ }
- // Get the mode from the parameters if it exists
- if ((meta & MODE_MASK) != 0)
- {
- String[] modeParam = queryParams.get(MODE_PARAMETER);
- if (modeParam == null)
+ // Get the resource id from the parameters if it exists
+ if ((meta & CACHEABILITY_MASK) != 0)
{
- throw new IllegalArgumentException();
+ String[] cacheabilityParam = queryParams.get(CACHEABILITY_PARAMETER);
+ if (cacheabilityParam == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ cacheability = CacheLevel.valueOf(cacheabilityParam[0]);
}
- mode = Mode.create(modeParam[0]);
}
else
{
- mode = null;
- }
+ // Get the mode from the parameters if it exists
+ if ((meta & MODE_MASK) != 0)
+ {
+ String[] modeParam = queryParams.get(MODE_PARAMETER);
+ if (modeParam == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ mode = Mode.create(modeParam[0]);
+ }
- // Get the window state from the parameters if it exists
- if ((meta & WINDOW_STATE_MASK) != 0)
- {
- String[] windowStateParam = queryParams.get(WINDOW_STATE_PARAMETER);
- if (windowStateParam == null)
+ // Get the window state from the parameters if it exists
+ if ((meta & WINDOW_STATE_MASK) != 0)
{
- throw new IllegalArgumentException();
+ String[] windowStateParam = queryParams.get(WINDOW_STATE_PARAMETER);
+ if (windowStateParam == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ windowState = WindowState.create(windowStateParam[0]);
}
- windowState = WindowState.create(windowStateParam[0]);
}
- else
- {
- windowState = null;
- }
- //
boolean opaque = (meta & OPAQUE_MASK) != 0;
if (!opaque)
{
@@ -207,18 +270,20 @@
}
//
- if (type == ACTION_TYPE)
+ switch (type)
{
- this.navigationalstate = null;
- this.interactionState = query;
- this.form = form;
+ case ACTION_TYPE:
+ this.interactionState = query;
+ this.form = form;
+ break;
+ case RENDER_TYPE:
+ this.navigationalState = query;
+ break;
+ case RESOURCE_TYPE:
+ this.resourceState = query;
+ this.form = form;
+ break;
}
- else
- {
- this.navigationalstate = query;
- this.interactionState = null;
- this.form = null;
- }
}
else
{
@@ -226,12 +291,8 @@
String[] ns = queryParams.get(NAVIGATIONAL_STATE_PARAMETER);
if (ns != null)
{
- navigationalstate = new OpaqueStateString(ns[0]);
+ navigationalState = new OpaqueStateString(ns[0]);
}
- else
- {
- navigationalstate = null;
- }
// Decode more if we have an action
if (type == ACTION_TYPE)
@@ -242,10 +303,6 @@
{
interactionState = new OpaqueStateString(is[0]);
}
- else
- {
- interactionState = null;
- }
//
form = new ParameterMap();
@@ -254,11 +311,6 @@
form.putAll(bodyParams);
}
}
- else
- {
- interactionState = null;
- form = null;
- }
}
}
else
@@ -272,10 +324,6 @@
{
mode = Mode.create(modeParam[0]);
}
- else
- {
- mode = null;
- }
// Get the window state from the parameters if it exists
String[] windowStateParam = queryParams.get(WINDOW_STATE_PARAMETER);
@@ -283,10 +331,6 @@
{
windowState = WindowState.create(windowStateParam[0]);
}
- else
- {
- windowState = null;
- }
}
}
@@ -302,7 +346,7 @@
public StateString getNavigationalState()
{
- return navigationalstate;
+ return navigationalState;
}
public StateString getInteractionState()
@@ -319,4 +363,19 @@
{
return type;
}
+
+ public String getResourceId()
+ {
+ return resourceId;
+ }
+
+ public CacheLevel getCacheability()
+ {
+ return cacheability;
+ }
+
+ public StateString getResourceState()
+ {
+ return resourceState;
+ }
}
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestEncoder.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestEncoder.java 2008-04-11 22:45:56 UTC (rev 10546)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestEncoder.java 2008-04-12 10:36:56 UTC (rev 10547)
@@ -26,7 +26,9 @@
import org.jboss.portal.WindowState;
import org.jboss.portal.portlet.ParametersStateString;
import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.cache.CacheLevel;
import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.common.NotYetImplemented;
import java.util.Map;
@@ -64,6 +66,46 @@
this(new ParameterMap());
}
+ public void encodeResource(
+ CacheLevel cacheability,
+ String resourceId,
+ StateString resourceState)
+ {
+ queryParameters.clear();
+
+ //
+ int meta = PortletRequestDecoder.RESOURCE_PHASE;
+
+ //
+ if (resourceState != null)
+ {
+ if (resourceState instanceof ParametersStateString)
+ {
+ // Add the parameters
+ Map<String, String[]> parameters = ((ParametersStateString)resourceState).getParameters();
+ configure(parameters);
+ }
+ else
+ {
+ throw new NotYetImplemented("We do not implement resource serving for wsrp");
+ }
+ }
+
+ //
+ meta |= PortletRequestDecoder.CACHEABILITY_MASK;
+ setMetaParameter(PortletRequestDecoder.CACHEABILITY_PARAMETER, cacheability.toString());
+
+ //
+ if (resourceId != null)
+ {
+ meta |= PortletRequestDecoder.RESOURCE_ID_MASK;
+ setMetaParameter(PortletRequestDecoder.RESOURCE_ID_PARAMETER, resourceId);
+ }
+
+ //
+ setMetaParameter(PortletRequestDecoder.META_PARAMETER, Integer.toHexString(meta));
+ }
+
public void encodeAction(
StateString navigationalState,
StateString interactionState,
@@ -73,7 +115,7 @@
queryParameters.clear();
//
- int meta = PortletRequestDecoder.ACTION_MASK;
+ int meta = PortletRequestDecoder.ACTION_PHASE;
//
if (interactionState != null)
@@ -118,7 +160,7 @@
//
if (navigationalState != null)
{
- int meta = PortletRequestDecoder.RENDER_MASK;
+ int meta = PortletRequestDecoder.RENDER_PHASE;
//
if (navigationalState instanceof ParametersStateString)
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/portlet/PortletRequestDecoderTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/portlet/PortletRequestDecoderTestCase.java 2008-04-11 22:45:56 UTC (rev 10546)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/portlet/PortletRequestDecoderTestCase.java 2008-04-12 10:36:56 UTC (rev 10547)
@@ -57,22 +57,10 @@
Map bodyParams = new HashMap();
PortletRequestDecoder o = new PortletRequestDecoder();
- // Action + Render
- try
- {
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK | PortletRequestDecoder.ACTION_MASK)));
- o.decode(queryParams, null);
- fail();
- }
- catch (IllegalArgumentException expected)
- {
- queryParams.clear();
- }
-
// Action + Mode
try
{
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.MODE_MASK | PortletRequestDecoder.ACTION_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_PHASE | PortletRequestDecoder.MODE_MASK)));
o.decode(queryParams, null);
fail();
}
@@ -82,7 +70,7 @@
}
try
{
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.MODE_MASK | PortletRequestDecoder.ACTION_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_PHASE | PortletRequestDecoder.MODE_MASK)));
bodyParams.put(PortletRequestDecoder.MODE_PARAMETER, asStringArray(Mode.VIEW.toString()));
o.decode(queryParams, bodyParams);
fail();
@@ -96,7 +84,7 @@
// Action + WindowState
try
{
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.WINDOW_STATE_MASK | PortletRequestDecoder.ACTION_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_PHASE | PortletRequestDecoder.WINDOW_STATE_MASK)));
o.decode(queryParams, null);
fail();
}
@@ -106,7 +94,7 @@
}
try
{
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.WINDOW_STATE_MASK | PortletRequestDecoder.ACTION_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_PHASE | PortletRequestDecoder.WINDOW_STATE_MASK)));
bodyParams.put(PortletRequestDecoder.WINDOW_STATE_PARAMETER, asStringArray(WindowState.NORMAL.toString()));
o.decode(queryParams, bodyParams);
fail();
@@ -120,7 +108,7 @@
// Render + Mode
try
{
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.MODE_MASK | PortletRequestDecoder.RENDER_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_PHASE | PortletRequestDecoder.MODE_MASK)));
o.decode(queryParams, null);
fail();
}
@@ -130,7 +118,7 @@
}
try
{
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.MODE_MASK | PortletRequestDecoder.ACTION_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_PHASE | PortletRequestDecoder.MODE_MASK)));
bodyParams.put(PortletRequestDecoder.MODE_PARAMETER, asStringArray(Mode.VIEW.toString()));
o.decode(queryParams, bodyParams);
fail();
@@ -144,7 +132,7 @@
// Render + WindowState
try
{
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.WINDOW_STATE_MASK | PortletRequestDecoder.RENDER_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_PHASE | PortletRequestDecoder.WINDOW_STATE_MASK)));
o.decode(queryParams, bodyParams);
fail();
}
@@ -154,7 +142,7 @@
}
try
{
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.WINDOW_STATE_MASK | PortletRequestDecoder.ACTION_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_PHASE | PortletRequestDecoder.WINDOW_STATE_MASK)));
bodyParams.put(PortletRequestDecoder.WINDOW_STATE_PARAMETER, asStringArray(WindowState.NORMAL.toString()));
o.decode(queryParams, bodyParams);
fail();
@@ -259,7 +247,7 @@
PortletRequestDecoder o = new PortletRequestDecoder();
// Empty
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_PHASE)));
o.decode(queryParams, null);
assertNull(o.getForm());
assertNull(o.getInteractionState());
@@ -270,7 +258,7 @@
queryParams.clear();
// Query mode
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK | PortletRequestDecoder.MODE_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_PHASE | PortletRequestDecoder.MODE_MASK)));
queryParams.put(PortletRequestDecoder.MODE_PARAMETER, asStringArray(Mode.VIEW.toString()));
o.decode(queryParams, null);
assertNull(o.getForm());
@@ -282,7 +270,7 @@
queryParams.clear();
// Query window state
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK | PortletRequestDecoder.WINDOW_STATE_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_PHASE | PortletRequestDecoder.WINDOW_STATE_MASK)));
queryParams.put(PortletRequestDecoder.WINDOW_STATE_PARAMETER, asStringArray(WindowState.NORMAL.toString()));
o.decode(queryParams, null);
assertNull(o.getForm());
@@ -303,7 +291,7 @@
ParametersStateString navState = ParametersStateString.create();
// Query parameter
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_PHASE)));
queryParams.put("foo", asStringArray("bar"));
o.decode(queryParams, null);
assertNull(o.getForm());
@@ -317,7 +305,7 @@
queryParams.clear();
// Query meta parameter
- queryParams.put(PortletRequestDecoder.META_PARAMETER, new String[]{Integer.toHexString(PortletRequestDecoder.RENDER_MASK), "bar"});
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, new String[]{Integer.toHexString(PortletRequestDecoder.RENDER_PHASE), "bar"});
o.decode(queryParams, null);
assertNull(o.getForm());
assertNull(o.getInteractionState());
@@ -330,7 +318,7 @@
queryParams.clear();
// Query window state parameter + window state meta parameter
- queryParams.put(PortletRequestDecoder.META_PARAMETER, new String[]{Integer.toHexString(PortletRequestDecoder.RENDER_MASK | PortletRequestDecoder.WINDOW_STATE_MASK)});
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, new String[]{Integer.toHexString(PortletRequestDecoder.RENDER_PHASE | PortletRequestDecoder.WINDOW_STATE_MASK)});
queryParams.put(PortletRequestDecoder.WINDOW_STATE_PARAMETER, new String[]{WindowState.NORMAL.toString(), "bar"});
o.decode(queryParams, null);
assertNull(o.getForm());
@@ -344,7 +332,7 @@
queryParams.clear();
// Query window state parameter
- queryParams.put(PortletRequestDecoder.META_PARAMETER, new String[]{Integer.toHexString(PortletRequestDecoder.RENDER_MASK)});
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, new String[]{Integer.toHexString(PortletRequestDecoder.RENDER_PHASE)});
queryParams.put(PortletRequestDecoder.WINDOW_STATE_PARAMETER, new String[]{"bar"});
o.decode(queryParams, null);
assertNull(o.getForm());
@@ -358,7 +346,7 @@
queryParams.clear();
// Query mode parameter + mode meta parameter
- queryParams.put(PortletRequestDecoder.META_PARAMETER, new String[]{Integer.toHexString(PortletRequestDecoder.RENDER_MASK | PortletRequestDecoder.MODE_MASK)});
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, new String[]{Integer.toHexString(PortletRequestDecoder.RENDER_PHASE | PortletRequestDecoder.MODE_MASK)});
queryParams.put(PortletRequestDecoder.MODE_PARAMETER, new String[]{Mode.VIEW.toString(), "bar"});
o.decode(queryParams, null);
assertNull(o.getForm());
@@ -372,7 +360,7 @@
queryParams.clear();
// Query mode parameter
- queryParams.put(PortletRequestDecoder.META_PARAMETER, new String[]{Integer.toHexString(PortletRequestDecoder.RENDER_MASK)});
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, new String[]{Integer.toHexString(PortletRequestDecoder.RENDER_PHASE)});
queryParams.put(PortletRequestDecoder.MODE_PARAMETER, new String[]{"bar"});
o.decode(queryParams, null);
assertNull(o.getForm());
@@ -386,7 +374,7 @@
queryParams.clear();
// Body parameter
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_PHASE)));
bodyParams.put("foo", asStringArray("bar2"));
o.decode(queryParams, bodyParams);
assertNull(o.getForm());
@@ -400,7 +388,7 @@
bodyParams.clear();
// Query multivalued parameter
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_PHASE)));
queryParams.put("foo", new String[]{"bar1", "bar2"});
o.decode(queryParams, null);
assertNull(o.getForm());
@@ -414,7 +402,7 @@
queryParams.clear();
// Query + Body parameter
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_PHASE)));
queryParams.put("foo", new String[]{"bar1"});
bodyParams.put("foo", new String[]{"bar2"});
o.decode(queryParams, bodyParams);
@@ -438,7 +426,7 @@
PortletRequestDecoder o = new PortletRequestDecoder();
// Empty
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK | PortletRequestDecoder.OPAQUE_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_PHASE | PortletRequestDecoder.OPAQUE_MASK)));
o.decode(queryParams, null);
assertNull(o.getForm());
assertNull(o.getInteractionState());
@@ -449,7 +437,7 @@
queryParams.clear();
// Query nav state
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK | PortletRequestDecoder.OPAQUE_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_PHASE | PortletRequestDecoder.OPAQUE_MASK)));
queryParams.put(PortletRequestDecoder.NAVIGATIONAL_STATE_PARAMETER, asStringArray("navstatevalue"));
o.decode(queryParams, bodyParams);
assertNull(o.getForm());
@@ -461,7 +449,7 @@
queryParams.clear();
// Body nav state
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK | PortletRequestDecoder.OPAQUE_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_PHASE | PortletRequestDecoder.OPAQUE_MASK)));
bodyParams.put(PortletRequestDecoder.NAVIGATIONAL_STATE_PARAMETER, asStringArray("navstatevalue"));
o.decode(queryParams, bodyParams);
assertNull(o.getForm());
@@ -474,7 +462,7 @@
bodyParams.clear();
// Query int state is ignored
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK | PortletRequestDecoder.OPAQUE_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_PHASE | PortletRequestDecoder.OPAQUE_MASK)));
queryParams.put(PortletRequestDecoder.INTERACTION_STATE_PARAMETER, asStringArray("intstatevalue"));
o.decode(queryParams, null);
assertNull(o.getForm());
@@ -486,7 +474,7 @@
queryParams.clear();
// Body int state is ignored
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK | PortletRequestDecoder.OPAQUE_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_PHASE | PortletRequestDecoder.OPAQUE_MASK)));
bodyParams.put(PortletRequestDecoder.INTERACTION_STATE_PARAMETER, asStringArray("intstatevalue"));
o.decode(queryParams, bodyParams);
assertNull(o.getForm());
@@ -506,7 +494,7 @@
PortletRequestDecoder o = new PortletRequestDecoder();
// Empty
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_PHASE)));
o.decode(queryParams, null);
assertEquals(new ParameterMap(), o.getForm());
assertEquals(ParametersStateString.create(), o.getInteractionState());
@@ -517,7 +505,7 @@
queryParams.clear();
// Query mode
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK | PortletRequestDecoder.MODE_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_PHASE | PortletRequestDecoder.MODE_MASK)));
queryParams.put(PortletRequestDecoder.MODE_PARAMETER, asStringArray(Mode.VIEW.toString()));
o.decode(queryParams, null);
assertEquals(new ParameterMap(), o.getForm());
@@ -529,7 +517,7 @@
queryParams.clear();
// Query window state
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK | PortletRequestDecoder.WINDOW_STATE_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_PHASE | PortletRequestDecoder.WINDOW_STATE_MASK)));
queryParams.put(PortletRequestDecoder.WINDOW_STATE_PARAMETER, asStringArray(WindowState.NORMAL.toString()));
o.decode(queryParams, null);
assertEquals(new ParameterMap(), o.getForm());
@@ -551,7 +539,7 @@
ParameterMap form = new ParameterMap();
// Query parameter
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_PHASE)));
queryParams.put("foo", asStringArray("bar"));
o.decode(queryParams, null);
assertEquals(form, o.getForm());
@@ -566,7 +554,7 @@
form.clear();
// Query multivalued parameter
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_PHASE)));
queryParams.put("foo", new String[]{"bar1", "bar2"});
o.decode(queryParams, null);
assertEquals(form, o.getForm());
@@ -581,7 +569,7 @@
form.clear();
// Body parameter
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_PHASE)));
bodyParams.put("foo", asStringArray("bar"));
o.decode(queryParams, bodyParams);
form.setValue("foo", "bar");
@@ -597,7 +585,7 @@
form.clear();
// Body multivalued parameter
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_PHASE)));
bodyParams.put("foo", new String[]{"bar1", "bar2"});
o.decode(queryParams, bodyParams);
form.setValues("foo", new String[]{"bar1", "bar2"});
@@ -621,7 +609,7 @@
PortletRequestDecoder o = new PortletRequestDecoder();
// Empty
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK | PortletRequestDecoder.OPAQUE_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_PHASE | PortletRequestDecoder.OPAQUE_MASK)));
o.decode(queryParams, null);
assertEquals(new ParameterMap(), o.getForm());
assertNull(o.getInteractionState());
@@ -632,7 +620,7 @@
queryParams.clear();
// Query nav state
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK | PortletRequestDecoder.OPAQUE_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_PHASE | PortletRequestDecoder.OPAQUE_MASK)));
queryParams.put(PortletRequestDecoder.NAVIGATIONAL_STATE_PARAMETER, asStringArray("navstatevalue"));
o.decode(queryParams, null);
assertEquals(new ParameterMap(), o.getForm());
@@ -644,7 +632,7 @@
queryParams.clear();
// Query int state
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK | PortletRequestDecoder.OPAQUE_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_PHASE | PortletRequestDecoder.OPAQUE_MASK)));
queryParams.put(PortletRequestDecoder.INTERACTION_STATE_PARAMETER, asStringArray("intstatevalue"));
o.decode(queryParams, null);
assertEquals(new ParameterMap(), o.getForm());
@@ -656,7 +644,7 @@
queryParams.clear();
// Body parameters
- queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK | PortletRequestDecoder.OPAQUE_MASK)));
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_PHASE | PortletRequestDecoder.OPAQUE_MASK)));
bodyParams.put("foo1", asStringArray("bar1"));
bodyParams.put("foo2", new String[]{"bar2", "bar3"});
queryParams.put("foo3", new String[]{"bar4"});
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/portlet/PortletRequestEncoderTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/portlet/PortletRequestEncoderTestCase.java 2008-04-11 22:45:56 UTC (rev 10546)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/portlet/PortletRequestEncoderTestCase.java 2008-04-12 10:36:56 UTC (rev 10547)
@@ -25,6 +25,7 @@
import org.jboss.portal.core.portlet.PortletRequestEncoder;
import org.jboss.portal.core.portlet.PortletRequestDecoder;
import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.common.util.Tools;
import org.jboss.portal.portlet.ParametersStateString;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
@@ -64,13 +65,13 @@
public void testEncodeRender()
{
- _testEncodeRender(RENDER, PortletRequestDecoder.RENDER_MASK);
+ _testEncodeRender(RENDER, PortletRequestDecoder.RENDER_PHASE);
}
public void testEncodeAction()
{
- _testEncodeRender(ACTION, PortletRequestDecoder.ACTION_MASK);
+ _testEncodeRender(ACTION, PortletRequestDecoder.ACTION_PHASE);
}
public void _testEncodeRender(int lifecycle, int lifecycleMask)
@@ -213,6 +214,14 @@
void _assertEquals(String[] expected, String[] actual)
{
- assertEquals(expected, actual);
+ if (expected == null)
+ {
+ assertNull(actual);
+ }
+ else
+ {
+ assertNotNull((actual));
+ assertEquals(Tools.toList(expected), Tools.toList(actual));
+ }
}
}
\ No newline at end of file
18 years
JBoss Portal SVN: r10546 - branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-11 18:45:56 -0400 (Fri, 11 Apr 2008)
New Revision: 10546
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestDecoder.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestEncoder.java
Log:
generification a bit
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestDecoder.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestDecoder.java 2008-04-11 22:23:08 UTC (rev 10545)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestDecoder.java 2008-04-11 22:45:56 UTC (rev 10546)
@@ -30,7 +30,6 @@
import org.jboss.portal.portlet.OpaqueStateString;
import java.util.Map;
-import java.util.Iterator;
/**
* This class is a possible implementation for the behavior of a request made to a portlet. Which means that this
@@ -99,11 +98,11 @@
/** . */
private int type;
- public void decode(Map queryParams, Map bodyParams) throws IllegalArgumentException
+ public void decode(Map<String, String[]> queryParams, Map<String, String[]> bodyParams) throws IllegalArgumentException
{
// The meta info from the URL
int meta = 0;
- String[] metaParam = (String[])queryParams.get(META_PARAMETER);
+ String[] metaParam = queryParams.get(META_PARAMETER);
if (metaParam != null)
{
try
@@ -138,7 +137,7 @@
// Get the mode from the parameters if it exists
if ((meta & MODE_MASK) != 0)
{
- String[] modeParam = (String[])queryParams.get(MODE_PARAMETER);
+ String[] modeParam = queryParams.get(MODE_PARAMETER);
if (modeParam == null)
{
throw new IllegalArgumentException();
@@ -153,7 +152,7 @@
// Get the window state from the parameters if it exists
if ((meta & WINDOW_STATE_MASK) != 0)
{
- String[] windowStateParam = (String[])queryParams.get(WINDOW_STATE_PARAMETER);
+ String[] windowStateParam = queryParams.get(WINDOW_STATE_PARAMETER);
if (windowStateParam == null)
{
throw new IllegalArgumentException();
@@ -171,12 +170,11 @@
{
// Compute the parameters skipping the portlet navigational state that may be encoded as well
ParametersStateString query = ParametersStateString.create();
- for (Iterator i = queryParams.entrySet().iterator(); i.hasNext();)
+ for (Map.Entry<String, String[]> entry : queryParams.entrySet())
{
- Map.Entry entry = (Map.Entry)i.next();
int index = 0;
- String name = (String)entry.getKey();
- String[] queryValues = (String[])entry.getValue();
+ String name = entry.getKey();
+ String[] queryValues = entry.getValue();
//
if (META_PARAMETER.equals(name))
@@ -225,7 +223,7 @@
else
{
// Decode the navigational state
- String[] ns = (String[])queryParams.get(NAVIGATIONAL_STATE_PARAMETER);
+ String[] ns = queryParams.get(NAVIGATIONAL_STATE_PARAMETER);
if (ns != null)
{
navigationalstate = new OpaqueStateString(ns[0]);
@@ -239,7 +237,7 @@
if (type == ACTION_TYPE)
{
// Decode the interaction state
- String[] is = (String[])queryParams.get(INTERACTION_STATE_PARAMETER);
+ String[] is = queryParams.get(INTERACTION_STATE_PARAMETER);
if (is != null)
{
interactionState = new OpaqueStateString(is[0]);
@@ -269,7 +267,7 @@
type = NAV_TYPE;
// Get the mode from the parameters if it exists
- String[] modeParam = (String[])queryParams.get(MODE_PARAMETER);
+ String[] modeParam = queryParams.get(MODE_PARAMETER);
if (modeParam != null)
{
mode = Mode.create(modeParam[0]);
@@ -280,7 +278,7 @@
}
// Get the window state from the parameters if it exists
- String[] windowStateParam = (String[])queryParams.get(WINDOW_STATE_PARAMETER);
+ String[] windowStateParam = queryParams.get(WINDOW_STATE_PARAMETER);
if (windowStateParam != null)
{
windowState = WindowState.create(windowStateParam[0]);
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestEncoder.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestEncoder.java 2008-04-11 22:23:08 UTC (rev 10545)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestEncoder.java 2008-04-11 22:45:56 UTC (rev 10546)
@@ -29,7 +29,6 @@
import org.jboss.portal.common.util.ParameterMap;
import java.util.Map;
-import java.util.Iterator;
/**
* This class is designed to provide the encoding in the query string of a URL of the following state :
@@ -161,11 +160,10 @@
private void configure(Map<String, String[]> parameters)
{
- for (Iterator i = parameters.entrySet().iterator(); i.hasNext();)
+ for (Map.Entry<String, String[]> entry : parameters.entrySet())
{
- Map.Entry entry = (Map.Entry)i.next();
- String name = (String)entry.getKey();
- String[] values = (String[])entry.getValue();
+ String name = entry.getKey();
+ String[] values = entry.getValue();
queryParameters.setValues(name, values);
}
}
18 years
JBoss Portal SVN: r10545 - in branches/JBoss_Portal_Branch_2_7/core: src/main/org/jboss/portal/core/model/instance and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-11 18:23:08 -0400 (Fri, 11 Apr 2008)
New Revision: 10545
Added:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestDecoder.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestEncoder.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/portlet/PortletRequestDecoderTestCase.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/portlet/PortletRequestEncoderTestCase.java
Modified:
branches/JBoss_Portal_Branch_2_7/core/build.xml
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/InstanceCommandFactory.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/InstanceURLFactory.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java
Log:
forked PortletRequestDecoder and PortletRequestEncoder from the portlet module (that are deprecated and will be removed from there) into the core module in order to extend it for resource serving and public navigational state update
Modified: branches/JBoss_Portal_Branch_2_7/core/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/build.xml 2008-04-11 22:10:42 UTC (rev 10544)
+++ branches/JBoss_Portal_Branch_2_7/core/build.xml 2008-04-11 22:23:08 UTC (rev 10545)
@@ -650,6 +650,10 @@
name="org.jboss.portal.test.core.model.portal.PortalObjectIdTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.core.model.portal.PortalObjectPathTestCase"/>
+ <test todir="${test.reports}"
+ name="org.jboss.portal.test.core.portlet.PortletRequestDecoderTestCase"/>
+ <test todir="${test.reports}"
+ name="org.jboss.portal.test.core.portlet.PortletRequestEncoderTestCase"/>
</x-test>
<x-classpath>
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/InstanceCommandFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/InstanceCommandFactory.java 2008-04-11 22:10:42 UTC (rev 10544)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/InstanceCommandFactory.java 2008-04-11 22:23:08 UTC (rev 10545)
@@ -27,7 +27,7 @@
import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
import org.jboss.portal.core.model.instance.command.action.InvokePortletInstanceActionCommand;
import org.jboss.portal.core.model.instance.command.action.InvokePortletInstanceRenderCommand;
-import org.jboss.portal.portlet.impl.PortletRequestDecoder;
+import org.jboss.portal.core.portlet.PortletRequestDecoder;
import org.jboss.portal.server.ServerInvocation;
/**
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/InstanceURLFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/InstanceURLFactory.java 2008-04-11 22:10:42 UTC (rev 10544)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/InstanceURLFactory.java 2008-04-11 22:23:08 UTC (rev 10545)
@@ -29,7 +29,7 @@
import org.jboss.portal.core.model.instance.command.action.InvokePortletInstanceActionCommand;
import org.jboss.portal.core.model.instance.command.action.InvokePortletInstanceRenderCommand;
import org.jboss.portal.core.model.instance.command.render.RenderPortletInstanceCommand;
-import org.jboss.portal.portlet.impl.PortletRequestEncoder;
+import org.jboss.portal.core.portlet.PortletRequestEncoder;
import org.jboss.portal.server.AbstractServerURL;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerURL;
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java 2008-04-11 22:10:42 UTC (rev 10544)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java 2008-04-11 22:23:08 UTC (rev 10545)
@@ -37,7 +37,7 @@
import org.jboss.portal.core.model.portal.command.view.ViewPortalCommand;
import org.jboss.portal.core.model.portal.navstate.WindowNavigationalState;
import org.jboss.portal.core.navstate.NavigationalStateKey;
-import org.jboss.portal.portlet.impl.PortletRequestDecoder;
+import org.jboss.portal.core.portlet.PortletRequestDecoder;
import org.jboss.portal.server.ServerInvocation;
/**
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java 2008-04-11 22:10:42 UTC (rev 10544)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java 2008-04-11 22:23:08 UTC (rev 10545)
@@ -35,8 +35,8 @@
import org.jboss.portal.core.model.portal.command.mapping.PortalObjectPathMapper;
import org.jboss.portal.core.model.portal.command.view.ViewPageCommand;
import org.jboss.portal.core.model.portal.command.view.ViewPortalCommand;
+import org.jboss.portal.core.portlet.PortletRequestEncoder;
import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.impl.PortletRequestEncoder;
import org.jboss.portal.server.AbstractServerURL;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerURL;
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestDecoder.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestDecoder.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestDecoder.java 2008-04-11 22:23:08 UTC (rev 10545)
@@ -0,0 +1,324 @@
+/******************************************************************************
+ * 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.core.portlet;
+
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.OpaqueStateString;
+
+import java.util.Map;
+import java.util.Iterator;
+
+/**
+ * This class is a possible implementation for the behavior of a request made to a portlet. Which means that this
+ * implementation does not preclude other implementations.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 6549 $
+ */
+public class PortletRequestDecoder
+{
+
+ /** The mask for action. */
+ public static final int ACTION_MASK = 0x00000001;
+
+ /** The mask for render. */
+ public static final int RENDER_MASK = 0x00000002;
+
+ /** The mask for mode. */
+ public static final int MODE_MASK = 0x00000004;
+
+ /** The mask for window state. */
+ public static final int WINDOW_STATE_MASK = 0x00000008;
+
+ /** The mask for opacity. */
+ public static final int OPAQUE_MASK = 0x00000010;
+
+ /** The name of the URL parameter containing the mode. */
+ public static final String MODE_PARAMETER = "mode";
+
+ /** The name of the URL parameter containing the window state. */
+ public static final String WINDOW_STATE_PARAMETER = "windowstate";
+
+ /** The name of the URL parameter containing the interaction state. */
+ public static final String INTERACTION_STATE_PARAMETER = "is";
+
+ /** The name of the URL parameter containing the navigational state. */
+ public static final String NAVIGATIONAL_STATE_PARAMETER = "ns";
+
+ /** The name of the URL parameter containing the meta information. */
+ public static final String META_PARAMETER = "action";
+
+ /** . */
+ public static final int ACTION_TYPE = 0;
+
+ /** . */
+ public static final int RENDER_TYPE = 1;
+
+ /** . */
+ public static final int NAV_TYPE = 2;
+
+ /** . */
+ private Mode mode;
+
+ /** . */
+ private WindowState windowState;
+
+ /** . */
+ private StateString navigationalstate;
+
+ /** . */
+ private StateString interactionState;
+
+ /** . */
+ private ParameterMap form;
+
+ /** . */
+ private int type;
+
+ public void decode(Map queryParams, Map bodyParams) throws IllegalArgumentException
+ {
+ // The meta info from the URL
+ int meta = 0;
+ String[] metaParam = (String[])queryParams.get(META_PARAMETER);
+ if (metaParam != null)
+ {
+ try
+ {
+ meta = Integer.parseInt(metaParam[0], 16);
+ }
+ catch (NumberFormatException ignore)
+ {
+ // If mask is not present then we assume that it can only be a navigation URL (NAV_TYPE)
+ }
+ }
+
+ //
+ if ((meta & (ACTION_MASK | RENDER_MASK)) != 0)
+ {
+ // Check validity
+ if ((meta & (ACTION_MASK | RENDER_MASK)) == (ACTION_MASK | RENDER_MASK))
+ {
+ throw new IllegalArgumentException("Cannot have both action and render in the mask at the same time");
+ }
+
+ //
+ if ((meta & ACTION_MASK) != 0)
+ {
+ type = ACTION_TYPE;
+ }
+ else
+ {
+ type = RENDER_TYPE;
+ }
+
+ // Get the mode from the parameters if it exists
+ if ((meta & MODE_MASK) != 0)
+ {
+ String[] modeParam = (String[])queryParams.get(MODE_PARAMETER);
+ if (modeParam == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ mode = Mode.create(modeParam[0]);
+ }
+ else
+ {
+ mode = null;
+ }
+
+ // Get the window state from the parameters if it exists
+ if ((meta & WINDOW_STATE_MASK) != 0)
+ {
+ String[] windowStateParam = (String[])queryParams.get(WINDOW_STATE_PARAMETER);
+ if (windowStateParam == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ windowState = WindowState.create(windowStateParam[0]);
+ }
+ else
+ {
+ windowState = null;
+ }
+
+ //
+ boolean opaque = (meta & OPAQUE_MASK) != 0;
+ if (!opaque)
+ {
+ // Compute the parameters skipping the portlet navigational state that may be encoded as well
+ ParametersStateString query = ParametersStateString.create();
+ for (Iterator i = queryParams.entrySet().iterator(); i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ int index = 0;
+ String name = (String)entry.getKey();
+ String[] queryValues = (String[])entry.getValue();
+
+ //
+ if (META_PARAMETER.equals(name))
+ {
+ index = 1;
+ }
+ else if ((meta & MODE_MASK) != 0 && MODE_PARAMETER.equals(name))
+ {
+ index = 1;
+ }
+ else if ((meta & WINDOW_STATE_MASK) != 0 && WINDOW_STATE_PARAMETER.equals(name))
+ {
+ index = 1;
+ }
+
+ // We have interaction param(s) in the query string
+ if (index < queryValues.length)
+ {
+ String[] values = new String[queryValues.length - index];
+ System.arraycopy(queryValues, index, values, 0, values.length);
+ query.setValues(name, values);
+ }
+ }
+
+ // Julien :
+ ParameterMap form = new ParameterMap();
+ if (bodyParams != null)
+ {
+ form.putAll(bodyParams);
+ }
+
+ //
+ if (type == ACTION_TYPE)
+ {
+ this.navigationalstate = null;
+ this.interactionState = query;
+ this.form = form;
+ }
+ else
+ {
+ this.navigationalstate = query;
+ this.interactionState = null;
+ this.form = null;
+ }
+ }
+ else
+ {
+ // Decode the navigational state
+ String[] ns = (String[])queryParams.get(NAVIGATIONAL_STATE_PARAMETER);
+ if (ns != null)
+ {
+ navigationalstate = new OpaqueStateString(ns[0]);
+ }
+ else
+ {
+ navigationalstate = null;
+ }
+
+ // Decode more if we have an action
+ if (type == ACTION_TYPE)
+ {
+ // Decode the interaction state
+ String[] is = (String[])queryParams.get(INTERACTION_STATE_PARAMETER);
+ if (is != null)
+ {
+ interactionState = new OpaqueStateString(is[0]);
+ }
+ else
+ {
+ interactionState = null;
+ }
+
+ //
+ form = new ParameterMap();
+ if (bodyParams != null)
+ {
+ form.putAll(bodyParams);
+ }
+ }
+ else
+ {
+ interactionState = null;
+ form = null;
+ }
+ }
+ }
+ else
+ {
+ // Set to nav type
+ type = NAV_TYPE;
+
+ // Get the mode from the parameters if it exists
+ String[] modeParam = (String[])queryParams.get(MODE_PARAMETER);
+ if (modeParam != null)
+ {
+ mode = Mode.create(modeParam[0]);
+ }
+ else
+ {
+ mode = null;
+ }
+
+ // Get the window state from the parameters if it exists
+ String[] windowStateParam = (String[])queryParams.get(WINDOW_STATE_PARAMETER);
+ if (windowStateParam != null)
+ {
+ windowState = WindowState.create(windowStateParam[0]);
+ }
+ else
+ {
+ windowState = null;
+ }
+ }
+ }
+
+ public Mode getMode()
+ {
+ return mode;
+ }
+
+ public WindowState getWindowState()
+ {
+ return windowState;
+ }
+
+ public StateString getNavigationalState()
+ {
+ return navigationalstate;
+ }
+
+ public StateString getInteractionState()
+ {
+ return interactionState;
+ }
+
+ public ParameterMap getForm()
+ {
+ return form;
+ }
+
+ public int getType()
+ {
+ return type;
+ }
+}
\ No newline at end of file
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestEncoder.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestEncoder.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestEncoder.java 2008-04-11 22:23:08 UTC (rev 10545)
@@ -0,0 +1,204 @@
+/******************************************************************************
+ * 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.core.portlet;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.common.util.ParameterMap;
+
+import java.util.Map;
+import java.util.Iterator;
+
+/**
+ * This class is designed to provide the encoding in the query string of a URL of the following state :
+ * <ul>
+ * <li>A set of parameters</li>
+ * <li>A mode value</li>
+ * <li>A window state value</li>
+ * <li>A invocation type (action or render)</li>
+ * </ul>
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletRequestEncoder
+{
+
+ /** . */
+ private ParameterMap queryParameters;
+
+ public PortletRequestEncoder(ParameterMap queryParameters)
+ {
+ if (queryParameters == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.queryParameters = queryParameters;
+ }
+
+ public PortletRequestEncoder()
+ {
+ this(new ParameterMap());
+ }
+
+ public void encodeAction(
+ StateString navigationalState,
+ StateString interactionState,
+ Mode mode,
+ WindowState windowState) throws IllegalArgumentException
+ {
+ queryParameters.clear();
+
+ //
+ int meta = PortletRequestDecoder.ACTION_MASK;
+
+ //
+ if (interactionState != null)
+ {
+ if (interactionState instanceof ParametersStateString)
+ {
+ if (navigationalState != null)
+ {
+ throw new IllegalArgumentException("Cannot handle case with both non opaque interaction and navigational state");
+ }
+
+ // Add the parameters
+ Map<String, String[]> parameters = ((ParametersStateString)interactionState).getParameters();
+ configure(parameters);
+ }
+ else
+ {
+ meta |= PortletRequestDecoder.OPAQUE_MASK;
+
+ // Set interaction state
+ queryParameters.setValue(PortletRequestDecoder.INTERACTION_STATE_PARAMETER, interactionState.getStringValue());
+
+ // We may have navigational state
+ if (navigationalState != null)
+ {
+ queryParameters.setValue(PortletRequestDecoder.NAVIGATIONAL_STATE_PARAMETER, navigationalState.getStringValue());
+ }
+ }
+ }
+
+ //
+ configure(meta, mode, windowState);
+ }
+
+ public void encodeRender(
+ StateString navigationalState,
+ Mode mode,
+ WindowState windowState)
+ {
+ queryParameters.clear();
+
+ //
+ if (navigationalState != null)
+ {
+ int meta = PortletRequestDecoder.RENDER_MASK;
+
+ //
+ if (navigationalState instanceof ParametersStateString)
+ {
+ // Add the parameters
+ Map<String, String[]> parameters = ((ParametersStateString)navigationalState).getParameters();
+ configure(parameters);
+ }
+ else
+ {
+ meta |= PortletRequestDecoder.OPAQUE_MASK;
+
+ //
+ queryParameters.setValue(PortletRequestDecoder.NAVIGATIONAL_STATE_PARAMETER, navigationalState.getStringValue());
+ }
+
+ //
+ configure(meta, mode, windowState);
+ }
+ else
+ {
+ if (mode != null)
+ {
+ queryParameters.setValue(PortletRequestDecoder.MODE_PARAMETER, mode.toString());
+ }
+
+ //
+ if (windowState != null)
+ {
+ queryParameters.setValue(PortletRequestDecoder.WINDOW_STATE_PARAMETER, windowState.toString());
+ }
+ }
+ }
+
+ public ParameterMap getQueryParameters()
+ {
+ return queryParameters;
+ }
+
+ private void configure(Map<String, String[]> parameters)
+ {
+ for (Iterator i = parameters.entrySet().iterator(); i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ String name = (String)entry.getKey();
+ String[] values = (String[])entry.getValue();
+ queryParameters.setValues(name, values);
+ }
+ }
+
+ private void configure(int meta, Mode mode, WindowState windowState)
+ {
+ if (mode != null)
+ {
+ meta |= PortletRequestDecoder.MODE_MASK;
+ setMetaParameter(PortletRequestDecoder.MODE_PARAMETER, mode.toString());
+ }
+ if (windowState != null)
+ {
+ meta |= PortletRequestDecoder.WINDOW_STATE_MASK;
+ setMetaParameter(PortletRequestDecoder.WINDOW_STATE_PARAMETER, windowState.toString());
+ }
+ setMetaParameter(PortletRequestDecoder.META_PARAMETER, Integer.toHexString(meta));
+ }
+
+ private void setMetaParameter(String name, String value)
+ {
+ String[] values = queryParameters.getValues(name);
+ if (values == null)
+ {
+ values = new String[]{value};
+ }
+ else
+ {
+ String[] tmp = new String[values.length + 1];
+ System.arraycopy(values, 0, tmp, 1, values.length);
+ tmp[0] = value;
+ values = tmp;
+ }
+ queryParameters.setValues(name, values);
+ }
+}
\ No newline at end of file
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/portlet/PortletRequestDecoderTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/portlet/PortletRequestDecoderTestCase.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/portlet/PortletRequestDecoderTestCase.java 2008-04-11 22:23:08 UTC (rev 10545)
@@ -0,0 +1,678 @@
+/******************************************************************************
+ * 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.core.portlet;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.core.portlet.PortletRequestDecoder;
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.portlet.OpaqueStateString;
+import org.jboss.portal.portlet.ParametersStateString;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 6549 $
+ */
+public class PortletRequestDecoderTestCase extends TestCase
+{
+
+ public PortletRequestDecoderTestCase()
+ {
+ }
+
+ private String[] asStringArray(String s)
+ {
+ return new String[]{s};
+ }
+
+
+ public void testCorruped()
+ {
+ Map queryParams = new HashMap();
+ Map bodyParams = new HashMap();
+ PortletRequestDecoder o = new PortletRequestDecoder();
+
+ // Action + Render
+ try
+ {
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK | PortletRequestDecoder.ACTION_MASK)));
+ o.decode(queryParams, null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ queryParams.clear();
+ }
+
+ // Action + Mode
+ try
+ {
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.MODE_MASK | PortletRequestDecoder.ACTION_MASK)));
+ o.decode(queryParams, null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ queryParams.clear();
+ }
+ try
+ {
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.MODE_MASK | PortletRequestDecoder.ACTION_MASK)));
+ bodyParams.put(PortletRequestDecoder.MODE_PARAMETER, asStringArray(Mode.VIEW.toString()));
+ o.decode(queryParams, bodyParams);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ queryParams.clear();
+ bodyParams.clear();
+ }
+
+ // Action + WindowState
+ try
+ {
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.WINDOW_STATE_MASK | PortletRequestDecoder.ACTION_MASK)));
+ o.decode(queryParams, null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ queryParams.clear();
+ }
+ try
+ {
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.WINDOW_STATE_MASK | PortletRequestDecoder.ACTION_MASK)));
+ bodyParams.put(PortletRequestDecoder.WINDOW_STATE_PARAMETER, asStringArray(WindowState.NORMAL.toString()));
+ o.decode(queryParams, bodyParams);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ queryParams.clear();
+ bodyParams.clear();
+ }
+
+ // Render + Mode
+ try
+ {
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.MODE_MASK | PortletRequestDecoder.RENDER_MASK)));
+ o.decode(queryParams, null);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ queryParams.clear();
+ }
+ try
+ {
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.MODE_MASK | PortletRequestDecoder.ACTION_MASK)));
+ bodyParams.put(PortletRequestDecoder.MODE_PARAMETER, asStringArray(Mode.VIEW.toString()));
+ o.decode(queryParams, bodyParams);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ queryParams.clear();
+ bodyParams.clear();
+ }
+
+ // Render + WindowState
+ try
+ {
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.WINDOW_STATE_MASK | PortletRequestDecoder.RENDER_MASK)));
+ o.decode(queryParams, bodyParams);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ queryParams.clear();
+ }
+ try
+ {
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.WINDOW_STATE_MASK | PortletRequestDecoder.ACTION_MASK)));
+ bodyParams.put(PortletRequestDecoder.WINDOW_STATE_PARAMETER, asStringArray(WindowState.NORMAL.toString()));
+ o.decode(queryParams, bodyParams);
+ fail();
+ }
+ catch (IllegalArgumentException expected)
+ {
+ queryParams.clear();
+ bodyParams.clear();
+ }
+ }
+
+
+ public void testNav()
+ {
+ Map queryParams = new HashMap();
+ Map bodyParams = new HashMap();
+ PortletRequestDecoder o = new PortletRequestDecoder();
+
+ // Empty
+ o.decode(queryParams, null);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ assertNull(o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.NAV_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ queryParams.clear();
+
+ // Query mode
+ queryParams.put(PortletRequestDecoder.MODE_PARAMETER, asStringArray(Mode.VIEW.toString()));
+ o.decode(queryParams, null);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ assertNull(o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.NAV_TYPE, o.getType());
+ assertEquals(Mode.VIEW, o.getMode());
+ assertNull(o.getWindowState());
+ queryParams.clear();
+
+ // Query mode two values
+ queryParams.put(PortletRequestDecoder.MODE_PARAMETER, new String[]{Mode.VIEW.toString(), Mode.EDIT.toString()});
+ o.decode(queryParams, null);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ assertNull(o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.NAV_TYPE, o.getType());
+ assertEquals(Mode.VIEW, o.getMode());
+ assertNull(o.getWindowState());
+ queryParams.clear();
+
+ // Body mode
+ bodyParams.put(PortletRequestDecoder.MODE_PARAMETER, asStringArray(Mode.VIEW.toString()));
+ o.decode(queryParams, bodyParams);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ assertNull(o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.NAV_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ bodyParams.clear();
+
+ // Query mode + Body mode
+ queryParams.put(PortletRequestDecoder.MODE_PARAMETER, new String[]{Mode.VIEW.toString()});
+ bodyParams.put(PortletRequestDecoder.MODE_PARAMETER, new String[]{Mode.EDIT.toString()});
+ o.decode(queryParams, bodyParams);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ assertNull(o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.NAV_TYPE, o.getType());
+ assertEquals(Mode.VIEW, o.getMode());
+ assertNull(o.getWindowState());
+ queryParams.clear();
+ bodyParams.clear();
+
+ // Query window state
+ queryParams.put(PortletRequestDecoder.WINDOW_STATE_PARAMETER, asStringArray(WindowState.NORMAL.toString()));
+ o.decode(queryParams, null);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ assertNull(o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.NAV_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertEquals(WindowState.NORMAL, o.getWindowState());
+ queryParams.clear();
+
+ // Body window state
+ bodyParams.put(PortletRequestDecoder.WINDOW_STATE_PARAMETER, asStringArray(WindowState.NORMAL.toString()));
+ o.decode(queryParams, bodyParams);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ assertNull(o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.NAV_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ bodyParams.clear();
+ }
+
+
+ public void testRender()
+ {
+ Map queryParams = new HashMap();
+ PortletRequestDecoder o = new PortletRequestDecoder();
+
+ // Empty
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK)));
+ o.decode(queryParams, null);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ assertEquals(ParametersStateString.create(), o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.RENDER_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ queryParams.clear();
+
+ // Query mode
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK | PortletRequestDecoder.MODE_MASK)));
+ queryParams.put(PortletRequestDecoder.MODE_PARAMETER, asStringArray(Mode.VIEW.toString()));
+ o.decode(queryParams, null);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ assertEquals(ParametersStateString.create(), o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.RENDER_TYPE, o.getType());
+ assertEquals(Mode.VIEW, o.getMode());
+ assertNull(o.getWindowState());
+ queryParams.clear();
+
+ // Query window state
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK | PortletRequestDecoder.WINDOW_STATE_MASK)));
+ queryParams.put(PortletRequestDecoder.WINDOW_STATE_PARAMETER, asStringArray(WindowState.NORMAL.toString()));
+ o.decode(queryParams, null);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ assertEquals(ParametersStateString.create(), o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.RENDER_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertEquals(WindowState.NORMAL, o.getWindowState());
+ queryParams.clear();
+ }
+
+
+ public void testRenderNonOpaque()
+ {
+ Map queryParams = new HashMap();
+ Map bodyParams = new HashMap();
+ PortletRequestDecoder o = new PortletRequestDecoder();
+ ParametersStateString navState = ParametersStateString.create();
+
+ // Query parameter
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK)));
+ queryParams.put("foo", asStringArray("bar"));
+ o.decode(queryParams, null);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ navState.setValue("foo", "bar");
+ assertEquals(navState, o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.RENDER_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ navState.clear();
+ queryParams.clear();
+
+ // Query meta parameter
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, new String[]{Integer.toHexString(PortletRequestDecoder.RENDER_MASK), "bar"});
+ o.decode(queryParams, null);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ navState.setValue(PortletRequestDecoder.META_PARAMETER, "bar");
+ assertEquals(navState, o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.RENDER_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ navState.clear();
+ queryParams.clear();
+
+ // Query window state parameter + window state meta parameter
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, new String[]{Integer.toHexString(PortletRequestDecoder.RENDER_MASK | PortletRequestDecoder.WINDOW_STATE_MASK)});
+ queryParams.put(PortletRequestDecoder.WINDOW_STATE_PARAMETER, new String[]{WindowState.NORMAL.toString(), "bar"});
+ o.decode(queryParams, null);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ navState.setValue(PortletRequestDecoder.WINDOW_STATE_PARAMETER, "bar");
+ assertEquals(navState, o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.RENDER_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertEquals(WindowState.NORMAL, o.getWindowState());
+ navState.clear();
+ queryParams.clear();
+
+ // Query window state parameter
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, new String[]{Integer.toHexString(PortletRequestDecoder.RENDER_MASK)});
+ queryParams.put(PortletRequestDecoder.WINDOW_STATE_PARAMETER, new String[]{"bar"});
+ o.decode(queryParams, null);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ navState.setValue(PortletRequestDecoder.WINDOW_STATE_PARAMETER, "bar");
+ assertEquals(navState, o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.RENDER_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ navState.clear();
+ queryParams.clear();
+
+ // Query mode parameter + mode meta parameter
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, new String[]{Integer.toHexString(PortletRequestDecoder.RENDER_MASK | PortletRequestDecoder.MODE_MASK)});
+ queryParams.put(PortletRequestDecoder.MODE_PARAMETER, new String[]{Mode.VIEW.toString(), "bar"});
+ o.decode(queryParams, null);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ navState.setValue(PortletRequestDecoder.MODE_PARAMETER, "bar");
+ assertEquals(navState, o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.RENDER_TYPE, o.getType());
+ assertEquals(Mode.VIEW, o.getMode());
+ assertNull(o.getWindowState());
+ navState.clear();
+ queryParams.clear();
+
+ // Query mode parameter
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, new String[]{Integer.toHexString(PortletRequestDecoder.RENDER_MASK)});
+ queryParams.put(PortletRequestDecoder.MODE_PARAMETER, new String[]{"bar"});
+ o.decode(queryParams, null);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ navState.setValue(PortletRequestDecoder.MODE_PARAMETER, "bar");
+ assertEquals(navState, o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.RENDER_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ navState.clear();
+ queryParams.clear();
+
+ // Body parameter
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK)));
+ bodyParams.put("foo", asStringArray("bar2"));
+ o.decode(queryParams, bodyParams);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ assertEquals(navState, o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.RENDER_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ navState.clear();
+ queryParams.clear();
+ bodyParams.clear();
+
+ // Query multivalued parameter
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK)));
+ queryParams.put("foo", new String[]{"bar1", "bar2"});
+ o.decode(queryParams, null);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ navState.setValues("foo", new String[]{"bar1", "bar2"});
+ assertEquals(navState, o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.RENDER_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ navState.clear();
+ queryParams.clear();
+
+ // Query + Body parameter
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK)));
+ queryParams.put("foo", new String[]{"bar1"});
+ bodyParams.put("foo", new String[]{"bar2"});
+ o.decode(queryParams, bodyParams);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ navState.setValue("foo", "bar1");
+ assertEquals(navState, o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.RENDER_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ navState.clear();
+ queryParams.clear();
+ bodyParams.clear();
+ }
+
+
+ public void testRenderOpaque()
+ {
+ Map queryParams = new HashMap();
+ Map bodyParams = new HashMap();
+ PortletRequestDecoder o = new PortletRequestDecoder();
+
+ // Empty
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK | PortletRequestDecoder.OPAQUE_MASK)));
+ o.decode(queryParams, null);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ assertNull(o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.RENDER_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ queryParams.clear();
+
+ // Query nav state
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK | PortletRequestDecoder.OPAQUE_MASK)));
+ queryParams.put(PortletRequestDecoder.NAVIGATIONAL_STATE_PARAMETER, asStringArray("navstatevalue"));
+ o.decode(queryParams, bodyParams);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ assertEquals(new OpaqueStateString("navstatevalue"), o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.RENDER_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ queryParams.clear();
+
+ // Body nav state
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK | PortletRequestDecoder.OPAQUE_MASK)));
+ bodyParams.put(PortletRequestDecoder.NAVIGATIONAL_STATE_PARAMETER, asStringArray("navstatevalue"));
+ o.decode(queryParams, bodyParams);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ assertNull(o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.RENDER_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ queryParams.clear();
+ bodyParams.clear();
+
+ // Query int state is ignored
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK | PortletRequestDecoder.OPAQUE_MASK)));
+ queryParams.put(PortletRequestDecoder.INTERACTION_STATE_PARAMETER, asStringArray("intstatevalue"));
+ o.decode(queryParams, null);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ assertNull(o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.RENDER_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ queryParams.clear();
+
+ // Body int state is ignored
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK | PortletRequestDecoder.OPAQUE_MASK)));
+ bodyParams.put(PortletRequestDecoder.INTERACTION_STATE_PARAMETER, asStringArray("intstatevalue"));
+ o.decode(queryParams, bodyParams);
+ assertNull(o.getForm());
+ assertNull(o.getInteractionState());
+ assertNull(o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.RENDER_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ queryParams.clear();
+ bodyParams.clear();
+ }
+
+
+ public void testAction()
+ {
+ Map queryParams = new HashMap();
+ PortletRequestDecoder o = new PortletRequestDecoder();
+
+ // Empty
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK)));
+ o.decode(queryParams, null);
+ assertEquals(new ParameterMap(), o.getForm());
+ assertEquals(ParametersStateString.create(), o.getInteractionState());
+ assertNull(o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.ACTION_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ queryParams.clear();
+
+ // Query mode
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK | PortletRequestDecoder.MODE_MASK)));
+ queryParams.put(PortletRequestDecoder.MODE_PARAMETER, asStringArray(Mode.VIEW.toString()));
+ o.decode(queryParams, null);
+ assertEquals(new ParameterMap(), o.getForm());
+ assertEquals(ParametersStateString.create(), o.getInteractionState());
+ assertNull(o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.ACTION_TYPE, o.getType());
+ assertEquals(Mode.VIEW, o.getMode());
+ assertNull(o.getWindowState());
+ queryParams.clear();
+
+ // Query window state
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK | PortletRequestDecoder.WINDOW_STATE_MASK)));
+ queryParams.put(PortletRequestDecoder.WINDOW_STATE_PARAMETER, asStringArray(WindowState.NORMAL.toString()));
+ o.decode(queryParams, null);
+ assertEquals(new ParameterMap(), o.getForm());
+ assertEquals(ParametersStateString.create(), o.getInteractionState());
+ assertNull(o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.ACTION_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertEquals(WindowState.NORMAL, o.getWindowState());
+ queryParams.clear();
+ }
+
+
+ public void testActionNonOpaque()
+ {
+ Map queryParams = new HashMap();
+ Map bodyParams = new HashMap();
+ PortletRequestDecoder o = new PortletRequestDecoder();
+ ParametersStateString intState = ParametersStateString.create();
+ ParameterMap form = new ParameterMap();
+
+ // Query parameter
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK)));
+ queryParams.put("foo", asStringArray("bar"));
+ o.decode(queryParams, null);
+ assertEquals(form, o.getForm());
+ intState.setValue("foo", "bar");
+ assertEquals(intState, o.getInteractionState());
+ assertNull(o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.ACTION_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ intState.clear();
+ queryParams.clear();
+ form.clear();
+
+ // Query multivalued parameter
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK)));
+ queryParams.put("foo", new String[]{"bar1", "bar2"});
+ o.decode(queryParams, null);
+ assertEquals(form, o.getForm());
+ intState.setValues("foo", new String[]{"bar1", "bar2"});
+ assertEquals(intState, o.getInteractionState());
+ assertNull(o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.ACTION_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ intState.clear();
+ queryParams.clear();
+ form.clear();
+
+ // Body parameter
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK)));
+ bodyParams.put("foo", asStringArray("bar"));
+ o.decode(queryParams, bodyParams);
+ form.setValue("foo", "bar");
+ assertEquals(form, o.getForm());
+ assertEquals(intState, o.getInteractionState());
+ assertNull(o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.ACTION_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ form.clear();
+ queryParams.clear();
+ bodyParams.clear();
+ form.clear();
+
+ // Body multivalued parameter
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK)));
+ bodyParams.put("foo", new String[]{"bar1", "bar2"});
+ o.decode(queryParams, bodyParams);
+ form.setValues("foo", new String[]{"bar1", "bar2"});
+ assertEquals(form, o.getForm());
+ assertEquals(intState, o.getInteractionState());
+ assertNull(o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.ACTION_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ form.clear();
+ queryParams.clear();
+ bodyParams.clear();
+ form.clear();
+ }
+
+
+ public void testActionOpaque()
+ {
+ Map queryParams = new HashMap();
+ Map bodyParams = new HashMap();
+ PortletRequestDecoder o = new PortletRequestDecoder();
+
+ // Empty
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK | PortletRequestDecoder.OPAQUE_MASK)));
+ o.decode(queryParams, null);
+ assertEquals(new ParameterMap(), o.getForm());
+ assertNull(o.getInteractionState());
+ assertNull(o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.ACTION_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ queryParams.clear();
+
+ // Query nav state
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK | PortletRequestDecoder.OPAQUE_MASK)));
+ queryParams.put(PortletRequestDecoder.NAVIGATIONAL_STATE_PARAMETER, asStringArray("navstatevalue"));
+ o.decode(queryParams, null);
+ assertEquals(new ParameterMap(), o.getForm());
+ assertNull(o.getInteractionState());
+ assertEquals(new OpaqueStateString("navstatevalue"), o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.ACTION_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ queryParams.clear();
+
+ // Query int state
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK | PortletRequestDecoder.OPAQUE_MASK)));
+ queryParams.put(PortletRequestDecoder.INTERACTION_STATE_PARAMETER, asStringArray("intstatevalue"));
+ o.decode(queryParams, null);
+ assertEquals(new ParameterMap(), o.getForm());
+ assertEquals(new OpaqueStateString("intstatevalue"), o.getInteractionState());
+ assertNull(o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.ACTION_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ queryParams.clear();
+
+ // Body parameters
+ queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK | PortletRequestDecoder.OPAQUE_MASK)));
+ bodyParams.put("foo1", asStringArray("bar1"));
+ bodyParams.put("foo2", new String[]{"bar2", "bar3"});
+ queryParams.put("foo3", new String[]{"bar4"});
+ bodyParams.put("foo3", new String[]{"bar5"});
+ o.decode(queryParams, bodyParams);
+ ParameterMap form = new ParameterMap();
+ form.setValue("foo1", "bar1");
+ form.setValues("foo2", new String[]{"bar2", "bar3"});
+ form.setValues("foo3", new String[]{"bar5"});
+ assertEquals(form, o.getForm());
+ assertNull(o.getInteractionState());
+ assertNull(o.getNavigationalState());
+ assertEquals(PortletRequestDecoder.ACTION_TYPE, o.getType());
+ assertNull(o.getMode());
+ assertNull(o.getWindowState());
+ queryParams.clear();
+ bodyParams.clear();
+ }
+}
\ No newline at end of file
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/portlet/PortletRequestEncoderTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/portlet/PortletRequestEncoderTestCase.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/portlet/PortletRequestEncoderTestCase.java 2008-04-11 22:23:08 UTC (rev 10545)
@@ -0,0 +1,218 @@
+/******************************************************************************
+ * 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.core.portlet;
+
+import org.jboss.portal.core.portlet.PortletRequestEncoder;
+import org.jboss.portal.core.portlet.PortletRequestDecoder;
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import junit.framework.TestCase;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletRequestEncoderTestCase extends TestCase
+{
+
+ /** . */
+ public static final int RENDER = 0;
+
+ /** . */
+ public static final int ACTION = 1;
+
+ /** . */
+ private ParameterMap params;
+
+ /** . */
+ private PortletRequestEncoder encoder;
+
+ public void setUp() throws Exception
+ {
+ params = new ParameterMap();
+ encoder = new PortletRequestEncoder(params);
+ }
+
+ public void tearDown() throws Exception
+ {
+ params = null;
+ encoder = null;
+ }
+
+
+ public void testEncodeRender()
+ {
+ _testEncodeRender(RENDER, PortletRequestDecoder.RENDER_MASK);
+ }
+
+
+ public void testEncodeAction()
+ {
+ _testEncodeRender(ACTION, PortletRequestDecoder.ACTION_MASK);
+ }
+
+ public void _testEncodeRender(int lifecycle, int lifecycleMask)
+ {
+ ParametersStateString pp = ParametersStateString.create();
+ encode(pp, null, null, lifecycle);
+ assertEquals(1, params.size());
+ _assertEquals(lifecycleMask, params.getValues(PortletRequestDecoder.META_PARAMETER));
+
+ //
+ pp = ParametersStateString.create();
+ pp.setValue(PortletRequestDecoder.META_PARAMETER, "foo");
+ encode(pp, null, null, lifecycle);
+ assertEquals(1, params.size());
+ _assertEquals(new String[]{Integer.toHexString(lifecycleMask),"foo"}, params.getValues(PortletRequestDecoder.META_PARAMETER));
+
+ //
+ pp = ParametersStateString.create();
+ pp.setValue("foo", "bar");
+ encode(pp, null, null, lifecycle);
+ assertEquals(2, params.size());
+ _assertEquals(lifecycleMask, params.getValues(PortletRequestDecoder.META_PARAMETER));
+ _assertEquals("bar", params.getValues("foo"));
+
+ //
+ pp = ParametersStateString.create();
+ encode(pp, Mode.VIEW, null, lifecycle);
+ assertEquals(2, params.size());
+ _assertEquals(lifecycleMask | PortletRequestDecoder.MODE_MASK, params.getValues(PortletRequestDecoder.META_PARAMETER));
+ _assertEquals(Mode.VIEW, params.getValues(PortletRequestDecoder.MODE_PARAMETER));
+
+ //
+ pp = ParametersStateString.create();
+ pp.setValue(PortletRequestDecoder.MODE_PARAMETER, "foo");
+ encode(pp, Mode.VIEW, null, lifecycle);
+ assertEquals(2, params.size());
+ _assertEquals(lifecycleMask | PortletRequestDecoder.MODE_MASK, params.getValues(PortletRequestDecoder.META_PARAMETER));
+ _assertEquals(new String[]{Mode.VIEW.toString(),"foo"}, params.getValues(PortletRequestDecoder.MODE_PARAMETER));
+
+ //
+ pp = ParametersStateString.create();
+ pp.setValue("foo", "bar");
+ encode(pp, Mode.VIEW, null, lifecycle);
+ assertEquals(3, params.size());
+ _assertEquals(lifecycleMask | PortletRequestDecoder.MODE_MASK, params.getValues(PortletRequestDecoder.META_PARAMETER));
+ _assertEquals(Mode.VIEW, params.getValues(PortletRequestDecoder.MODE_PARAMETER));
+ _assertEquals("bar", params.getValues("foo"));
+
+ //
+ pp = ParametersStateString.create();
+ encode(pp, null, WindowState.NORMAL, lifecycle);
+ assertEquals(2, params.size());
+ _assertEquals(lifecycleMask | PortletRequestDecoder.WINDOW_STATE_MASK, params.getValues(PortletRequestDecoder.META_PARAMETER));
+ _assertEquals(WindowState.NORMAL, params.getValues(PortletRequestDecoder.WINDOW_STATE_PARAMETER));
+
+ //
+ pp = ParametersStateString.create();
+ pp.setValue(PortletRequestDecoder.WINDOW_STATE_PARAMETER, "foo");
+ encode(pp, null, WindowState.NORMAL, lifecycle);
+ assertEquals(2, params.size());
+ _assertEquals(lifecycleMask | PortletRequestDecoder.WINDOW_STATE_MASK, params.getValues(PortletRequestDecoder.META_PARAMETER));
+ _assertEquals(new String[]{WindowState.NORMAL.toString(),"foo"}, params.getValues(PortletRequestDecoder.WINDOW_STATE_PARAMETER));
+
+ //
+ pp = ParametersStateString.create();
+ pp.setValue("foo", "bar");
+ encode(pp, null, WindowState.NORMAL, lifecycle);
+ assertEquals(3, params.size());
+ _assertEquals(lifecycleMask | PortletRequestDecoder.WINDOW_STATE_MASK, params.getValues(PortletRequestDecoder.META_PARAMETER));
+ _assertEquals(WindowState.NORMAL, params.getValues(PortletRequestDecoder.WINDOW_STATE_PARAMETER));
+ _assertEquals("bar", params.getValues("foo"));
+
+ //
+ pp = ParametersStateString.create();
+ encode(pp, Mode.VIEW, WindowState.NORMAL, lifecycle);
+ assertEquals(3, params.size());
+ _assertEquals(lifecycleMask | PortletRequestDecoder.MODE_MASK | PortletRequestDecoder.WINDOW_STATE_MASK, params.getValues(PortletRequestDecoder.META_PARAMETER));
+ _assertEquals(Mode.VIEW, params.getValues(PortletRequestDecoder.MODE_PARAMETER));
+ _assertEquals(WindowState.NORMAL, params.getValues(PortletRequestDecoder.WINDOW_STATE_PARAMETER));
+
+ //
+ pp = ParametersStateString.create();
+ pp.setValue("foo", "bar");
+ encode(pp, Mode.VIEW, WindowState.NORMAL, lifecycle);
+ assertEquals(4, params.size());
+ _assertEquals(lifecycleMask | PortletRequestDecoder.MODE_MASK | PortletRequestDecoder.WINDOW_STATE_MASK, params.getValues(PortletRequestDecoder.META_PARAMETER));
+ _assertEquals(Mode.VIEW, params.getValues(PortletRequestDecoder.MODE_PARAMETER));
+ _assertEquals(WindowState.NORMAL, params.getValues(PortletRequestDecoder.WINDOW_STATE_PARAMETER));
+ _assertEquals("bar", params.getValues("foo"));
+ }
+
+
+ public void testEncodeNav()
+ {
+ encode(null, null, null, RENDER);
+ assertEquals(0, params.size());
+
+ //
+ encode(null, Mode.VIEW, null, RENDER);
+ assertEquals(1, params.size());
+ _assertEquals(Mode.VIEW, params.getValues(PortletRequestDecoder.MODE_PARAMETER));
+
+ //
+ encode(null, null, WindowState.NORMAL, RENDER);
+ assertEquals(1, params.size());
+ _assertEquals(WindowState.NORMAL, params.getValues(PortletRequestDecoder.WINDOW_STATE_PARAMETER));
+
+ //
+ encode(null, Mode.VIEW, WindowState.NORMAL, RENDER);
+ assertEquals(2, params.size());
+ _assertEquals(Mode.VIEW, params.getValues(PortletRequestDecoder.MODE_PARAMETER));
+ _assertEquals(WindowState.NORMAL, params.getValues(PortletRequestDecoder.WINDOW_STATE_PARAMETER));
+ }
+
+ private void encode(ParametersStateString params, Mode view, WindowState normal, int lifecycle)
+ {
+ if (lifecycle == RENDER)
+ {
+ encoder.encodeRender(params, view, normal);
+ }
+ else if (lifecycle == ACTION)
+ {
+ encoder.encodeAction(null, params, view, normal);
+ }
+ else
+ {
+ fail();
+ }
+ }
+
+ void _assertEquals(int expected, String[] actual)
+ {
+ _assertEquals(new String[]{Integer.toHexString(expected)}, actual);
+ }
+
+ void _assertEquals(Object expected, String[] actual)
+ {
+ _assertEquals(new String[]{"" + expected}, actual);
+ }
+
+ void _assertEquals(String[] expected, String[] actual)
+ {
+ assertEquals(expected, actual);
+ }
+}
\ No newline at end of file
18 years
JBoss Portal SVN: r10544 - in branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core: model/instance and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-11 18:10:42 -0400 (Fri, 11 Apr 2008)
New Revision: 10544
Added:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowResourceCommand.java
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/InvokePortletCommandFactory.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/InvokePortletInstanceCommandFactory.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowActionCommand.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowRenderCommand.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokeWindowCommand.java
Log:
start to add support for resource serving
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/InvokePortletCommandFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/InvokePortletCommandFactory.java 2008-04-11 21:51:59 UTC (rev 10543)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/InvokePortletCommandFactory.java 2008-04-11 22:10:42 UTC (rev 10544)
@@ -25,6 +25,7 @@
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.portlet.ActionURL;
import org.jboss.portal.portlet.RenderURL;
+import org.jboss.portal.portlet.ResourceURL;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -47,4 +48,12 @@
* @return a controller command
*/
ControllerCommand createInvokeRenderCommand(RenderURL portletURL);
+
+ /**
+ * Creates a command that will trigger the resource url.
+ *
+ * @param resourceURL the resource url
+ * @return a controller command
+ */
+ ControllerCommand createInvokeResourceCommand(ResourceURL resourceURL);
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2008-04-11 21:51:59 UTC (rev 10543)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2008-04-11 22:10:42 UTC (rev 10544)
@@ -36,10 +36,12 @@
import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowActionCommand;
import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowRenderCommand;
+import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowResourceCommand;
import org.jboss.portal.portlet.ActionURL;
import org.jboss.portal.portlet.ContainerURL;
import org.jboss.portal.portlet.RenderURL;
import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.ResourceURL;
import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.PortletInvocation;
@@ -224,16 +226,27 @@
Boolean wantAuthenticated,
boolean relative)
{
- ControllerCommand cmd;
+ ControllerCommand cmd = null;
+
+ //
if (containerURL instanceof ActionURL)
{
cmd = factory.createInvokeActionCommand((ActionURL)containerURL);
}
- else
+ else if (containerURL instanceof RenderURL)
{
cmd = factory.createInvokeRenderCommand((RenderURL)containerURL);
}
+ else if (containerURL instanceof ResourceURL)
+ {
+ cmd = factory.createInvokeResourceCommand((ResourceURL)containerURL);
+ }
+ if (cmd == null)
+ {
+ throw new IllegalArgumentException("No container url such as " + containerURL + " can be rendered by the core");
+ }
+
//
boolean secure = controllerContext.getServerInvocation().getServerContext().getURLContext().isSecure();
if (wantSecure != null)
@@ -318,5 +331,18 @@
{
return new InvokePortletWindowRenderCommand(window.getId(), renderURL.getMode(), renderURL.getWindowState(), renderURL.getNavigationalState());
}
+
+ public ControllerCommand createInvokeResourceCommand(ResourceURL resourceURL)
+ {
+ return new InvokePortletWindowResourceCommand(
+ window.getId(),
+ resourceURL.getMode(),
+ resourceURL.getWindowState(),
+ resourceURL.getCacheability(),
+ resourceURL.getResourceId(),
+ resourceURL.getResourceState(),
+ null
+ );
+ }
}
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/InvokePortletInstanceCommandFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/InvokePortletInstanceCommandFactory.java 2008-04-11 21:51:59 UTC (rev 10543)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/instance/InvokePortletInstanceCommandFactory.java 2008-04-11 22:10:42 UTC (rev 10544)
@@ -28,6 +28,7 @@
import org.jboss.portal.core.model.instance.command.action.InvokePortletInstanceRenderCommand;
import org.jboss.portal.portlet.ActionURL;
import org.jboss.portal.portlet.RenderURL;
+import org.jboss.portal.portlet.ResourceURL;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -59,4 +60,12 @@
instanceId,
portletURL.getNavigationalState());
}
+
+ /**
+ * We don't implement (yet?) for instances as it is rather internal and not needed yet.
+ */
+ public ControllerCommand createInvokeResourceCommand(ResourceURL resourceURL)
+ {
+ return null;
+ }
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowActionCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowActionCommand.java 2008-04-11 21:51:59 UTC (rev 10543)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowActionCommand.java 2008-04-11 22:10:42 UTC (rev 10544)
@@ -35,7 +35,7 @@
import org.jboss.portal.identity.User;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.controller.request.PortletActionRequest;
-import org.jboss.portal.portlet.controller.request.PortletRequest;
+import org.jboss.portal.portlet.controller.request.ContainerRequest;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
@@ -138,7 +138,7 @@
return context.getController().getCustomizationManager().getInstance(window, user);
}
- protected PortletRequest createPortletRequest(PageNavigationalState pageNS, WindowNavigationalState windowNS)
+ protected ContainerRequest createPortletRequest(PageNavigationalState pageNS, WindowNavigationalState windowNS)
{
return new PortletActionRequest(
window.getName(),
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowRenderCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowRenderCommand.java 2008-04-11 21:51:59 UTC (rev 10543)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowRenderCommand.java 2008-04-11 22:10:42 UTC (rev 10544)
@@ -29,7 +29,7 @@
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.controller.request.PortletRenderRequest;
-import org.jboss.portal.portlet.controller.request.PortletRequest;
+import org.jboss.portal.portlet.controller.request.ContainerRequest;
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
@@ -44,6 +44,7 @@
public class InvokePortletWindowRenderCommand extends InvokeWindowCommand
{
+ /** . */
private static final CommandInfo info = new ActionCommandInfo(true);
/** . */
@@ -84,7 +85,7 @@
return info;
}
- protected PortletRequest createPortletRequest(PageNavigationalState pageNS, WindowNavigationalState windowNS)
+ protected ContainerRequest createPortletRequest(PageNavigationalState pageNS, WindowNavigationalState windowNS)
{
Mode newMode = null;
WindowState newWindowState = null;
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowResourceCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowResourceCommand.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokePortletWindowResourceCommand.java 2008-04-11 22:10:42 UTC (rev 10544)
@@ -0,0 +1,108 @@
+/******************************************************************************
+ * 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.core.model.portal.command.action;
+
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.portlet.controller.request.PortletResourceRequest;
+import org.jboss.portal.portlet.controller.request.ContainerRequest;
+import org.jboss.portal.portlet.controller.state.PageNavigationalState;
+import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
+import org.jboss.portal.portlet.cache.CacheLevel;
+import org.jboss.portal.portlet.StateString;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class InvokePortletWindowResourceCommand extends InvokeWindowCommand
+{
+
+ /** . */
+ private static final CommandInfo info = new ActionCommandInfo(true);
+
+ /** . */
+ private final CacheLevel cacheLevel;
+
+ /** . */
+ private final String resourceId;
+
+ /** . */
+ private final StateString resourceState;
+
+ /** . */
+ private final ParameterMap resourceForm;
+
+ public InvokePortletWindowResourceCommand(
+ PortalObjectId windowId,
+ Mode mode,
+ WindowState windowState,
+ CacheLevel cacheLevel,
+ String resourceId,
+ StateString resourceState,
+ ParameterMap resourceForm) throws IllegalArgumentException
+ {
+ super(windowId, mode, windowState);
+
+ //
+ this.cacheLevel = cacheLevel;
+ this.resourceId = resourceId;
+ this.resourceState = resourceState;
+ this.resourceForm = resourceForm;
+ }
+
+ public CommandInfo getInfo()
+ {
+ return info;
+ }
+
+ protected ContainerRequest createPortletRequest(PageNavigationalState pageNS, WindowNavigationalState windowNS)
+ {
+ PortletResourceRequest.Scope scope;
+ switch (cacheLevel)
+ {
+ case FULL:
+ scope = new PortletResourceRequest.FullScope();
+ break;
+ case PORTLET:
+ scope = new PortletResourceRequest.PortletScope(windowNS);
+ break;
+ case PAGE:
+ scope = new PortletResourceRequest.PageScope(windowNS, pageNS);
+ break;
+ default:
+ throw new AssertionError();
+ }
+
+ return new PortletResourceRequest(
+ window.getName(),
+ resourceId,
+ resourceState,
+ resourceForm,
+ scope);
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokeWindowCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokeWindowCommand.java 2008-04-11 21:51:59 UTC (rev 10543)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/command/action/InvokeWindowCommand.java 2008-04-11 22:10:42 UTC (rev 10544)
@@ -27,6 +27,7 @@
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
import org.jboss.portal.portlet.controller.request.PortletRequest;
+import org.jboss.portal.portlet.controller.request.ContainerRequest;
import org.jboss.portal.portlet.controller.PortletController;
import org.jboss.portal.portlet.controller.response.PageUpdateResponse;
import org.jboss.portal.portlet.controller.response.PortletResponse;
@@ -72,7 +73,7 @@
return windowState;
}
- protected abstract PortletRequest createPortletRequest(PageNavigationalState pageNS, WindowNavigationalState windowNS);
+ protected abstract ContainerRequest createPortletRequest(PageNavigationalState pageNS, WindowNavigationalState windowNS);
public ControllerResponse execute() throws ControllerException
{
@@ -91,13 +92,13 @@
WindowNavigationalState windowNS = pageNS.getWindowNavigationalState(window.getName());
//
- PortletRequest portletRequest = createPortletRequest(pageNS, windowNS);
+ ContainerRequest containerRequest = createPortletRequest(pageNS, windowNS);
//
PortletController controller = new PortletController();
//
- org.jboss.portal.portlet.controller.response.ControllerResponse cr = controller.process(cpcc, portletRequest);
+ org.jboss.portal.portlet.controller.response.ControllerResponse cr = controller.process(cpcc, containerRequest);
//
if (cr instanceof PageUpdateResponse)
18 years
JBoss Portal SVN: r10543 - in branches/JBoss_Portal_Branch_2_7/core-samples: src/resources and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-11 17:51:59 -0400 (Fri, 11 Apr 2008)
New Revision: 10543
Added:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-portlet-samples-war/
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-portlet-samples-war/WEB-INF/
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-portlet-samples-war/WEB-INF/default-object.xml
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-portlet-samples-war/WEB-INF/portlet-instances.xml
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-portlet-samples-war/WEB-INF/portlet.xml
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-portlet-samples-war/WEB-INF/web.xml
Modified:
branches/JBoss_Portal_Branch_2_7/core-samples/build.xml
Log:
first attempt to integrate samples coming from portlet module
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/build.xml 2008-04-11 21:13:10 UTC (rev 10542)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/build.xml 2008-04-11 21:51:59 UTC (rev 10543)
@@ -239,6 +239,12 @@
<fileset dir="${build.classes}" includes="org/jboss/portal/core/samples/weather/**"/>
</jar>
+ <!-- portal-portlet-samples.war -->
+ <copy todir="${build.resources}/portal-portlet-samples.war">
+ <fileset dir="${build.resources}/portal-portlet-samples-war"/>
+ </copy>
+ <mkdir dir="${build.resources}/portal-portlet-samples.war/WEB-INF/lib/"/>
+ <copy file="${jboss.portal/modules/portlet.lib}/portal-portlet-samples-lib.jar" todir="${build.resources}/portal-portlet-samples.war/WEB-INF/lib/"/>
<!-- portal-users-samples-lib.jar -->
<jar jarfile="${build.lib}/portal-users-samples-lib.jar">
@@ -274,6 +280,9 @@
<implode
dir="${build.resources}/portal-users-samples.sar"
tofile="${build.lib}/portal-users-samples.sar"/>
+ <implode
+ dir="${build.resources}/portal-portlet-samples.war"
+ tofile="${build.lib}/portal-portlet-samples.war"/>
</target>
<!-- create artifacts for running the portlet tests (except TCK) target output should have already been executed -->
@@ -330,6 +339,8 @@
overwrite="true"/>
<copy file="${build.lib}/portal-users-samples.sar" todir="${jboss.home}/server/${portal.deploy.dir}"
overwrite="true"/>
+ <copy file="${build.lib}/portal-portlet-samples.war" todir="${jboss.home}/server/${portal.deploy.dir}"
+ overwrite="true"/>
</target>
<!--
Added: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-portlet-samples-war/WEB-INF/default-object.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-portlet-samples-war/WEB-INF/default-object.xml (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-portlet-samples-war/WEB-INF/default-object.xml 2008-04-11 21:51:59 UTC (rev 10543)
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE deployments PUBLIC
+ "-//JBoss Portal//DTD Portal Object 2.6//EN"
+ "http://www.jboss.org/portal/dtd/portal-object_2_6.dtd">
+
+<deployments>
+ <deployment>
+ <parent-ref>default</parent-ref>
+ <if-exists>keep</if-exists>
+ <page>
+ <page-name>Samples</page-name>
+ <display-name xml:lang="en">Samples</display-name>
+ <display-name xml:lang="fr">Exemples</display-name>
+<!--
+ <properties>
+ <property>
+ <name>order</name>
+ <value>3</value>
+ </property>
+ </properties>
+-->
+ <window>
+ <window-name>GoogleMapPortletWindow</window-name>
+ <instance-ref>GoogleMapPortletInstance</instance-ref>
+ <region>center</region>
+ <height>1</height>
+ </window>
+ <window>
+ <window-name>GoogleWeatherPortletWindow1</window-name>
+ <instance-ref>GoogleWeatherPortletInstance</instance-ref>
+ <region>center</region>
+ <height>2</height>
+ </window>
+ <window>
+ <window-name>GoogleWeatherPortletWindow2</window-name>
+ <instance-ref>GoogleWeatherPortletInstance</instance-ref>
+ <region>center</region>
+ <height>3</height>
+ </window>
+ <window>
+ <window-name>GoogleWeatherPortletWindow3</window-name>
+ <instance-ref>GoogleWeatherPortletInstance</instance-ref>
+ <region>center</region>
+ <height>4</height>
+ </window>
+ </page>
+ </deployment>
+</deployments>
Added: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-portlet-samples-war/WEB-INF/portlet-instances.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-portlet-samples-war/WEB-INF/portlet-instances.xml (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-portlet-samples-war/WEB-INF/portlet-instances.xml 2008-04-11 21:51:59 UTC (rev 10543)
@@ -0,0 +1,44 @@
+<?xml version="1.0" standalone="yes"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE deployments PUBLIC
+ "-//JBoss Portal//DTD Portlet Instances 2.6//EN"
+ "http://www.jboss.org/portal/dtd/portlet-instances_2_6.dtd">
+
+<deployments>
+ <deployment>
+ <instance>
+ <display-name xml:lang="en">Google Map</display-name>
+ <instance-id>GoogleMapPortletInstance</instance-id>
+ <portlet-ref>GoogleMap</portlet-ref>
+ </instance>
+ </deployment>
+ <deployment>
+ <instance>
+ <display-name xml:lang="en">Google Weather</display-name>
+ <instance-id>GoogleWeatherPortletInstance</instance-id>
+ <portlet-ref>GoogleWeather</portlet-ref>
+ </instance>
+ </deployment>
+</deployments>
\ No newline at end of file
Added: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-portlet-samples-war/WEB-INF/portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-portlet-samples-war/WEB-INF/portlet.xml (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-portlet-samples-war/WEB-INF/portlet.xml 2008-04-11 21:51:59 UTC (rev 10543)
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+ <portlet>
+ <description>Portlet displaying a location on Google Maps</description>
+ <portlet-name>GoogleMap</portlet-name>
+ <display-name>Google Map Portlet</display-name>
+ <portlet-class>org.jboss.portal.portlet.samples.google.GoogleClippingPortlet</portlet-class>
+ <expiration-cache>120</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>EDIT</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>Google Map Portlet</title>
+ <keywords>sample,map,google</keywords>
+ </portlet-info>
+ <portlet-preferences>
+ <preference>
+ <name>zipcode</name>
+ <value>94102</value>
+ <read-only>false</read-only>
+ </preference>
+ </portlet-preferences>
+ <supported-public-render-parameter>zipcode</supported-public-render-parameter>
+ </portlet>
+
+ <portlet>
+ <description>Portlet displaying the weather forecast for the specified location</description>
+ <portlet-name>GoogleWeather</portlet-name>
+ <display-name>Google Weather Portlet</display-name>
+ <portlet-class>org.jboss.portal.portlet.samples.google.GoogleWeatherClippingPortlet</portlet-class>
+ <expiration-cache>120</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <portlet-mode>EDIT</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>Google Weather Portlet</title>
+ <keywords>sample,weather,google</keywords>
+ </portlet-info>
+ <portlet-preferences>
+ <preference>
+ <name>zipcode</name>
+ <value>80201</value>
+ <read-only>false</read-only>
+ </preference>
+ </portlet-preferences>
+ <supported-public-render-parameter>zipcode</supported-public-render-parameter>
+ </portlet>
+
+ <portlet>
+ <description>Catalog Portlet</description>
+ <portlet-name>Catalog</portlet-name>
+ <display-name>Catalog Portlet</display-name>
+ <portlet-class>org.jboss.portal.portlet.samples.shoppingcart.CatalogPortlet</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>Catalog Portlet</title>
+ <keywords>sample,event,catalog</keywords>
+ </portlet-info>
+ <supported-publishing-event>
+ <qname xmlns:jbp="urn:jboss:portal:samples:event">jbp:CartEvent</qname>
+ </supported-publishing-event>
+ </portlet>
+
+ <portlet>
+ <description>Cart Portlet</description>
+ <portlet-name>Cart</portlet-name>
+ <display-name>Cart Portlet</display-name>
+ <portlet-class>org.jboss.portal.portlet.samples.shoppingcart.CartPortlet</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>Cart Portlet</title>
+ <keywords>sample,event,cart</keywords>
+ </portlet-info>
+ <supported-processing-event>
+ <qname xmlns:jbp="urn:jboss:portal:samples:event">jbp:CartEvent</qname>
+ </supported-processing-event>
+ </portlet>
+
+ <event-definition>
+ <qname xmlns:jbp="urn:jboss:portal:samples:event">jbp:CartEvent</qname>
+ <value-type>org.jboss.portal.portlet.samples.shoppingcart.CartEvent</value-type>
+ </event-definition>
+
+ <public-render-parameter>
+ <identifier>zipcode</identifier>
+ <qname xmlns:g="urn:jboss:portal:simple:google">g:zipcode</qname>
+ </public-render-parameter>
+
+ <public-render-parameter>
+ <identifier>zipcode</identifier>
+ <qname xmlns:g="urn:jboss:portal:simple:google">g:zipcode</qname>
+ </public-render-parameter>
+
+</portlet-app>
Added: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-portlet-samples-war/WEB-INF/web.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-portlet-samples-war/WEB-INF/web.xml (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-portlet-samples-war/WEB-INF/web.xml 2008-04-11 21:51:59 UTC (rev 10543)
@@ -0,0 +1,28 @@
+<?xml version="1.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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+</web-app>
18 years
JBoss Portal SVN: r10542 - in branches/JBoss_Portal_Branch_2_7: core-samples/src/resources/portal-basic-samples-war/WEB-INF and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-11 17:13:10 -0400 (Fri, 11 Apr 2008)
New Revision: 10542
Modified:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jboss-portlet.xml
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/theme/PageRendition.java
Log:
correct content type value
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/theme/PageRendition.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/theme/PageRendition.java 2008-04-11 20:54:23 UTC (rev 10541)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/theme/PageRendition.java 2008-04-11 21:13:10 UTC (rev 10542)
@@ -73,8 +73,7 @@
public void render(MarkupInfo markupInfo, ServletContextDispatcher dispatcher) throws IOException, ServletException
{
// Compute correct content type response header
-// String contentType = rendererContext.getContentType() + "; charset=" + rendererContext.getCharset();
- String contentType = markupInfo.getMediaType() + "; charset=" + markupInfo.getCharset();
+ String contentType = markupInfo.getMediaType().getValue() + "; charset=" + markupInfo.getCharset();
// Set charset and content type on the response
dispatcher.getResponse().setContentType(contentType);
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jboss-portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jboss-portlet.xml 2008-04-11 20:54:23 UTC (rev 10541)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jboss-portlet.xml 2008-04-11 21:13:10 UTC (rev 10542)
@@ -101,11 +101,6 @@
<!-- Service injected in the portlet context. -->
<service>
- <service-name>WebAppRegistry</service-name>
- <service-class>org.jboss.portal.portlet.container.PortletApplicationRegistry</service-class>
- <service-ref>:service=WebAppRegistry</service-ref>
- </service>
- <service>
<service-name>PortalObjectContainer</service-name>
<service-class>org.jboss.portal.core.model.portal.PortalObjectContainer</service-class>
<service-ref>:container=PortalObject</service-ref>
18 years
JBoss Portal SVN: r10541 - branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-11 16:54:23 -0400 (Fri, 11 Apr 2008)
New Revision: 10541
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPortletControllerContext.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerStateControllerContext.java
Log:
start to integrate a bit the public nav state
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPortletControllerContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPortletControllerContext.java 2008-04-11 20:51:17 UTC (rev 10540)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPortletControllerContext.java 2008-04-11 20:54:23 UTC (rev 10541)
@@ -127,7 +127,7 @@
NavigationalStateContext nsContext = (NavigationalStateContext)controllerContext.getAttributeResolver(ControllerCommand.NAVIGATIONAL_STATE_SCOPE);
//
- this.stateControllerContext = new ControllerStateControllerContext(nsContext, windows);
+ this.stateControllerContext = new ControllerStateControllerContext(nsContext, this);
this.eventControllerContext = new CoreEventControllerContext();
this.controllerContext = controllerContext;
this.windows = windows;
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerStateControllerContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerStateControllerContext.java 2008-04-11 20:51:17 UTC (rev 10540)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerStateControllerContext.java 2008-04-11 20:54:23 UTC (rev 10541)
@@ -40,12 +40,14 @@
private final NavigationalStateContext navigationalStateContext;
/** . */
- private final Map<String, Window> windows;
+ private final ControllerPortletControllerContext controllerContext;
- public ControllerStateControllerContext(NavigationalStateContext navigationalStateContext, Map<String, Window> windows)
+ public ControllerStateControllerContext(
+ NavigationalStateContext navigationalStateContext,
+ ControllerPortletControllerContext controllerContext)
{
this.navigationalStateContext = navigationalStateContext;
- this.windows = windows;
+ this.controllerContext = controllerContext;
}
public PageNavigationalState clonePageNavigationalState(PageNavigationalState pageNavigationalState, boolean mutable)
@@ -55,6 +57,6 @@
public PageNavigationalState createPageNavigationalState(boolean mutable)
{
- return new ControllerPageNavigationalState(navigationalStateContext, windows, mutable);
+ return new ControllerPageNavigationalState(navigationalStateContext, controllerContext, mutable);
}
}
18 years
JBoss Portal SVN: r10540 - in branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core: model/portal/navstate and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-11 16:51:17 -0400 (Fri, 11 Apr 2008)
New Revision: 10540
Added:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/navstate/PageNavigationalState.java
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPortletControllerContext.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/navstate/PortalObjectNavigationalStateContext.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/navstate/NavigationalStateContext.java
Log:
start to integrate a bit the public nav state
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java 2008-04-11 20:29:52 UTC (rev 10539)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java 2008-04-11 20:51:17 UTC (rev 10540)
@@ -24,8 +24,10 @@
import org.jboss.portal.portlet.controller.state.PageNavigationalState;
import org.jboss.portal.portlet.controller.state.WindowNavigationalState;
+import org.jboss.portal.portlet.info.ParameterInfo;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.info.NavigationInfo;
import org.jboss.portal.common.util.ParameterMap;
-import org.jboss.portal.common.NotYetImplemented;
import org.jboss.portal.core.navstate.NavigationalStateContext;
import org.jboss.portal.core.model.portal.Window;
@@ -43,26 +45,33 @@
{
/** . */
+ private static final String[] REMOVAL = new String[0];
+
+ /** . */
private final NavigationalStateContext navigationalStateContext;
/** . */
- private final Map<String, Window> windows;
+ private final ControllerPortletControllerContext controllerContext;
/** . */
private final boolean mutable;
/** . */
- private final Map<String, WindowNavigationalState> updates;
+ private Map<String, WindowNavigationalState> updates;
+ /** . */
+ private Map<QName, String[]> pageUpdates;
+
public ControllerPageNavigationalState(
NavigationalStateContext navigationalStateContext,
- Map<String, Window> windows,
+ ControllerPortletControllerContext controllerContext,
boolean mutable)
{
this.navigationalStateContext = navigationalStateContext;
- this.windows = windows;
+ this.controllerContext = controllerContext;
this.mutable = mutable;
- this.updates = new HashMap<String, WindowNavigationalState>();
+ this.updates = null;
+ this.pageUpdates = null;
}
public ControllerPageNavigationalState(
@@ -70,9 +79,10 @@
boolean mutable)
{
this.navigationalStateContext = that.navigationalStateContext;
- this.windows = new HashMap<String, Window>(that.windows);
+ this.controllerContext = that.controllerContext;
this.mutable = mutable;
- this.updates = new HashMap<String, WindowNavigationalState>(that.updates);
+ this.updates = that.updates != null ? new HashMap<String, WindowNavigationalState>(that.updates) : null;
+ this.pageUpdates = that.pageUpdates != null ? new HashMap<QName, String[]>(that.pageUpdates) : null;
}
/**
@@ -80,38 +90,86 @@
*/
public void flushUpdates()
{
- for (Map.Entry<String, WindowNavigationalState> entry : updates.entrySet())
+ if (updates != null)
{
- Window window = windows.get(entry.getKey());
- org.jboss.portal.core.model.portal.navstate.WindowNavigationalState wns = new org.jboss.portal.core.model.portal.navstate.WindowNavigationalState(
- entry.getValue().getWindowState(),
- entry.getValue().getMode(),
- entry.getValue().getPortletNavigationalState());
- navigationalStateContext.setWindowNavigationalState(window.getId().toString(), wns);
+ for (Map.Entry<String, WindowNavigationalState> entry : updates.entrySet())
+ {
+ Window window = controllerContext.getWindow(entry.getKey());
+ org.jboss.portal.core.model.portal.navstate.WindowNavigationalState wns = new org.jboss.portal.core.model.portal.navstate.WindowNavigationalState(
+ entry.getValue().getWindowState(),
+ entry.getValue().getMode(),
+ entry.getValue().getPortletNavigationalState());
+ navigationalStateContext.setWindowNavigationalState(window.getId().toString(), wns);
+ }
+
+ //
+ updates.clear();
}
//
- updates.clear();
+ if (pageUpdates != null)
+ {
+ org.jboss.portal.core.model.portal.navstate.PageNavigationalState storedPNS = navigationalStateContext.getPageNavigationalState(controllerContext.getPageId());
+
+ //
+ Map<QName, String[]> parameters;
+ if (storedPNS != null)
+ {
+ parameters = new HashMap<QName, String[]>(storedPNS.getParameters());
+ }
+ else
+ {
+ parameters = new HashMap<QName, String[]>();
+ }
+
+ //
+ for (Map.Entry<QName, String[]> update : pageUpdates.entrySet())
+ {
+ String[] value = update.getValue();
+
+ //
+ if (value.length == 0)
+ {
+ parameters.remove(update.getKey());
+ }
+ else
+ {
+ parameters.put(update.getKey(), value);
+ }
+ }
+
+ //
+ navigationalStateContext.setPageNavigationalState(controllerContext.getPageId(), new org.jboss.portal.core.model.portal.navstate.PageNavigationalState(parameters));
+
+ //
+ pageUpdates.clear();
+ }
}
public Set<String> getWindowIds()
{
- return windows.keySet();
+ return controllerContext.getWindowNames();
}
- public WindowNavigationalState getWindowNavigationalState(String s) throws IllegalArgumentException
+ public WindowNavigationalState getWindowNavigationalState(String windowName) throws IllegalArgumentException
{
- WindowNavigationalState update = updates.get(s);
+ WindowNavigationalState update = null;
//
+ if (updates != null)
+ {
+ update = updates.get(windowName);
+ }
+
+ //
if (update != null)
{
return update;
}
//
- Window window = windows.get(s);
+ Window window = controllerContext.getWindow(windowName);
//
org.jboss.portal.core.model.portal.navstate.WindowNavigationalState wns = navigationalStateContext.getWindowNavigationalState(window.getId().toString());
@@ -126,7 +184,7 @@
return new WindowNavigationalState(wns.getContentState(), wns.getMode(), wns.getWindowState());
}
- public void setWindowNavigationalState(String s, WindowNavigationalState windowNavigationalState) throws IllegalArgumentException, IllegalStateException
+ public void setWindowNavigationalState(String windowName, WindowNavigationalState windowNavigationalState) throws IllegalArgumentException, IllegalStateException
{
if (!mutable)
{
@@ -134,25 +192,125 @@
}
//
- updates.put(s, windowNavigationalState);
+ if (updates == null)
+ {
+ updates = new HashMap<String, WindowNavigationalState>();
+ }
+
+ //
+ updates.put(windowName, windowNavigationalState);
}
- public ParameterMap getPublicNavigationalState(String s) throws IllegalArgumentException
+ /**
+ * For now we do not implement any kind of mapping between qnames, it's the basic straightforward 1-1 mapping.
+ */
+ public ParameterMap getPublicNavigationalState(String windowName) throws IllegalArgumentException
{
- return new ParameterMap();
+ PortletInfo info = controllerContext.getPortletInfo(windowName);
+
+ //
+ if (info != null)
+ {
+ ParameterMap publicNavigationalState = new ParameterMap();
+ for (ParameterInfo parameterInfo : info.getNavigation().getPublicParameters())
+ {
+ String[] parameterValue = getPublicNavigationalState(parameterInfo.getName());
+
+ //
+ if (parameterValue != null)
+ {
+ String parameterId = parameterInfo.getId();
+
+ // We clone the value here so we keep the internal state not potentially changed
+ publicNavigationalState.put(parameterId, parameterValue.clone());
+ }
+ }
+
+ //
+ return publicNavigationalState;
+ }
+
+ //
+ return null;
}
+ public void setPublicNavigationalState(String windowName, Map<String, String[]> update)
+ {
+ if (!mutable)
+ {
+ throw new IllegalStateException("The page navigational state is not modifiable");
+ }
+
+ //
+ PortletInfo info = controllerContext.getPortletInfo(windowName);
+
+ //
+ if (info != null)
+ {
+ NavigationInfo navigationInfo = info.getNavigation();
+ for (Map.Entry<String, String[]> entry : update.entrySet())
+ {
+ String id = entry.getKey();
+
+ //
+ ParameterInfo parameterInfo = navigationInfo.getPublicParameter(id);
+
+ //
+ if (parameterInfo != null)
+ {
+ QName name = parameterInfo.getName();
+ String[] value = entry.getValue();
+ if (value.length > 0)
+ {
+ setPublicNavigationalState(name, value);
+ }
+ else
+ {
+ removePublicNavigationalState(name);
+ }
+ }
+ }
+ }
+ }
+
public Set<QName> getPublicNames()
{
- return Collections.emptySet();
+ if (pageUpdates == null)
+ {
+ return Collections.emptySet();
+ }
+
+ //
+ return pageUpdates.keySet();
}
- public String[] getPublicNavigationalState(QName qName) throws IllegalArgumentException
+ public String[] getPublicNavigationalState(QName name) throws IllegalArgumentException
{
- return new String[0];
+ String[] value = null;
+
+ //
+ if (pageUpdates != null)
+ {
+ value = pageUpdates.get(name);
+ }
+
+ //
+ if (value == null)
+ {
+ org.jboss.portal.core.model.portal.navstate.PageNavigationalState storedPNS = navigationalStateContext.getPageNavigationalState(controllerContext.getPageId());
+
+ //
+ if (storedPNS != null)
+ {
+ value = storedPNS.getParameter(name);
+ }
+ }
+
+ //
+ return value != null && value.length > 0 ? value : null;
}
- public void setPublicNavigationalState(QName qName, String[] strings) throws IllegalArgumentException, IllegalStateException
+ public void setPublicNavigationalState(QName name, String[] value) throws IllegalArgumentException, IllegalStateException
{
if (!mutable)
{
@@ -160,10 +318,16 @@
}
//
- throw new NotYetImplemented();
+ if (pageUpdates == null)
+ {
+ pageUpdates = new HashMap<QName, String[]>();
+ }
+
+ //
+ pageUpdates.put(name, value);
}
- public void removePublicNavigationalState(QName qName) throws IllegalArgumentException, IllegalStateException
+ public void removePublicNavigationalState(QName name) throws IllegalArgumentException, IllegalStateException
{
if (!mutable)
{
@@ -171,6 +335,9 @@
}
//
- throw new NotYetImplemented();
+ if (pageUpdates != null)
+ {
+ pageUpdates.put(name, REMOVAL);
+ }
}
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPortletControllerContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPortletControllerContext.java 2008-04-11 20:29:52 UTC (rev 10539)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPortletControllerContext.java 2008-04-11 20:51:17 UTC (rev 10540)
@@ -50,6 +50,7 @@
import java.util.List;
import java.util.Map;
import java.util.HashMap;
+import java.util.Set;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -76,6 +77,9 @@
/** . */
private final CoreEventControllerContext eventControllerContext;
+ /** . */
+ private final String pageId;
+
public ControllerPortletControllerContext(
ControllerContext controllerContext,
Page page,
@@ -129,13 +133,29 @@
this.windows = windows;
this.infos = infos;
this.instances = instances;
+ this.pageId = page.getId().toString();
}
- public PortletInfo getPortletInfo(String windowId)
+ public String getPageId()
{
- return infos.get(windowId);
+ return pageId;
}
+ public Window getWindow(String windowName)
+ {
+ return windows.get(windowName);
+ }
+
+ public Set<String> getWindowNames()
+ {
+ return windows.keySet();
+ }
+
+ public PortletInfo getPortletInfo(String windowName)
+ {
+ return infos.get(windowName);
+ }
+
public PortletInvocationContext createPortletInvocationContext(String s, PageNavigationalState pageNavigationalState)
{
Window window = windows.get(s);
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/navstate/PageNavigationalState.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/navstate/PageNavigationalState.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/navstate/PageNavigationalState.java 2008-04-11 20:51:17 UTC (rev 10540)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.navstate;
+
+import javax.xml.namespace.QName;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PageNavigationalState implements Serializable
+{
+
+ /** . */
+ private final HashMap<QName, String[]> parameters;
+
+ public PageNavigationalState(Map<QName, String[]> parameters)
+ {
+ this.parameters = new HashMap<QName, String[]>(parameters);
+ }
+
+ public String[] getParameter(QName name)
+ {
+ return parameters.get(name);
+ }
+
+ public Map<QName, String[]> getParameters()
+ {
+ return Collections.unmodifiableMap(parameters);
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/navstate/PortalObjectNavigationalStateContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/navstate/PortalObjectNavigationalStateContext.java 2008-04-11 20:29:52 UTC (rev 10539)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/navstate/PortalObjectNavigationalStateContext.java 2008-04-11 20:51:17 UTC (rev 10540)
@@ -185,16 +185,28 @@
public WindowNavigationalState getWindowNavigationalState(String windowId)
{
- NavigationalStateKey key = getKeyFrom(windowId);
+ NavigationalStateKey key = createWindowKey(windowId);
return (WindowNavigationalState)getAttribute(key);
}
public void setWindowNavigationalState(String windowId, WindowNavigationalState windowNavigationalState)
{
- NavigationalStateKey key = getKeyFrom(windowId);
+ NavigationalStateKey key = createWindowKey(windowId);
setAttribute(key, windowNavigationalState);
}
+ public PageNavigationalState getPageNavigationalState(String pageId)
+ {
+ NavigationalStateKey key = createPageKey(pageId);
+ return (PageNavigationalState)getAttribute(key);
+ }
+
+ public void setPageNavigationalState(String pageId, PageNavigationalState pageNavigationalState)
+ {
+ NavigationalStateKey key = createPageKey(pageId);
+ setAttribute(key, pageNavigationalState);
+ }
+
/**
* Apply the navigational state changes to the real storage.
*
@@ -276,8 +288,13 @@
return viewId != null ? viewId.toString() : "0";
}
- private NavigationalStateKey getKeyFrom(String windowId)
+ private NavigationalStateKey createWindowKey(String windowId)
{
return new NavigationalStateKey(WindowNavigationalState.class, PortalObjectId.parse(windowId, PortalObjectPath.CANONICAL_FORMAT));
}
+
+ private NavigationalStateKey createPageKey(String pageId)
+ {
+ return new NavigationalStateKey(PageNavigationalState.class, PortalObjectId.parse(pageId, PortalObjectPath.CANONICAL_FORMAT));
+ }
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/navstate/NavigationalStateContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/navstate/NavigationalStateContext.java 2008-04-11 20:29:52 UTC (rev 10539)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/navstate/NavigationalStateContext.java 2008-04-11 20:51:17 UTC (rev 10540)
@@ -24,6 +24,7 @@
import org.jboss.portal.common.invocation.AttributeResolver;
import org.jboss.portal.core.model.portal.navstate.WindowNavigationalState;
+import org.jboss.portal.core.model.portal.navstate.PageNavigationalState;
import java.util.Iterator;
@@ -53,6 +54,24 @@
void setWindowNavigationalState(String windowId, WindowNavigationalState windowNavigationalState);
/**
+ * Retrieves the navigational state associated with the specified page identifier.
+ *
+ * @param pageId a String identifying the page which navigational state is to be retrieved
+ * @return the navigational state associated with the specified window identifier or <code>null</code> if the given
+ * page identifier is not known by this NavigationalStateContext or no navigational state is associated
+ * with the given identifier.
+ */
+ PageNavigationalState getPageNavigationalState(String pageId);
+
+ /**
+ * Set the navigational state associated with the page identified by the given identifier.
+ *
+ * @param pageId the page identifier
+ * @param pageNavigationalState the page navigational state
+ */
+ void setPageNavigationalState(String pageId, PageNavigationalState pageNavigationalState);
+
+ /**
* Apply the navigational state changes made to this NavigationalStateContext.
*
* @return true if state changed
18 years
JBoss Portal SVN: r10539 - modules/test/trunk/remote.
by portal-commits@lists.jboss.org
Author: prabhat.jha(a)jboss.com
Date: 2008-04-11 16:29:52 -0400 (Fri, 11 Apr 2008)
New Revision: 10539
Modified:
modules/test/trunk/remote/pom.xml
Log:
enable selenium tests and reporting for remote module
Modified: modules/test/trunk/remote/pom.xml
===================================================================
--- modules/test/trunk/remote/pom.xml 2008-04-11 19:48:28 UTC (rev 10538)
+++ modules/test/trunk/remote/pom.xml 2008-04-11 20:29:52 UTC (rev 10539)
@@ -100,8 +100,8 @@
</dependency>
</dependencies>
- <!-- DeActivating Selenium integration test until proper browser environment is setup on hudson. otherwise the test suite fails -->
- <!--
+ <!-- To deactivate Selenium integration test, please comment out the build node -->
+
<build>
<plugins>
<plugin>
@@ -190,11 +190,21 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>false</skip>
+ <includes>
+ <include>**/*Test*.java</include>
+ </includes>
+ </configuration>
+ </plugin>
</plugins>
</build>
- -->
+
<properties>
</properties>
</project>
18 years
JBoss Portal SVN: r10538 - branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-11 15:48:28 -0400 (Fri, 11 Apr 2008)
New Revision: 10538
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java
Log:
work on integrating portlet controller with 2.7
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java 2008-04-11 19:47:42 UTC (rev 10537)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ControllerPageNavigationalState.java 2008-04-11 19:48:28 UTC (rev 10538)
@@ -135,19 +135,6 @@
//
updates.put(s, windowNavigationalState);
-
- //
-// Window window = windows.get(s);
-//
-// //
-// org.jboss.portal.core.model.portal.navstate.WindowNavigationalState wns = new org.jboss.portal.core.model.portal.navstate.WindowNavigationalState(
-// windowNavigationalState.getWindowState(),
-// windowNavigationalState.getMode(),
-// windowNavigationalState.getPortletNavigationalState()
-// );
-//
-// //
-// navigationalStateContext.setWindowNavigationalState(window.getId().toString(), wns);
}
public ParameterMap getPublicNavigationalState(String s) throws IllegalArgumentException
18 years