Author: chris.laprun(a)jboss.com
Date: 2009-04-02 14:11:11 -0400 (Thu, 02 Apr 2009)
New Revision: 13121
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/ActionRequestProcessor.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPPortletInvocationContext.java
Log:
- JBPORTAL-2366:
+ RequestProcessor.initInvocation now takes a more specific WSRPPortletInvocationContext
as parameter for downstream processing of WindowContext.
+ RequestProcessor.createNavigationalState now uses StateString factory method as it
should (which should lead to less duplicated processing).
+ RenderRequestProcessor.initInvocation now remembers which namespace is used for this
invocation so that it can be re-written when the markup is processed
without having to bracket it with marker strings.
+ WSRPPortletInvocationContext now provides access to WindowContext so that request
processors can know what the namespace is.
+ Use safer namespace generation algorithm.
- Use StateString.JBPNS_PREFIX since it's where the constant is instead of
ParametersStateString.
- ActionRequestProcessor.initInvocation doesn't deal with navigational state anymore
since it's dealt with in RequestProcessor (less duplicated processing).
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java 2009-04-02
17:50:29 UTC (rev 13120)
+++
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java 2009-04-02
18:11:11 UTC (rev 13121)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, 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. *
@@ -27,10 +27,8 @@
import org.apache.commons.fileupload.FileItemStream;
import org.apache.commons.fileupload.FileUpload;
import org.apache.commons.fileupload.util.Streams;
-import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.portlet.OpaqueStateString;
-import org.jboss.portal.portlet.ParametersStateString;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.StateEvent;
import org.jboss.portal.portlet.StateString;
@@ -102,7 +100,7 @@
if (interactionState != null)
{
String state = interactionState.getStringValue();
- if (!ParametersStateString.JBPNS_PREFIX.equals(state)) // fix-me: see
JBPORTAL-900
+ if (!StateString.JBPNS_PREFIX.equals(state)) // fix-me: see JBPORTAL-900
{
interactionParams.setInteractionState(state);
}
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java 2009-04-02
17:50:29 UTC (rev 13120)
+++
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java 2009-04-02
18:11:11 UTC (rev 13121)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, 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. *
@@ -25,7 +25,6 @@
import org.jboss.logging.Logger;
import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
@@ -149,7 +148,17 @@
protected String getNamespaceFrom(WindowContext windowContext)
{
- return windowContext == null ? null :
PortletUtils.generateNamespaceFrom(windowContext.getId());
+ // todo: use URLTools.EncodeForHTMLId when it's available in common
+ if (windowContext != null)
+ {
+ String id = windowContext.getId();
+ id = id.replace('=', '_');
+ id = id.replace('/', '_');
+ id = id.replace('.', '_');
+ return id.replace('+', '_');
+ }
+
+ return null;
}
/**
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java 2009-04-02
17:50:29 UTC (rev 13120)
+++
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java 2009-04-02
18:11:11 UTC (rev 13121)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, 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. *
@@ -26,7 +26,6 @@
import org.jboss.logging.Logger;
import org.jboss.portal.common.util.ContentInfo;
import org.jboss.portal.common.util.ParameterValidation;
-import org.jboss.portal.portlet.ParametersStateString;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.invocation.PortletInvocation;
@@ -118,7 +117,7 @@
if (navigationalState != null)
{
String state = navigationalState.getStringValue();
- if (!ParametersStateString.JBPNS_PREFIX.equals(state)) // fix-me: see
JBPORTAL-900
+ if (!StateString.JBPNS_PREFIX.equals(state)) // fix-me: see JBPORTAL-900
{
markupParams.setNavigationalState(state);
}
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/ActionRequestProcessor.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/ActionRequestProcessor.java 2009-04-02
17:50:29 UTC (rev 13120)
+++
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/ActionRequestProcessor.java 2009-04-02
18:11:11 UTC (rev 13121)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2007, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, 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. *
@@ -29,7 +29,6 @@
import org.jboss.portal.portlet.invocation.response.HTTPRedirectionResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
-import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.portlet.state.AccessMode;
import org.jboss.portal.wsrp.WSRPExceptionFactory;
import org.jboss.portal.wsrp.WSRPTypeFactory;
@@ -107,7 +106,7 @@
return WSRPUtils.getAccessModeFromStateChange(stateChange);
}
- PortletInvocation initInvocation(PortletInvocationContext context)
+ PortletInvocation initInvocation(WSRPPortletInvocationContext context)
{
ActionInvocation invocation = new ActionInvocation(context);
@@ -115,14 +114,10 @@
WSRPRequestContext requestContext =
WSRPRequestContext.createRequestContext(markupRequest, interactionParams);
invocation.setRequestContext(requestContext);
- // Interaction state
+ // Interaction state, navigational state is already taken care of in
RequestProcessor.prepareInvocation
StateString interactionState =
createNavigationalState(interactionParams.getInteractionState());
invocation.setInteractionState(interactionState);
- // Navigational state
- StateString navigationalState =
createNavigationalState(getMarkupParams().getNavigationalState());
- invocation.setNavigationalState(navigationalState);
-
// Form parameters
invocation.setForm(requestContext.getForm());
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java 2009-04-02
17:50:29 UTC (rev 13120)
+++
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RenderRequestProcessor.java 2009-04-02
18:11:11 UTC (rev 13121)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2007, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, 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. *
@@ -24,13 +24,11 @@
package org.jboss.portal.wsrp.producer;
import org.jboss.portal.common.net.URLTools;
-import org.jboss.portal.common.util.Tools;
import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.portlet.state.AccessMode;
import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.WSRPRewritingConstants;
@@ -60,10 +58,11 @@
{
private static final String EMPTY = "";
private final GetMarkup getMarkup;
+ private String namespace;
public RenderRequestProcessor(WSRPProducerImpl producer, GetMarkup getMarkup) throws
UnsupportedMimeTypeFault,
- UnsupportedWindowStateFault, InvalidHandleFault, UnsupportedModeFault,
MissingParametersFault,
- InvalidRegistrationFault, OperationFailedFault
+ UnsupportedWindowStateFault, InvalidHandleFault, UnsupportedModeFault,
MissingParametersFault,
+ InvalidRegistrationFault, OperationFailedFault
{
super(producer);
this.getMarkup = getMarkup;
@@ -105,8 +104,11 @@
return AccessMode.READ_ONLY;
}
- PortletInvocation initInvocation(PortletInvocationContext context)
+ PortletInvocation initInvocation(WSRPPortletInvocationContext context)
{
+ // MUST match namespace generation used in PortletResponseImpl.getNamespace in
portlet module...
+ namespace =
PortletUtils.generateNamespaceFrom(context.getWindowContext().getId());
+
return new RenderInvocation(context);
}
@@ -168,11 +170,7 @@
*/
private String processFragmentString(String renderString)
{
- String result = Tools.replaceAllInstancesOfBoundedString(
- renderString,
- PortletUtils.PREFIX,
- PortletUtils.SUFFIX,
- WSRPRewritingConstants.WSRP_REWRITE_TOKEN);
+ String result = renderString.replaceAll(namespace,
WSRPRewritingConstants.WSRP_REWRITE_TOKEN);
result = URLTools.replaceURLsBy(result, new
AbsoluteURLReplacementGenerator(ServletAccess.getRequest()));
return result;
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java 2009-04-02
17:50:29 UTC (rev 13120)
+++
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java 2009-04-02
18:11:11 UTC (rev 13121)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2007, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, 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. *
@@ -28,14 +28,12 @@
import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.portlet.OpaqueStateString;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.spi.PortalContext;
-import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.portlet.spi.SecurityContext;
import org.jboss.portal.portlet.spi.UserContext;
import org.jboss.portal.portlet.spi.WindowContext;
@@ -175,7 +173,7 @@
abstract AccessMode getAccessMode();
- abstract PortletInvocation initInvocation(PortletInvocationContext context);
+ abstract PortletInvocation initInvocation(WSRPPortletInvocationContext context);
abstract Object processResponse(PortletInvocationResponse response);
@@ -358,7 +356,7 @@
}
else
{
- return new OpaqueStateString(navigationalState);
+ return StateString.create(navigationalState);
}
}
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPPortletInvocationContext.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPPortletInvocationContext.java 2009-04-02
17:50:29 UTC (rev 13120)
+++
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPPortletInvocationContext.java 2009-04-02
18:11:11 UTC (rev 13121)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, 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. *
@@ -20,6 +20,7 @@
* 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.wsrp.producer;
import org.jboss.portal.common.NotYetImplemented;
@@ -159,4 +160,9 @@
invocation.setPortalContext(portalContext);
invocation.setUserContext(userContext);
}
+
+ WindowContext getWindowContext()
+ {
+ return windowContext;
+ }
}