[jboss-svn-commits] JBoss Portal SVN: r5477 - in trunk: common/src/main/org/jboss/portal/common/invocation common/src/main/org/jboss/portal/common/util common/src/main/org/jboss/portal/test/common core/src/main/org/jboss/portal/core/controller/command portlet/src/main/org/jboss/portal/portlet/impl portlet/src/main/org/jboss/portal/portlet/impl/jsr168 portlet/src/main/org/jboss/portal/portlet/impl/spi portlet/src/main/org/jboss/portal/portlet/invocation portlet/src/main/org/jboss/portal/portlet/invocation/response portlet/src/main/org/jboss/portal/portlet/spi portlet/src/main/org/jboss/portal/portlet/test server/src/main/org/jboss/portal/server/impl theme/src/main/org/jboss/portal/test/theme/render
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Oct 18 13:57:30 EDT 2006
Author: julien at jboss.com
Date: 2006-10-18 13:57:07 -0400 (Wed, 18 Oct 2006)
New Revision: 5477
Added:
trunk/common/src/main/org/jboss/portal/common/invocation/EmptyAttributeResolver.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/RequestPropertiesAttributeResolver.java
Modified:
trunk/common/src/main/org/jboss/portal/common/invocation/AttributeResolver.java
trunk/common/src/main/org/jboss/portal/common/invocation/EmptyInterceptorStackFactory.java
trunk/common/src/main/org/jboss/portal/common/util/Tools.java
trunk/common/src/main/org/jboss/portal/test/common/AbstractInvocationContextTestCase.java
trunk/core/src/main/org/jboss/portal/core/controller/command/RenderPageCommand.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionResponseImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletResponseImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderResponseImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractRequestContext.java
trunk/portlet/src/main/org/jboss/portal/portlet/invocation/PortletInvocation.java
trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/FragmentResponse.java
trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/RenderResponse.java
trunk/portlet/src/main/org/jboss/portal/portlet/spi/RequestContext.java
trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java
trunk/server/src/main/org/jboss/portal/server/impl/AbstractSessionAttributeResolver.java
trunk/server/src/main/org/jboss/portal/server/impl/MapAttributeResolver.java
trunk/server/src/main/org/jboss/portal/server/impl/RequestAttributeResolver.java
trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderContext.java
Log:
remove usage of Properties object for request/response in portlet container, instead leverage invocation attribute resolver using request_properties and response_properties scope
Modified: trunk/common/src/main/org/jboss/portal/common/invocation/AttributeResolver.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/invocation/AttributeResolver.java 2006-10-18 15:48:59 UTC (rev 5476)
+++ trunk/common/src/main/org/jboss/portal/common/invocation/AttributeResolver.java 2006-10-18 17:57:07 UTC (rev 5477)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.common.invocation;
+import java.util.Set;
+
/**
* An attribute resolver.
*
@@ -31,6 +33,13 @@
public interface AttributeResolver
{
/**
+ * Returns the set of keys of the attributes bound in that resolver.
+ *
+ * @return a set of keys
+ */
+ Set getKeys();
+
+ /**
* Return an attribute from this resolver.
*
* @param attrKey
Added: trunk/common/src/main/org/jboss/portal/common/invocation/EmptyAttributeResolver.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/invocation/EmptyAttributeResolver.java 2006-10-18 15:48:59 UTC (rev 5476)
+++ trunk/common/src/main/org/jboss/portal/common/invocation/EmptyAttributeResolver.java 2006-10-18 17:57:07 UTC (rev 5477)
@@ -0,0 +1,63 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.common.invocation;
+
+import java.util.Set;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class EmptyAttributeResolver implements AttributeResolver
+{
+
+ /** . */
+ private static final EmptyAttributeResolver instance = new EmptyAttributeResolver();
+
+ public static EmptyAttributeResolver getInstance()
+ {
+ return instance;
+ }
+
+ public Set getKeys()
+ {
+ return Collections.EMPTY_SET;
+ }
+
+ public Object getAttribute(Object attrKey) throws IllegalArgumentException
+ {
+ if (attrKey == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return null;
+ }
+
+ public void setAttribute(Object attrKey, Object attrValue) throws IllegalArgumentException
+ {
+ if (attrKey == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+}
Modified: trunk/common/src/main/org/jboss/portal/common/invocation/EmptyInterceptorStackFactory.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/invocation/EmptyInterceptorStackFactory.java 2006-10-18 15:48:59 UTC (rev 5476)
+++ trunk/common/src/main/org/jboss/portal/common/invocation/EmptyInterceptorStackFactory.java 2006-10-18 17:57:07 UTC (rev 5477)
@@ -29,7 +29,8 @@
public class EmptyInterceptorStackFactory implements InterceptorStackFactory
{
- public static final InterceptorStack EMPTY_STACK = new InterceptorStack()
+ /** . */
+ private static final InterceptorStack instance = new InterceptorStack()
{
public int getLength()
{
@@ -41,8 +42,13 @@
}
};
+ public static InterceptorStack getInstance()
+ {
+ return instance;
+ }
+
public InterceptorStack getInterceptorStack()
{
- return EMPTY_STACK;
+ return getInstance();
}
}
Modified: trunk/common/src/main/org/jboss/portal/common/util/Tools.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/Tools.java 2006-10-18 15:48:59 UTC (rev 5476)
+++ trunk/common/src/main/org/jboss/portal/common/util/Tools.java 2006-10-18 17:57:07 UTC (rev 5477)
@@ -373,6 +373,30 @@
};
}
+ public static Enumeration toEnumeration(final Object o)
+ {
+ return new Enumeration()
+ {
+ boolean hasMore = false;
+ public boolean hasMoreElements()
+ {
+ return hasMore;
+ }
+
+ public Object nextElement()
+ {
+ if (hasMore)
+ {
+ hasMore = false;
+ }
+ else{
+ throw new NoSuchElementException();
+ }
+ return o;
+ }
+ };
+ }
+
public static Set toSet(Enumeration e)
{
HashSet set = new HashSet();
Modified: trunk/common/src/main/org/jboss/portal/test/common/AbstractInvocationContextTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/AbstractInvocationContextTestCase.java 2006-10-18 15:48:59 UTC (rev 5476)
+++ trunk/common/src/main/org/jboss/portal/test/common/AbstractInvocationContextTestCase.java 2006-10-18 17:57:07 UTC (rev 5477)
@@ -28,6 +28,7 @@
import org.jboss.portal.common.invocation.AttributeResolver;
import java.util.HashMap;
+import java.util.Set;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -220,6 +221,10 @@
private static class MapResolver extends HashMap implements AttributeResolver
{
+ public Set getKeys()
+ {
+ return keySet();
+ }
public Object getAttribute(Object attrKey) throws IllegalArgumentException
{
if (attrKey == null)
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/RenderPageCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/RenderPageCommand.java 2006-10-18 15:48:59 UTC (rev 5476)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/RenderPageCommand.java 2006-10-18 17:57:07 UTC (rev 5477)
@@ -416,7 +416,8 @@
windowTitle = window.getName();
}
headerChars = fragment.getHeader();
- responseProps = fragment.getProperties();
+// responseProps = fragment.getProperties();
+ responseProps = new Properties(); // remove me
//
Instance instance = renderCmd.getInstance();
Added: trunk/portlet/src/main/org/jboss/portal/portlet/impl/RequestPropertiesAttributeResolver.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/RequestPropertiesAttributeResolver.java 2006-10-18 15:48:59 UTC (rev 5476)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/RequestPropertiesAttributeResolver.java 2006-10-18 17:57:07 UTC (rev 5477)
@@ -0,0 +1,30 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.portlet.impl;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class RequestPropertiesAttributeResolver
+{
+}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionResponseImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionResponseImpl.java 2006-10-18 15:48:59 UTC (rev 5476)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionResponseImpl.java 2006-10-18 17:57:07 UTC (rev 5477)
@@ -26,7 +26,6 @@
import org.jboss.portal.Mode;
import org.jboss.portal.common.util.URLTools;
import org.jboss.portal.portlet.ParametersStateString;
-import org.jboss.portal.portlet.Properties;
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.response.HTTPRedirectionResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
@@ -64,7 +63,6 @@
//
RenderResponse rr = new RenderResponse();
rr.setNavigationalState(new ParametersStateString());
- rr.setProperties(new Properties());
//
this.response = rr;
@@ -199,24 +197,4 @@
throw new IllegalStateException("setRenderParameter cannot be called after redirect");
}
}
-
- public void addProperty(String name, String value)
- {
- if (response instanceof RenderResponse)
- {
- RenderResponse renderResult = (RenderResponse)response;
- Properties properties = renderResult.getProperties();
- properties.addProperty(name, value);
- }
- }
-
- public void setProperty(String name, String value)
- {
- if (response instanceof RenderResponse)
- {
- RenderResponse renderResult = (RenderResponse)response;
- Properties properties = renderResult.getProperties();
- properties.setProperty(name, value);
- }
- }
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestImpl.java 2006-10-18 15:48:59 UTC (rev 5476)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestImpl.java 2006-10-18 17:57:07 UTC (rev 5477)
@@ -57,6 +57,7 @@
import java.util.Map;
import java.util.Set;
import java.util.Vector;
+import java.util.Collection;
/**
* PortletRequest implemention. The parameter implementation is left to subclasses that can implement it differently.
@@ -305,7 +306,26 @@
{
throw new IllegalArgumentException("name must not be null");
}
- return requestContext.getPropertyValue(name);
+
+ //
+ Object prop = invocation.getAttribute(PortletInvocation.REQUEST_PROPERTIES_SCOPE, name);
+ if (prop instanceof Collection)
+ {
+ Iterator iterator = ((Collection)prop).iterator();
+ if (iterator.hasNext())
+ {
+ prop = iterator.next();
+ }
+ }
+
+ //
+ if (prop == null)
+ {
+ // Otherwise the request header
+ prop = dreq.getHeader(name);
+ }
+
+ return (String)prop;
}
public Enumeration getProperties(String name)
@@ -314,12 +334,37 @@
{
throw new IllegalArgumentException("name must not be null");
}
- return requestContext.getPropertyValues(name);
+
+ //
+ Object prop = invocation.getAttribute(PortletInvocation.REQUEST_PROPERTIES_SCOPE, name);
+ if (prop == null)
+ {
+ // Otherwise the request headers
+ return dreq.getHeaders(name);
+ }
+ else if (prop instanceof Collection)
+ {
+ return Collections.enumeration(((Collection)prop));
+ }
+ else
+ {
+ return Tools.toEnumeration(prop);
+ }
}
public Enumeration getPropertyNames()
{
- Set names = requestContext.getPropertyNames();
+ // First the properties
+ Set names = new HashSet(invocation.getContext().getAttributeResolver(PortletInvocation.REQUEST_PROPERTIES_SCOPE).getKeys());
+
+ // Then put the headers
+ for (Enumeration e = dreq.getHeaderNames();e.hasMoreElements();)
+ {
+ String name = (String)e.nextElement();
+ names.add(name);
+ }
+
+ //
return Collections.enumeration(names);
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletResponseImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletResponseImpl.java 2006-10-18 15:48:59 UTC (rev 5476)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletResponseImpl.java 2006-10-18 17:57:07 UTC (rev 5477)
@@ -23,8 +23,11 @@
package org.jboss.portal.portlet.impl.jsr168;
import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.common.invocation.AttributeResolver;
import javax.portlet.PortletResponse;
+import java.util.Collection;
+import java.util.ArrayList;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -53,4 +56,50 @@
}
return invocation.getPortletContext().encodeURL(url);
}
+
+ public void addProperty(String key, String value) throws IllegalArgumentException
+ {
+ if (key == null)
+ {
+ throw new IllegalArgumentException("Name cannot be null");
+ }
+ if (value == null)
+ {
+ throw new IllegalArgumentException("Value cannot be null");
+ }
+
+ //
+ AttributeResolver resolver = invocation.getContext().getAttributeResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE);
+ Object prop = resolver.getAttribute(key);
+ if (prop == null)
+ {
+ resolver.setAttribute(key, prop);
+ }
+ else if (prop instanceof Collection)
+ {
+ ((Collection)prop).add(value);
+ }
+ else
+ {
+ Collection c = new ArrayList();
+ c.add(prop);
+ c.add(value);
+ resolver.setAttribute(key, c);
+ }
+ }
+
+ public void setProperty(String key, String value) throws IllegalArgumentException
+ {
+ if (key == null)
+ {
+ throw new IllegalArgumentException("Name cannot be null");
+ }
+ if (value == null)
+ {
+ throw new IllegalArgumentException("Value cannot be null");
+ }
+
+ //
+ invocation.setAttribute(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, key, value);
+ }
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderResponseImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderResponseImpl.java 2006-10-18 15:48:59 UTC (rev 5476)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderResponseImpl.java 2006-10-18 17:57:07 UTC (rev 5477)
@@ -23,8 +23,8 @@
package org.jboss.portal.portlet.impl.jsr168;
import org.jboss.portal.common.MediaType;
-import org.jboss.portal.portlet.Properties;
import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.server.util.HTTPStreamInfo;
@@ -173,7 +173,7 @@
result.resetBuffer();
// And properties
- result.getProperties().clear();
+ invocation.getContext().getAttributeResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE).getKeys().clear();
}
public boolean isCommitted()
@@ -181,16 +181,4 @@
// Never afterCommit
return false;
}
-
- public void addProperty(String name, String value)
- {
- Properties properties = result.getProperties();
- properties.addProperty(name, value);
- }
-
- public void setProperty(String name, String value)
- {
- Properties properties = result.getProperties();
- properties.setProperty(name, value);
- }
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractRequestContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractRequestContext.java 2006-10-18 15:48:59 UTC (rev 5476)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractRequestContext.java 2006-10-18 17:57:07 UTC (rev 5477)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.spi;
-import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.portlet.Properties;
import org.jboss.portal.portlet.spi.RequestContext;
import javax.servlet.RequestDispatcher;
@@ -32,9 +30,6 @@
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -45,7 +40,6 @@
private HttpServletRequest req;
private HttpServletResponse resp;
- private Properties properties;
public AbstractRequestContext(HttpServletRequest req, HttpServletResponse resp)
{
@@ -81,94 +75,6 @@
return req.getAttributeNames();
}
- public void addPropertyValue(String name, String value)
- {
- if (properties == null)
- {
- properties = new Properties();
- }
- properties.addProperty(name, value);
- }
-
- public void setPropertyValue(String name, String value)
- {
- if (properties == null)
- {
- properties = new Properties();
- }
- properties.setProperty(name, value);
- }
-
- public String getPropertyValue(String name)
- {
- String value = null;
-
- // First try the request properties
- if (properties != null)
- {
- value = properties.getProperty(name);
- }
-
- // Otherwise the request header
- if (value == null)
- {
- value = getClientRequest().getHeader(name);
- }
-
- //
- return value;
- }
-
- public Enumeration getPropertyValues(String name)
- {
- Enumeration e = null;
-
- // First try the request properties
- if (properties != null)
- {
- List values = properties.getProperties(name);
- if (values != null)
- {
- e = Tools.toEnumeration(values.iterator());
- }
- }
-
- // Otherwise the request headers
- if (e == null)
- {
- e = getClientRequest().getHeaders(name);
- }
-
- //
- return e;
- }
-
- public Set getPropertyNames()
- {
- Set names = null;
-
- // First the properties
- if (properties != null)
- {
- names = new HashSet(properties.getPropertyNames());
- }
-
- // Then put the headers
- Enumeration e = getClientRequest().getHeaderNames();
- if (e.hasMoreElements() && names == null)
- {
- names = new HashSet();
- while (e.hasMoreElements())
- {
- String name = (String)e.nextElement();
- names.add(name);
- }
- }
-
- //
- return names;
- }
-
public String getScheme()
{
return getClientRequest().getScheme();
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/invocation/PortletInvocation.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/invocation/PortletInvocation.java 2006-10-18 15:48:59 UTC (rev 5476)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/invocation/PortletInvocation.java 2006-10-18 17:57:07 UTC (rev 5477)
@@ -25,9 +25,7 @@
import org.jboss.portal.common.invocation.Invocation;
import org.jboss.portal.common.invocation.InvocationContext;
import org.jboss.portal.common.invocation.Scope;
-import org.jboss.portal.portlet.Properties;
import org.jboss.portal.portlet.info.PortletInfo;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.spi.InstanceContext;
import org.jboss.portal.portlet.spi.PortalContext;
import org.jboss.portal.portlet.spi.PortletInvocationContext;
@@ -55,6 +53,12 @@
/** The request scope. */
public static final Scope REQUEST_SCOPE = ServerInvocation.REQUEST_SCOPE;
+ /** The request properties . */
+ public static final Scope REQUEST_PROPERTIES_SCOPE = new Scope("request_properties");
+
+ /** The response properties. */
+ public static final Scope RESPONSE_PROPERTIES_SCOPE = new Scope("response_properties");
+
/** The attribute name under which the portlet id can be accessed. */
public static final String PORTLET_CONTEXT_ATTRIBUTE = "portletcontext";
@@ -85,9 +89,6 @@
/** The window context. */
protected WindowContext windowContext;
- /** The request properties. */
- protected Properties properties;
-
/** The portlet info we want to invoke. */
protected PortletInfo info;
@@ -106,9 +107,6 @@
/** The invocation context. */
protected PortletInvocationContext ctx;
- /** Temporarily here. */
- private PortletInvocationResponse response;
-
/** Create an invocation to a portlet. */
protected PortletInvocation(PortletInvocationContext ctx)
{
@@ -117,7 +115,6 @@
throw new IllegalArgumentException();
}
this.ctx = ctx;
- this.properties = new Properties();
}
public InvocationContext getContext()
@@ -160,16 +157,6 @@
this.info = info;
}
- public Properties getProperties()
- {
- return properties;
- }
-
- public void setProperties(Properties properties)
- {
- this.properties = properties;
- }
-
/** Return the dispatched http servlet request. */
public HttpServletResponse getDispatchedResponse()
{
@@ -253,5 +240,4 @@
{
this.windowContext = windowContext;
}
-
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/FragmentResponse.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/FragmentResponse.java 2006-10-18 15:48:59 UTC (rev 5476)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/FragmentResponse.java 2006-10-18 17:57:07 UTC (rev 5477)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.invocation.response;
-import org.jboss.portal.portlet.Properties;
-
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@@ -61,9 +59,6 @@
/** The title if any. */
private String title;
- /** The response properties. */
- protected Properties properties;
-
/** Number of seconds this result remains valid, a value of -1 indicates that it never expires. */
protected int expirationSecs;
@@ -75,7 +70,6 @@
this.writer = null;
this.contentType = null;
this.title = null;
- this.properties = new Properties();
this.expirationSecs = 0;
}
@@ -231,12 +225,6 @@
}
}
- public Properties getProperties()
- {
- return properties;
- }
-
-
public int getExpirationSecs()
{
return expirationSecs;
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/RenderResponse.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/RenderResponse.java 2006-10-18 15:48:59 UTC (rev 5476)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/invocation/response/RenderResponse.java 2006-10-18 17:57:07 UTC (rev 5477)
@@ -24,7 +24,6 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.portlet.Properties;
import org.jboss.portal.portlet.StateString;
/**
@@ -39,9 +38,6 @@
/** The navigational state returned. */
protected StateString state;
- /** The response properties. */
- protected Properties properties;
-
/** The new window state requested. */
protected WindowState windowState;
@@ -51,7 +47,6 @@
public RenderResponse()
{
state = null;
- properties = null;
windowState = null;
mode = null;
}
@@ -85,14 +80,4 @@
{
this.state = state;
}
-
- public Properties getProperties()
- {
- return properties;
- }
-
- public void setProperties(Properties properties)
- {
- this.properties = properties;
- }
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/spi/RequestContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/spi/RequestContext.java 2006-10-18 15:48:59 UTC (rev 5476)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/spi/RequestContext.java 2006-10-18 17:57:07 UTC (rev 5477)
@@ -47,31 +47,6 @@
/**
*
*/
- void addPropertyValue(String name, String value);
-
- /**
- *
- */
- void setPropertyValue(String name, String value);
-
- /**
- *
- */
- String getPropertyValue(String name);
-
- /**
- *
- */
- Enumeration getPropertyValues(String name);
-
- /**
- *
- */
- Set getPropertyNames();
-
- /**
- *
- */
String getScheme();
/**
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java 2006-10-18 15:48:59 UTC (rev 5476)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java 2006-10-18 17:57:07 UTC (rev 5477)
@@ -25,6 +25,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.NotYetImplemented;
+import org.jboss.portal.common.invocation.EmptyAttributeResolver;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.util.URLTools;
import org.jboss.portal.jems.as.system.AbstractJBossService;
@@ -68,6 +69,7 @@
import org.jboss.portal.server.RequestController;
import org.jboss.portal.server.ServerException;
import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.impl.MapAttributeResolver;
import org.jboss.portal.server.request.URLFormat;
import org.jboss.portal.server.util.HTTPStreamInfo;
import org.jboss.portal.test.framework.container.TestCaseContext;
@@ -531,6 +533,7 @@
RequestContext requestContext = new AbstractRequestContext(invocationContext.getClientRequest(), invocationContext.getClientResponse());
InstanceContext instanceContext = new InstanceContextImpl(invocationContext.portlet, invocationContext.getClientRequest());
+ //
WindowContext windowContext = new WindowContext()
{
public String getId()
@@ -599,6 +602,8 @@
//
addResolver(ServerInvocation.REQUEST_SCOPE, invocation.getContext());
addResolver(ServerInvocation.PRINCIPAL_SCOPE, invocation.getContext());
+ addResolver(PortletInvocation.REQUEST_PROPERTIES_SCOPE, EmptyAttributeResolver.getInstance());
+ addResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, new MapAttributeResolver());
}
public HttpServletResponse getClientResponse()
Modified: trunk/server/src/main/org/jboss/portal/server/impl/AbstractSessionAttributeResolver.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/impl/AbstractSessionAttributeResolver.java 2006-10-18 15:48:59 UTC (rev 5476)
+++ trunk/server/src/main/org/jboss/portal/server/impl/AbstractSessionAttributeResolver.java 2006-10-18 17:57:07 UTC (rev 5477)
@@ -28,6 +28,8 @@
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
+import java.util.Collections;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -48,6 +50,22 @@
this.req = req;
}
+
+ public Set getKeys()
+ {
+ Map map = getMap(false);
+
+ //
+ if (map != null)
+ {
+ return map.keySet();
+ }
+ else
+ {
+ return Collections.EMPTY_SET;
+ }
+ }
+
public Object getAttribute(Object attrKey) throws IllegalArgumentException
{
if (attrKey == null)
Modified: trunk/server/src/main/org/jboss/portal/server/impl/MapAttributeResolver.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/impl/MapAttributeResolver.java 2006-10-18 15:48:59 UTC (rev 5476)
+++ trunk/server/src/main/org/jboss/portal/server/impl/MapAttributeResolver.java 2006-10-18 17:57:07 UTC (rev 5477)
@@ -26,6 +26,7 @@
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -51,6 +52,12 @@
this(new HashMap());
}
+
+ public Set getKeys()
+ {
+ return attributes.keySet();
+ }
+
public Object getAttribute(Object attrKey) throws IllegalArgumentException
{
if (attrKey == null)
Modified: trunk/server/src/main/org/jboss/portal/server/impl/RequestAttributeResolver.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/impl/RequestAttributeResolver.java 2006-10-18 15:48:59 UTC (rev 5476)
+++ trunk/server/src/main/org/jboss/portal/server/impl/RequestAttributeResolver.java 2006-10-18 17:57:07 UTC (rev 5477)
@@ -23,8 +23,10 @@
package org.jboss.portal.server.impl;
import org.jboss.portal.common.invocation.AttributeResolver;
+import org.jboss.portal.common.util.Tools;
import javax.servlet.http.HttpServletRequest;
+import java.util.Set;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -45,6 +47,12 @@
this.req = req;
}
+
+ public Set getKeys()
+ {
+ return Tools.toSet(req.getAttributeNames());
+ }
+
public Object getAttribute(Object attrKey) throws IllegalArgumentException
{
if (attrKey == null)
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderContext.java 2006-10-18 15:48:59 UTC (rev 5476)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderContext.java 2006-10-18 17:57:07 UTC (rev 5477)
@@ -49,6 +49,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
/**
* @author <a href="mailto:mholzner at novell.com">Martin Holzner</a>
@@ -84,11 +85,14 @@
navCtx = new AttributeResolver()
{
+ public Set getKeys()
+ {
+ throw new UnsupportedOperationException();
+ }
public Object getAttribute(Object attrKey) throws IllegalArgumentException
{
throw new UnsupportedOperationException();
}
-
public void setAttribute(Object attrKey, Object attrValue) throws IllegalArgumentException
{
throw new UnsupportedOperationException();
More information about the jboss-svn-commits
mailing list