Author: julien(a)jboss.com
Date: 2008-04-15 07:23:59 -0400 (Tue, 15 Apr 2008)
New Revision: 10586
Modified:
modules/portlet/trunk/bridge/src/main/java/org/jboss/portal/portlet/bridge/JBossServletContextProvider.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerPortletInvocationContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/CCPPInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/EventPayloadInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/PortletCustomizationInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/RequestAttributeConversationInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/SecureTransportInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/ContainerPortletInvoker.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractUserContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvocation.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/UserContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/portlet/support/spi/UserContextSupport.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/ActionContextImpl.java
Log:
remove usage of scopes in portlet container
Modified:
modules/portlet/trunk/bridge/src/main/java/org/jboss/portal/portlet/bridge/JBossServletContextProvider.java
===================================================================
---
modules/portlet/trunk/bridge/src/main/java/org/jboss/portal/portlet/bridge/JBossServletContextProvider.java 2008-04-15
10:02:42 UTC (rev 10585)
+++
modules/portlet/trunk/bridge/src/main/java/org/jboss/portal/portlet/bridge/JBossServletContextProvider.java 2008-04-15
11:23:59 UTC (rev 10586)
@@ -122,7 +122,7 @@
public BridgeInfo(PortletInvocation invocation)
{
- PortletContainer container =
(PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
ContainerPortletInvoker.PORTLET_CONTAINER);
+ PortletContainer container =
(PortletContainer)invocation.getAttribute(ContainerPortletInvoker.PORTLET_CONTAINER);
//
this.invocation = invocation;
Modified:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerPortletInvocationContext.java
===================================================================
---
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerPortletInvocationContext.java 2008-04-15
10:02:42 UTC (rev 10585)
+++
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerPortletInvocationContext.java 2008-04-15
11:23:59 UTC (rev 10586)
@@ -75,11 +75,6 @@
this.clientResponse = clientResponse;
this.windowId = windowId;
this.urlRenderer = new PortletURLRenderer(pageNavigationalState, clientRequest,
clientResponse, serialization);
-
- //
- addResolver(PortletInvocation.PRINCIPAL_SCOPE, new
PrincipalAttributeResolver(clientRequest));
- addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
- addResolver(PortletInvocation.REQUEST_SCOPE, new
RequestAttributeResolver(clientRequest));
}
public String getWindowId()
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/CCPPInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/CCPPInterceptor.java 2008-04-15
10:02:42 UTC (rev 10585)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/CCPPInterceptor.java 2008-04-15
11:23:59 UTC (rev 10586)
@@ -34,6 +34,8 @@
import javax.ccpp.ComponentDescription;
import java.util.Set;
import java.util.Collections;
+import java.util.Map;
+import java.util.HashMap;
/**
* A simple implementation of CC/PP feature of JSR286.
@@ -45,17 +47,20 @@
{
protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
{
- try
- {
- invocation.setAttribute(PortletInvocation.REQUEST_SCOPE,
"javax.portlet.ccpp", SIMPLE_PROFILE);
+ Map<String, Object> requestAttributes = invocation.getRequestAttributes();
- //
- return invocation.invokeNext();
- }
- finally
+ //
+ if (requestAttributes == null)
{
- invocation.removeAttribute(PortletInvocation.REQUEST_SCOPE,
"javax.portlet.ccpp");
+ requestAttributes = new HashMap<String, Object>();
+ invocation.setRequestAttributes(requestAttributes);
}
+
+ //
+ requestAttributes.put("javax.portlet.ccpp", SIMPLE_PROFILE);
+
+ //
+ return invocation.invokeNext();
}
/**
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2008-04-15
10:02:42 UTC (rev 10585)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2008-04-15
11:23:59 UTC (rev 10586)
@@ -32,9 +32,9 @@
import org.jboss.portal.portlet.invocation.response.ContentResponse;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.spi.UserContext;
import org.jboss.portal.portlet.cache.CacheControl;
import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.common.invocation.AttributeResolver;
import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.WindowState;
import org.jboss.portal.Mode;
@@ -58,7 +58,7 @@
// We use the principal scope to avoid security issues like a user loggedout seeing
a cached entry
// by a previous logged in user
- AttributeResolver resolver =
invocation.getContext().getAttributeResolver(PortletInvocation.PRINCIPAL_SCOPE);
+ UserContext userContext = invocation.getUserContext();
//
if (invocation instanceof RenderInvocation)
@@ -72,7 +72,7 @@
Mode mode = renderInvocation.getMode();
//
- CacheEntry cachedEntry = (CacheEntry)resolver.getAttribute(scopeKey);
+ CacheEntry cachedEntry = (CacheEntry)userContext.getAttribute(scopeKey);
//
if (cachedEntry != null)
@@ -143,7 +143,7 @@
if (!useEntry)
{
cachedEntry = null;
- resolver.setAttribute(scopeKey, null);
+ userContext.setAttribute(scopeKey, null);
}
}
@@ -208,7 +208,7 @@
fragment,
expirationTimeMillis,
validationToken);
- resolver.setAttribute(scopeKey, cacheEntry);
+ userContext.setAttribute(scopeKey, cacheEntry);
}
//
@@ -223,7 +223,7 @@
else
{
// Invalidate
- resolver.setAttribute(scopeKey, null);
+ userContext.setAttribute(scopeKey, null);
// Invoke
return invocation.invokeNext();
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java 2008-04-15
10:02:42 UTC (rev 10585)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java 2008-04-15
11:23:59 UTC (rev 10586)
@@ -66,7 +66,7 @@
protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
{
- PortletContainer container =
(PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
ContainerPortletInvoker.PORTLET_CONTAINER);
+ PortletContainer container =
(PortletContainer)invocation.getAttribute(ContainerPortletInvoker.PORTLET_CONTAINER);
PortletApplication portletApplication = container.getPortletApplication();
ServerContext reqCtx = invocation.getServerContext();
ServletContext targetCtx = portletApplication.getContext().getServletContext();
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/EventPayloadInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/EventPayloadInterceptor.java 2008-04-15
10:02:42 UTC (rev 10585)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/EventPayloadInterceptor.java 2008-04-15
11:23:59 UTC (rev 10586)
@@ -69,7 +69,7 @@
Serializable dstPayload = null;
if (srcPayload != null)
{
- PortletContainer container =
(PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
ContainerPortletInvoker.PORTLET_CONTAINER);
+ PortletContainer container =
(PortletContainer)invocation.getAttribute(ContainerPortletInvoker.PORTLET_CONTAINER);
//
PortletApplication application = container.getPortletApplication();
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/PortletCustomizationInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/PortletCustomizationInterceptor.java 2008-04-15
10:02:42 UTC (rev 10585)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/PortletCustomizationInterceptor.java 2008-04-15
11:23:59 UTC (rev 10586)
@@ -27,11 +27,11 @@
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.EventInvocation;
import org.jboss.portal.portlet.spi.InstanceContext;
+import org.jboss.portal.portlet.spi.UserContext;
import org.jboss.portal.portlet.state.AccessMode;
import org.jboss.portal.portlet.StateEvent;
import org.jboss.portal.portlet.PortletContext;
import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.common.invocation.AttributeResolver;
/**
* <p>This interceptor takes in charge the management of portlet customization when
the invocation carries
@@ -53,8 +53,8 @@
PortletContext oldTarget = invocation.getTarget();
try
{
- AttributeResolver resolver =
invocation.getContext().getAttributeResolver(PortletInvocation.PRINCIPAL_SCOPE);
- PortletInstanceContext newContext = new PortletInstanceContext(resolver,
oldTarget);
+ UserContext userContext = invocation.getUserContext();
+ PortletInstanceContext newContext = new PortletInstanceContext(userContext,
oldTarget);
//
invocation.setInstanceContext(newContext);
@@ -79,7 +79,7 @@
{
/** . */
- private AttributeResolver resolver;
+ private UserContext userContext;
/** . */
private PortletContext target;
@@ -91,13 +91,13 @@
private String id;
public PortletInstanceContext(
- AttributeResolver resolver,
+ UserContext userContext,
PortletContext portletContext)
{
String id = portletContext.getId();
PortletContext target = portletContext;
boolean useClone = false;
- PortletContext clone = (PortletContext)resolver.getAttribute("clone."
+ id);
+ PortletContext clone =
(PortletContext)userContext.getAttribute("clone." + id);
if (clone != null)
{
target = clone;
@@ -105,7 +105,7 @@
}
//
- this.resolver = resolver;
+ this.userContext = userContext;
this.useClone = useClone;
this.target = target;
this.id = id;
@@ -130,7 +130,7 @@
{
target = event.getPortletContext();
useClone = true;
- resolver.setAttribute("clone." + id, target);
+ userContext.setAttribute("clone." + id, target);
}
}
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/RequestAttributeConversationInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/RequestAttributeConversationInterceptor.java 2008-04-15
10:02:42 UTC (rev 10585)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/RequestAttributeConversationInterceptor.java 2008-04-15
11:23:59 UTC (rev 10586)
@@ -61,7 +61,7 @@
protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
{
- PortletContainer container =
(PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
ContainerPortletInvoker.PORTLET_CONTAINER);
+ PortletContainer container =
(PortletContainer)invocation.getAttribute(ContainerPortletInvoker.PORTLET_CONTAINER);
ContainerPortletInfo containerInfo = (ContainerPortletInfo)container.getInfo();
//
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/SecureTransportInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/SecureTransportInterceptor.java 2008-04-15
10:02:42 UTC (rev 10585)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/SecureTransportInterceptor.java 2008-04-15
11:23:59 UTC (rev 10586)
@@ -44,7 +44,7 @@
protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
{
- PortletContainer container =
(PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
ContainerPortletInvoker.PORTLET_CONTAINER);
+ PortletContainer container =
(PortletContainer)invocation.getAttribute(ContainerPortletInvoker.PORTLET_CONTAINER);
PortletInfo containerInfo = container.getInfo();
SecurityInfo securityInfo = containerInfo.getSecurity();
SecurityContext securityContext = invocation.getSecurityContext();
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java 2008-04-15
10:02:42 UTC (rev 10585)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/ValveInterceptor.java 2008-04-15
11:23:59 UTC (rev 10586)
@@ -61,7 +61,7 @@
protected Object invoke(PortletInvocation invocation) throws Exception,
InvocationException
{
- PortletContainerImpl container =
(PortletContainerImpl)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
ContainerPortletInvoker.PORTLET_CONTAINER);
+ PortletContainerImpl container =
(PortletContainerImpl)invocation.getAttribute(ContainerPortletInvoker.PORTLET_CONTAINER);
//
Valve valve = container.getValve();
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/ContainerPortletInvoker.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/ContainerPortletInvoker.java 2008-04-15
10:02:42 UTC (rev 10585)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/container/ContainerPortletInvoker.java 2008-04-15
11:23:59 UTC (rev 10586)
@@ -79,7 +79,7 @@
portletInvocation.setHandler(null);
//
- PortletContainer container =
(PortletContainer)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
ContainerPortletInvoker.PORTLET_CONTAINER);
+ PortletContainer container =
(PortletContainer)portletInvocation.getAttribute(ContainerPortletInvoker.PORTLET_CONTAINER);
return container.dispatch(portletInvocation);
}
finally
@@ -160,7 +160,7 @@
{
invocation.setHandler(handler);
- invocation.setAttribute(PortletInvocation.INVOCATION_SCOPE,
ContainerPortletInvoker.PORTLET_CONTAINER, container);
+ invocation.setAttribute(ContainerPortletInvoker.PORTLET_CONTAINER, container);
return
(PortletInvocationResponse)invocation.invoke(stackFactory.getInterceptorStack());
}
catch (Exception e)
@@ -181,7 +181,7 @@
finally
{
invocation.setHandler(prevHandler);
- invocation.removeAttribute(PortletInvocation.INVOCATION_SCOPE,
ContainerPortletInvoker.PORTLET_CONTAINER);
+ invocation.removeAttribute(ContainerPortletInvoker.PORTLET_CONTAINER);
}
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java 2008-04-15
10:02:42 UTC (rev 10585)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java 2008-04-15
11:23:59 UTC (rev 10586)
@@ -140,7 +140,7 @@
public PortletRequestImpl(PortletContainerImpl container, PortletInvocation
invocation)
{
int mode = this instanceof RenderRequest ? PortletPreferencesImpl.RENDER :
PortletPreferencesImpl.ACTION;
- PropertyContext prefs =
(PropertyContext)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PropertyContext.PREFERENCES_ATTRIBUTE);
+ PropertyContext prefs =
(PropertyContext)invocation.getAttribute(PropertyContext.PREFERENCES_ATTRIBUTE);
PreferencesValidator validator = container.getPreferencesValidator();
ContainerPortletInfo info = container.getInfo();
ContainerPreferencesInfo containerPrefs = info.getPreferences();
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractUserContext.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractUserContext.java 2008-04-15
10:02:42 UTC (rev 10585)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractUserContext.java 2008-04-15
11:23:59 UTC (rev 10586)
@@ -23,6 +23,9 @@
package org.jboss.portal.portlet.impl.spi;
import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.common.invocation.resolver.PrincipalAttributeResolver;
+import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
+import org.jboss.portal.common.invocation.AttributeResolver;
import org.jboss.portal.portlet.spi.UserContext;
import javax.servlet.http.HttpServletRequest;
@@ -51,6 +54,9 @@
/** . */
private final HttpServletRequest clientRequest;
+ /** . */
+ private final AttributeResolver attributeResolver;
+
public AbstractUserContext(HttpServletRequest clientRequest) throws
IllegalArgumentException
{
if (clientRequest == null)
@@ -59,6 +65,7 @@
}
this.id = clientRequest.getRemoteUser();
this.clientRequest = clientRequest;
+ this.attributeResolver = new PrincipalAttributeResolver(clientRequest);
}
public AbstractUserContext(String id) throws IllegalArgumentException
@@ -69,12 +76,14 @@
}
this.id = id;
this.clientRequest = null;
+ this.attributeResolver = new MapAttributeResolver();
}
public AbstractUserContext()
{
this.id = null;
this.clientRequest = null;
+ this.attributeResolver = new MapAttributeResolver();
}
/**
@@ -116,4 +125,14 @@
return Tools.toList((Enumeration<Locale>)clientRequest.getLocales());
}
}
+
+ public void setAttribute(String attrKey, Object attrValue)
+ {
+ attributeResolver.setAttribute(attrKey, attrValue);
+ }
+
+ public Object getAttribute(String attrKey)
+ {
+ return attributeResolver.getAttribute(attrKey);
+ }
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvocation.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvocation.java 2008-04-15
10:02:42 UTC (rev 10585)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvocation.java 2008-04-15
11:23:59 UTC (rev 10586)
@@ -23,7 +23,8 @@
package org.jboss.portal.portlet.invocation;
import org.jboss.portal.common.invocation.Invocation;
-import org.jboss.portal.common.invocation.Scope;
+import org.jboss.portal.common.invocation.AttributeResolver;
+import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
import org.jboss.portal.portlet.spi.InstanceContext;
import org.jboss.portal.portlet.spi.PortalContext;
import org.jboss.portal.portlet.spi.PortletInvocationContext;
@@ -49,15 +50,9 @@
public abstract class PortletInvocation extends Invocation
{
- /** The portal principal scope. */
- public static final Scope PRINCIPAL_SCOPE = Scope.PRINCIPAL_SCOPE;
+ /** . */
+ protected final AttributeResolver attributes;
- /** The request scope. */
- public static final Scope REQUEST_SCOPE = Scope.REQUEST_SCOPE;
-
- /** The request scope. */
- public static final Scope INVOCATION_SCOPE = Scope.INVOCATION_SCOPE;
-
/** . */
protected StateString navigationalState;
@@ -121,6 +116,7 @@
//
this.ctx = ctx;
+ this.attributes = new MapAttributeResolver();
}
public PortletInvocationContext getContext()
@@ -297,4 +293,19 @@
{
this.requestAttributes = requestAttributes;
}
+
+ public void setAttribute(String attrKey, Object attrValue)
+ {
+ attributes.setAttribute(attrKey, attrValue);
+ }
+
+ public Object getAttribute(String attrKey)
+ {
+ return attributes.getAttribute(attrKey);
+ }
+
+ public void removeAttribute(Object attrKey) throws IllegalArgumentException
+ {
+ attributes.setAttribute(attrKey, null);
+ }
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/UserContext.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/UserContext.java 2008-04-15
10:02:42 UTC (rev 10585)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/UserContext.java 2008-04-15
11:23:59 UTC (rev 10586)
@@ -63,4 +63,20 @@
* @return the locales ordered according to user preference (preferred first).
*/
List<Locale> getLocales();
+
+ /**
+ * Set an attribute related to the user identity.
+ *
+ * @param attrKey the attribute key
+ * @param attrValue the attribute value
+ */
+ void setAttribute(String attrKey, Object attrValue);
+
+ /**
+ * Returns an attribute related to the user identity.
+ *
+ * @param attrKey the attribute key
+ * @return the attribute value
+ */
+ Object getAttribute(String attrKey);
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java 2008-04-15
10:02:42 UTC (rev 10585)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java 2008-04-15
11:23:59 UTC (rev 10586)
@@ -231,7 +231,7 @@
try
{
invocation.setTarget(context.getPortletContext());
- invocation.setAttribute(PortletInvocation.INVOCATION_SCOPE,
PropertyContext.PREFERENCES_ATTRIBUTE, prefs);
+ invocation.setAttribute(PropertyContext.PREFERENCES_ATTRIBUTE, prefs);
// Invoke
response = portletInvoker.invoke(invocation);
@@ -239,7 +239,7 @@
finally
{
invocation.setTarget(portletContext);
- invocation.removeAttribute(PortletInvocation.INVOCATION_SCOPE,
PropertyContext.PREFERENCES_ATTRIBUTE);
+ invocation.removeAttribute(PropertyContext.PREFERENCES_ATTRIBUTE);
}
//
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/portlet/support/spi/UserContextSupport.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/portlet/support/spi/UserContextSupport.java 2008-04-15
10:02:42 UTC (rev 10585)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/portlet/support/spi/UserContextSupport.java 2008-04-15
11:23:59 UTC (rev 10586)
@@ -27,7 +27,6 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
-import java.util.Collections;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -55,4 +54,14 @@
{
throw new UnsupportedOperationException();
}
+
+ public void setAttribute(String attrKey, Object attrValue)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getAttribute(String attrKey)
+ {
+ throw new UnsupportedOperationException();
+ }
}
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java 2008-04-15
10:02:42 UTC (rev 10585)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/AbstractStatefulPortletInvokerTestCase.java 2008-04-15
11:23:59 UTC (rev 10586)
@@ -796,7 +796,7 @@
{
public PortletInvocationResponse invoke(PortletInvocation invocation)
{
- AbstractPropertyContext props =
(AbstractPropertyContext)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PropertyContext.PREFERENCES_ATTRIBUTE);
+ AbstractPropertyContext props =
(AbstractPropertyContext)invocation.getAttribute(PropertyContext.PREFERENCES_ATTRIBUTE);
props.update(new PropertyChange[]{PropertyChange.newUpdate("abc",
Arrays.asList("_def"))});
return null;
}
@@ -855,7 +855,7 @@
{
try
{
- AbstractPropertyContext props =
(AbstractPropertyContext)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PropertyContext.PREFERENCES_ATTRIBUTE);
+ AbstractPropertyContext props =
(AbstractPropertyContext)invocation.getAttribute(PropertyContext.PREFERENCES_ATTRIBUTE);
props.update(new
PropertyChange[]{PropertyChange.newUpdate("abc",
Arrays.asList("_def"))});
return null;
}
@@ -891,7 +891,7 @@
{
public PortletInvocationResponse invoke(PortletInvocation invocation)
{
- AbstractPropertyContext props =
(AbstractPropertyContext)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PropertyContext.PREFERENCES_ATTRIBUTE);
+ AbstractPropertyContext props =
(AbstractPropertyContext)invocation.getAttribute(PropertyContext.PREFERENCES_ATTRIBUTE);
props.update(new PropertyChange[]{PropertyChange.newUpdate("abc",
Arrays.asList("_def"))});
return null;
}
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/ActionContextImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/ActionContextImpl.java 2008-04-15
10:02:42 UTC (rev 10585)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/ActionContextImpl.java 2008-04-15
11:23:59 UTC (rev 10586)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.test.portlet.state;
-import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.support.spi.PortletInvocationContextSupport;
import org.jboss.portal.portlet.spi.PortletInvocationContext;
@@ -35,7 +33,5 @@
{
public ActionContextImpl()
{
- addResolver(PortletInvocation.REQUEST_SCOPE, new MapAttributeResolver());
- addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
}
}