Author: chris.laprun(a)jboss.com
Date: 2008-07-30 09:31:11 -0400 (Wed, 30 Jul 2008)
New Revision: 11655
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/portlet/PortletRequestEncoder.java
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/PortletRequestEncoder.java
Log:
- WSRP needs navigational state to be passed when creating an action command for
templating purpose.
PortletRequestEncoder.encodeAction can just discard the NS instead of throwing an
exception.
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-07-30
10:58:23 UTC (rev 11654)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2008-07-30
13:31:11 UTC (rev 11655)
@@ -22,9 +22,6 @@
******************************************************************************/
package org.jboss.portal.core.controller.portlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.MarkupInfo;
@@ -38,10 +35,10 @@
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.ParametersStateString;
import org.jboss.portal.portlet.RenderURL;
-import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.ResourceURL;
-import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.controller.state.PortletPageNavigationalState;
import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
import org.jboss.portal.portlet.invocation.ActionInvocation;
@@ -53,6 +50,8 @@
import org.jboss.portal.server.request.URLContext;
import org.jboss.portal.server.request.URLFormat;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.util.Map;
/**
@@ -69,9 +68,9 @@
public static ThreadLocal<UserContext> userContextTL = new
ThreadLocal<UserContext>();
public static InvokePortletCommandFactory createInvokePortletCommandFactory(
- ControllerContext controllerContext,
- Window window,
- PortletPageNavigationalState pageNavigationalState)
+ ControllerContext controllerContext,
+ Window window,
+ PortletPageNavigationalState pageNavigationalState)
{
return new InternalInvokePortletCommandFactory(window, controllerContext,
pageNavigationalState);
}
@@ -83,24 +82,24 @@
}
public static PortletInvocationContext createInvocationContext(
- ControllerContext controllerContext,
- Window window,
- PortletPageNavigationalState pageNavigationalState)
+ ControllerContext controllerContext,
+ Window window,
+ PortletPageNavigationalState pageNavigationalState)
{
InvokePortletCommandFactory ipcf =
createInvokePortletCommandFactory(controllerContext, window, pageNavigationalState);
return createInvocationContext(controllerContext, ipcf);
}
public static ActionInvocation createAction(
- ControllerContext controllerContext,
- Mode mode,
- WindowState windowState,
- StateString navigationalState,
- StateString interactionState,
- ParameterMap form,
- Window window,
- Portal portal,
- PortletPageNavigationalState pageNavigationalState)
+ ControllerContext controllerContext,
+ Mode mode,
+ WindowState windowState,
+ StateString navigationalState,
+ StateString interactionState,
+ ParameterMap form,
+ Window window,
+ Portal portal,
+ PortletPageNavigationalState pageNavigationalState)
{
PortletContextFactory cf = new PortletContextFactory(controllerContext, portal,
window);
InvokePortletCommandFactory cpc =
createInvokePortletCommandFactory(controllerContext, window, pageNavigationalState);
@@ -108,14 +107,14 @@
}
public static ActionInvocation createAction(
- ControllerContext controllerContext,
- Mode mode,
- WindowState windowState,
- StateString navigationalState,
- StateString interactionState,
- ParameterMap form,
- PortletContextFactory cf,
- InvokePortletCommandFactory cpc)
+ ControllerContext controllerContext,
+ Mode mode,
+ WindowState windowState,
+ StateString navigationalState,
+ StateString interactionState,
+ ParameterMap form,
+ PortletContextFactory cf,
+ InvokePortletCommandFactory cpc)
{
PortletInvocationContext portletInvocationContext =
createInvocationContext(controllerContext, cpc);
@@ -137,13 +136,13 @@
}
public static RenderInvocation createRender(
- ControllerContext controllerContext,
- Mode mode,
- WindowState windowState,
- StateString navigationalState,
- Window window,
- Portal portal,
- PortletPageNavigationalState pageNavigationalState)
+ ControllerContext controllerContext,
+ Mode mode,
+ WindowState windowState,
+ StateString navigationalState,
+ Window window,
+ Portal portal,
+ PortletPageNavigationalState pageNavigationalState)
{
PortletContextFactory cf = new PortletContextFactory(controllerContext, portal,
window);
InvokePortletCommandFactory cpc =
createInvokePortletCommandFactory(controllerContext, window, pageNavigationalState);
@@ -153,12 +152,12 @@
}
public static RenderInvocation createRender(
- ControllerContext controllerContext,
- Mode mode,
- WindowState windowState,
- StateString navigationalState,
- PortletContextFactory cf,
- InvokePortletCommandFactory cpc)
+ ControllerContext controllerContext,
+ Mode mode,
+ WindowState windowState,
+ StateString navigationalState,
+ PortletContextFactory cf,
+ InvokePortletCommandFactory cpc)
{
PortletInvocationContext portletInvocationContext =
createInvocationContext(controllerContext, cpc);
@@ -178,9 +177,9 @@
}
public static void contextualize(
- ControllerContext controllerContext,
- PortletContextFactory cf,
- PortletInvocation invocation)
+ ControllerContext controllerContext,
+ PortletContextFactory cf,
+ PortletInvocation invocation)
{
invocation.setAttribute("controller_context", controllerContext);
@@ -240,9 +239,9 @@
private ControllerContext controllerContext;
public ControllerPortletInvocationContext(
- InvokePortletCommandFactory cmdFactory,
- ControllerContext controllerContext,
- MarkupInfo markupInfo)
+ InvokePortletCommandFactory cmdFactory,
+ ControllerContext controllerContext,
+ MarkupInfo markupInfo)
{
super(markupInfo);
@@ -325,9 +324,9 @@
Map<String, String[]> publicNavigationalState;
public InternalInvokePortletCommandFactory(
- Window window,
- ControllerContext controllerContext,
- PortletPageNavigationalState pageNavigationalState)
+ Window window,
+ ControllerContext controllerContext,
+ PortletPageNavigationalState pageNavigationalState)
{
this.controllerContext = controllerContext;
this.window = window;
@@ -337,12 +336,12 @@
public ControllerCommand createInvokeActionCommand(ActionURL actionURL)
{
return new InvokePortletWindowActionCommand(
- window.getId(),
- actionURL.getMode(),
- actionURL.getWindowState(),
- null,
- actionURL.getInteractionState(),
- null);
+ window.getId(),
+ actionURL.getMode(),
+ actionURL.getWindowState(),
+ actionURL.getNavigationalState(),
+ actionURL.getInteractionState(),
+ null);
}
public ControllerCommand createInvokeRenderCommand(RenderURL renderURL)
@@ -406,20 +405,20 @@
//
return new InvokePortletWindowRenderCommand(
- window.getId(),
- renderURL.getMode(),
- renderURL.getWindowState(),
- navigationalState);
+ window.getId(),
+ renderURL.getMode(),
+ renderURL.getWindowState(),
+ navigationalState);
}
public ControllerCommand createInvokeResourceCommand(ResourceURL resourceURL)
{
return new InvokePortletWindowResourceCommand(
- window.getId(),
- resourceURL.getCacheability(),
- resourceURL.getResourceId(),
- resourceURL.getResourceState(),
- null
+ window.getId(),
+ resourceURL.getCacheability(),
+ resourceURL.getResourceId(),
+ resourceURL.getResourceState(),
+ null
);
}
}
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-07-30
10:58:23 UTC (rev 11654)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestEncoder.java 2008-07-30
13:31:11 UTC (rev 11655)
@@ -24,21 +24,17 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
+import org.jboss.portal.common.NotYetImplemented;
+import org.jboss.portal.common.util.ParameterMap;
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;
/**
- * 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>
+ * 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>
@@ -67,9 +63,9 @@
}
public void encodeResource(
- CacheLevel cacheability,
- String resourceId,
- StateString resourceState)
+ CacheLevel cacheability,
+ String resourceId,
+ StateString resourceState)
{
queryParameters.clear();
@@ -110,10 +106,10 @@
}
public void encodeAction(
- StateString navigationalState,
- StateString interactionState,
- Mode mode,
- WindowState windowState) throws IllegalArgumentException
+ StateString navigationalState,
+ StateString interactionState,
+ Mode mode,
+ WindowState windowState) throws IllegalArgumentException
{
queryParameters.clear();
@@ -125,10 +121,10 @@
{
if (interactionState instanceof ParametersStateString)
{
- if (navigationalState != null)
- {
- throw new IllegalArgumentException("Cannot handle case with both non
opaque interaction and navigational state");
- }
+ // we don't need to encode the navigational state in the URL (stored in
session)
+ // but we shouldn't throw an exception here because it's needed for
template creation in WSRP
+ // so just discard it
+ navigationalState = null;
// Add the parameters
Map<String, String[]> parameters =
((ParametersStateString)interactionState).getParameters();
@@ -154,9 +150,9 @@
}
public void encodeRender(
- StateString navigationalState,
- Mode mode,
- WindowState windowState)
+ StateString navigationalState,
+ Mode mode,
+ WindowState windowState)
{
queryParameters.clear();
Modified:
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/PortletRequestEncoder.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/PortletRequestEncoder.java 2008-07-30
10:58:23 UTC (rev 11654)
+++
branches/JBoss_Portal_Branch_2_7/faces/src/main/org/jboss/portal/faces/component/portlet/PortletRequestEncoder.java 2008-07-30
13:31:11 UTC (rev 11655)
@@ -25,24 +25,17 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.ParameterMap;
-import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.ParametersStateString;
-import org.jboss.portal.portlet.PortletURL;
-import org.jboss.portal.portlet.RenderURL;
-import org.jboss.portal.portlet.ActionURL;
+import org.jboss.portal.portlet.StateString;
import java.util.Iterator;
import java.util.Map;
/**
- * 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>
+ * 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 $
*/
@@ -69,10 +62,10 @@
}
public void encodeAction(
- StateString navigationalState,
- StateString interactionState,
- Mode mode,
- WindowState windowState) throws IllegalArgumentException
+ StateString navigationalState,
+ StateString interactionState,
+ Mode mode,
+ WindowState windowState) throws IllegalArgumentException
{
queryParameters.clear();
@@ -84,10 +77,10 @@
{
if (interactionState instanceof ParametersStateString)
{
- if (navigationalState != null)
- {
- throw new IllegalArgumentException("Cannot handle case with both non
opaque interaction and navigational state");
- }
+ // we don't need to encode the navigational state in the URL (stored in
session)
+ // but we shouldn't throw an exception here because it's needed for
template creation in WSRP
+ // so just discard it
+ navigationalState = null;
// Add the parameters
Map<String, String[]> parameters =
((ParametersStateString)interactionState).getParameters();
@@ -113,9 +106,9 @@
}
public void encodeRender(
- StateString navigationalState,
- Mode mode,
- WindowState windowState)
+ StateString navigationalState,
+ Mode mode,
+ WindowState windowState)
{
queryParameters.clear();