JBoss Portal SVN: r9517 - in modules/portlet/trunk: portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168 and 8 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-15 17:45:05 -0500 (Tue, 15 Jan 2008)
New Revision: 9517
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/RequestParameters.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletParametersStateString.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ActionRequestImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ActionResponseImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventRequestImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventResponseImpl.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/jsr168/api/RenderRequestImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractActionContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractEventContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractRenderContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/NavigationInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/ParameterInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/StateResponse.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/UpdateNavigationalStateResponse.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/PortletInvocationContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/NavigationInfoSupport.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/ParameterInfoSupport.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/spi/PortletInvocationContextSupport.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalNavigationalState.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestActionContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestEventContext.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestRenderContext.java
Log:
more code for public parameters
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletParametersStateString.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletParametersStateString.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/PortletParametersStateString.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -75,6 +75,18 @@
}
}
+ public static PortletParametersStateString create(StateString stateString)
+ {
+ if (stateString instanceof PortletParametersStateString)
+ {
+ return (PortletParametersStateString)stateString;
+ }
+ else
+ {
+ return new PortletParametersStateString(stateString.getStringValue());
+ }
+ }
+
public static PortletParametersStateString create(Map<String, String[]> parameterMap)
{
PortletParameters params = PortletParameters.wrap(parameterMap);
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/RequestParameters.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/RequestParameters.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/RequestParameters.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -0,0 +1,197 @@
+/******************************************************************************
+ * 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. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168;
+
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+import org.jboss.portal.portlet.spi.ActionContext;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.PortletParameters;
+import org.jboss.portal.portlet.PortletParametersStateString;
+
+/**
+ * The main responsibility of this class is to combine the different parameter sources (private navigational state,
+ * public navigational state, interaction state, form) into the private map, public map and parameter map.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class RequestParameters
+{
+
+ /** . */
+ protected final ParameterMap parameters;
+
+ /** . */
+ protected final ParameterMap privateParameters;
+
+ /** . */
+ protected final ParameterMap publicParameters;
+
+ public RequestParameters(PortletInvocationContext context)
+ {
+ if (context instanceof ActionContext)
+ {
+ ActionContext actionContext = (ActionContext)context;
+
+ // Get the possibly null interaction state
+ StateString interactionState = actionContext.getInteractionState();
+
+ // Take care of the interaction state if any
+ PortletParameters privateParameters = null;
+
+ //
+ if (interactionState != null)
+ {
+ // Unserialize the interaction state if necessary
+ PortletParametersStateString parametersState;
+ if (interactionState instanceof PortletParametersStateString)
+ {
+ parametersState = (PortletParametersStateString)interactionState;
+ }
+ else
+ {
+ parametersState = new PortletParametersStateString(interactionState.getStringValue());
+ }
+
+ //
+ privateParameters = parametersState.getParameters();
+ }
+
+ //
+ PortletParameters form = actionContext.getForm();
+ if (form != null)
+ {
+ if (privateParameters == null)
+ {
+ privateParameters = form;
+ }
+ else
+ {
+ privateParameters = new PortletParameters(privateParameters);
+ privateParameters.append(form);
+ }
+ }
+
+ //
+ ParameterMap publicParameters = actionContext.getPublicNavigationalState();
+
+ //
+ ParameterMap parameters;
+ if (publicParameters != null)
+ {
+ if (privateParameters != null)
+ {
+ PortletParameters tmp = new PortletParameters(privateParameters);
+ tmp.append(publicParameters);
+ parameters = tmp;
+ }
+ else
+ {
+ parameters = publicParameters;
+ }
+ }
+ else
+ {
+ if (privateParameters != null)
+ {
+ parameters = privateParameters;
+ }
+ else
+ {
+ parameters = null;
+ }
+ }
+
+ //
+ this.privateParameters = privateParameters;
+ this.publicParameters = publicParameters;
+ this.parameters = parameters;
+ }
+ else
+ {
+ // Get the possibly null navigational state
+ StateString navigationalState = context.getNavigationalState();
+
+ //
+ ParameterMap privateParameters;
+ if (navigationalState == null)
+ {
+ privateParameters = null;
+ }
+ else
+ {
+ privateParameters = PortletParametersStateString.create(navigationalState).getParameters();
+ }
+
+ //
+ ParameterMap publicParameters = context.getPublicNavigationalState();
+
+ // Build combined map
+ ParameterMap parameters;
+ if (publicParameters != null)
+ {
+ if (privateParameters != null)
+ {
+ parameters = new PortletParameters(privateParameters);
+ parameters.putAll(publicParameters);
+ }
+ else
+ {
+ parameters = publicParameters;
+ }
+ }
+ else
+ {
+ if (privateParameters != null)
+ {
+ parameters = privateParameters;
+ }
+ else
+ {
+ parameters = null;
+ }
+ }
+
+ //
+ this.privateParameters = privateParameters;
+ this.publicParameters = publicParameters;
+ this.parameters = parameters;
+ }
+ }
+
+ public ParameterMap getParameters()
+ {
+ return parameters;
+ }
+
+ public ParameterMap getPrivateParameters()
+ {
+ return privateParameters;
+ }
+
+ public ParameterMap getPublicParameters()
+ {
+ return publicParameters;
+ }
+}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ActionRequestImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ActionRequestImpl.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ActionRequestImpl.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -26,6 +26,7 @@
import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.common.util.ParameterMap;
import javax.portlet.ActionRequest;
@@ -35,45 +36,8 @@
*/
public class ActionRequestImpl extends ClientDataRequestImpl implements ActionRequest
{
-
public ActionRequestImpl(ActionInvocation invocation)
{
super(invocation);
-
- // Get the possibly null interaction state
- StateString interactionState = actionContext.getInteractionState();
-
- // Take care of the interaction state if any
- if (interactionState != null)
- {
- // Unserialize the interaction state if necessary
- PortletParametersStateString parametersState = null;
- if (interactionState instanceof PortletParametersStateString)
- {
- parametersState = (PortletParametersStateString)interactionState;
- }
- else
- {
- parametersState = new PortletParametersStateString(interactionState.getStringValue());
- }
-
- //
- parameters = parametersState.getParameters();
- }
-
- //
- PortletParameters form = actionContext.getForm();
- if (form != null)
- {
- if (parameters == null)
- {
- parameters = form;
- }
- else
- {
- parameters = new PortletParameters(parameters);
- parameters.append(form);
- }
- }
}
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ActionResponseImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ActionResponseImpl.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/ActionResponseImpl.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -22,11 +22,9 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168.api;
-import org.apache.log4j.Logger;
import org.jboss.portal.common.NotYetImplemented;
import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.invocation.ActionInvocation;
-import org.jboss.portal.portlet.invocation.response.HTTPRedirectionResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
@@ -40,14 +38,8 @@
public class ActionResponseImpl extends StateAwareResponseImpl implements ActionResponse
{
- private static final Logger log = Logger.getLogger(ActionResponseImpl.class);
-
- protected static final int WANT_NOTHING = 0;
- protected static final int WANT_RENDER = 1;
- protected static final int WANT_REDIRECT = 2;
-
+ /** . */
protected PortletInvocationResponse response;
- protected int decision;
public ActionResponseImpl(ActionInvocation invocation, PortletRequestImpl preq)
{
@@ -59,7 +51,6 @@
//
this.response = rr;
- this.decision = WANT_NOTHING;
}
public void sendRedirect(String s, String s1) throws IOException
@@ -74,9 +65,29 @@
// do something more clever than simply returning
return;
}
+
if (location.startsWith("http://") || location.startsWith("https://") || location.startsWith("/"))
{
- sendRedirect(new HTTPRedirectionResponse(location));
+ //
+ if (decision == null)
+ {
+ WantRedirect redirect = new WantRedirect();
+ redirect.location = location;
+
+ //
+ decision = redirect;
+ }
+ else if (decision instanceof WantRedirect)
+ {
+ WantRedirect redirect = (WantRedirect)decision;
+ redirect.location = location;
+ }
+ else
+ {
+ throw new IllegalStateException("sendRedirect cannot be called after " +
+ "setPortletMode/setWindowState/setRenderParameter/setRenderParameters " +
+ "has been called previously");
+ }
}
else
{
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventRequestImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventRequestImpl.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventRequestImpl.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -24,9 +24,6 @@
import org.jboss.portal.portlet.invocation.EventInvocation;
import org.jboss.portal.portlet.spi.EventContext;
-import org.jboss.portal.portlet.spi.PortletInvocationContext;
-import org.jboss.portal.portlet.PortletParametersStateString;
-import org.jboss.portal.portlet.StateString;
import javax.portlet.EventRequest;
import javax.portlet.Event;
@@ -44,27 +41,6 @@
public EventRequestImpl(EventInvocation invocation)
{
super(invocation);
-
- //
- PortletInvocationContext context = invocation.getPortletContext();
-
- // Get the possibly null navigational state
- StateString navigationalState = context.getNavigationalState();
-
- //
- if (navigationalState == null)
- {
-
- }
- else if (navigationalState instanceof PortletParametersStateString)
- {
- parameters = ((PortletParametersStateString)navigationalState).getParameters();
- }
- else
- {
- PortletParametersStateString parametersState = new PortletParametersStateString(navigationalState.getStringValue());
- parameters = parametersState.getParameters();
- }
}
public Event getEvent()
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventResponseImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventResponseImpl.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/EventResponseImpl.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -23,8 +23,8 @@
package org.jboss.portal.portlet.impl.jsr168.api;
import org.jboss.portal.portlet.invocation.EventInvocation;
-import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
import org.jboss.portal.portlet.spi.PortletInvocationContext;
+import org.jboss.portal.portlet.PortletParametersStateString;
import javax.portlet.EventResponse;
import javax.portlet.EventRequest;
@@ -55,8 +55,10 @@
PortletInvocationContext context = invocation.getPortletContext();
//
- ((UpdateNavigationalStateResponse)response).setMode(context.getMode());
- ((UpdateNavigationalStateResponse)response).setWindowState(context.getWindowState());
- ((UpdateNavigationalStateResponse)response).setNavigationalState(context.getNavigationalState());
+ WantUpdate update = (WantUpdate)decision;
+ update.mode = context.getMode();
+ update.windowState = context.getWindowState();
+ update.navigationalState = PortletParametersStateString.create(context.getNavigationalState()).getParameters();
+ update.publicNavigationalState = context.getPublicNavigationalState();
}
}
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-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -24,15 +24,18 @@
import org.apache.log4j.Logger;
import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.common.NotYetImplemented;
-import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.portlet.container.PortletContainerInvoker;
import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
import org.jboss.portal.portlet.impl.jsr168.PortletRequestAttributes;
+import org.jboss.portal.portlet.impl.jsr168.RequestParameters;
import org.jboss.portal.portlet.impl.info.ContainerSecurityInfo;
import org.jboss.portal.portlet.impl.info.ContainerPreferencesInfo;
+import org.jboss.portal.portlet.impl.info.ContainerNavigationInfo;
+import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.spi.RequestContext;
import org.jboss.portal.portlet.spi.SecurityContext;
@@ -84,39 +87,45 @@
protected PortalContext portalContext;
protected PortletSessionImpl psession;
protected int sessionStatus;
+ protected ContainerNavigationInfo navigationInfo;
/** . */
- protected PortletParameters parameters;
+ protected final PortletRequestAttributes attributes;
/** . */
- protected final PortletRequestAttributes attributes;
+ protected final RequestParameters requestParameters;
public PortletRequestImpl(PortletInvocation invocation)
{
+ PortletContainerImpl container = (PortletContainerImpl)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PortletContainerInvoker.PORTLET_CONTAINER);
+ int mode = this instanceof RenderRequest ? PortletPreferencesImpl.RENDER : PortletPreferencesImpl.ACTION;
+ PropertyContext prefs = (PropertyContext)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PropertyContext.PREFERENCES_ATTRIBUTE);
+ PreferencesValidator validator = container.getPreferencesValidator();
+ ContainerPortletInfo info = container.getInfo();
+ ContainerPreferencesInfo containerPrefs = info.getPreferences();
+
//
this.invocation = invocation;
+ this.requestParameters = new RequestParameters(invocation.getPortletContext());
this.userContext = invocation.getUserContext();
this.securityContext = invocation.getSecurityContext();
this.requestContext = invocation.getRequestContext();
this.windowContext = invocation.getWindowContext();
- this.container = (PortletContainerImpl)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PortletContainerInvoker.PORTLET_CONTAINER);
+ this.container = container;
this.dreq = invocation.getDispatchedRequest();
this.portalContext = new PortalContextImpl(invocation.getPortalContext());
- this.parameters = null;
- this.attributes = new PortletRequestAttributes(container, userContext);
-
- //
- int mode = this instanceof RenderRequest ? PortletPreferencesImpl.RENDER : PortletPreferencesImpl.ACTION;
- PropertyContext prefs = (PropertyContext)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PropertyContext.PREFERENCES_ATTRIBUTE);
- PreferencesValidator validator = container.getPreferencesValidator();
- ContainerPreferencesInfo containerPrefs = container.getInfo().getPreferences();
+ this.attributes = new PortletRequestAttributes(this.container, userContext);
this.preferences = new PortletPreferencesImpl(prefs, containerPrefs, validator, mode);
+ this.navigationInfo = info.getNavigation();
}
// PLT.11.1.1
public String getParameter(String name)
{
+ ParameterMap parameters = requestParameters.getParameters();
+
+ //
if (name == null)
{
throw new IllegalArgumentException("name must not be null");
@@ -133,6 +142,9 @@
public Enumeration<String> getParameterNames()
{
+ ParameterMap parameters = requestParameters.getParameters();
+
+ //
if (parameters != null)
{
return Collections.enumeration(parameters.keySet());
@@ -149,6 +161,10 @@
{
throw new IllegalArgumentException("name must not be null");
}
+
+ ParameterMap parameters = requestParameters.getParameters();
+
+ //
if (parameters != null)
{
return parameters.getValues(name);
@@ -161,6 +177,9 @@
public Map<String, String[]> getParameterMap()
{
+ ParameterMap parameters = requestParameters.getParameters();
+
+ //
if (parameters != null)
{
return Collections.unmodifiableMap(parameters);
@@ -483,11 +502,31 @@
public Map<String, String[]> getPrivateParameterMap()
{
- throw new NotYetImplemented();
+ ParameterMap parameters = requestParameters.getPrivateParameters();
+
+ //
+ if (parameters != null)
+ {
+ return parameters;
+ }
+ else
+ {
+ return Collections.emptyMap();
+ }
}
public Map<String, String[]> getPublicParameterMap()
{
- throw new NotYetImplemented();
+ ParameterMap parameters = requestParameters.getPublicParameters();
+
+ //
+ if (parameters != null)
+ {
+ return parameters;
+ }
+ else
+ {
+ return Collections.emptyMap();
+ }
}
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/RenderRequestImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/RenderRequestImpl.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/RenderRequestImpl.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -24,10 +24,12 @@
import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.portlet.invocation.RenderInvocation;
import org.jboss.portal.portlet.spi.RenderContext;
import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.common.NotYetImplemented;
+import org.jboss.portal.common.util.ParameterMap;
import javax.portlet.RenderRequest;
import javax.servlet.http.Cookie;
@@ -44,27 +46,6 @@
public RenderRequestImpl(RenderInvocation invocation)
{
super(invocation);
-
- // Get the render context
- PortletInvocationContext context = invocation.getPortletContext();
-
- // Get the possibly null navigational state
- StateString navigationalState = context.getNavigationalState();
-
- //
- if (navigationalState == null)
- {
-
- }
- else if (navigationalState instanceof PortletParametersStateString)
- {
- parameters = ((PortletParametersStateString)navigationalState).getParameters();
- }
- else
- {
- PortletParametersStateString parametersState = new PortletParametersStateString(navigationalState.getStringValue());
- parameters = parametersState.getParameters();
- }
}
public String getETag()
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -24,18 +24,21 @@
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
-import org.jboss.portal.portlet.invocation.response.RedirectionResponse;
import org.jboss.portal.portlet.invocation.response.StateResponse;
+import org.jboss.portal.portlet.invocation.response.HTTPRedirectionResponse;
import org.jboss.portal.portlet.PortletParametersStateString;
+import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
import org.jboss.portal.portlet.impl.info.ContainerEventingInfo;
import org.jboss.portal.portlet.impl.info.ContainerPortletApplicationInfo;
import org.jboss.portal.portlet.impl.info.ContainerTypeInfo;
import org.jboss.portal.portlet.impl.info.ContainerEventInfo;
+import org.jboss.portal.portlet.impl.info.ContainerParameterInfo;
import org.jboss.portal.Mode;
import org.jboss.portal.common.NotYetImplemented;
import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.common.util.ParameterMap;
import org.apache.log4j.Logger;
import javax.portlet.StateAwareResponse;
@@ -51,6 +54,8 @@
import java.util.Calendar;
import java.util.Date;
import java.util.UUID;
+import java.util.List;
+import java.util.LinkedList;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.URI;
@@ -67,100 +72,85 @@
private static final Logger log = Logger.getLogger(ActionResponseImpl.class);
/** . */
- protected static final int WANT_NOTHING = 0;
+ protected Decision decision;
/** . */
- protected static final int WANT_RENDER = 1;
+ private List<StateResponse.Event> events;
- /** . */
- protected static final int WANT_REDIRECT = 2;
-
- /** . */
- protected StateResponse response;
-
- /** . */
- protected int decision;
-
public StateAwareResponseImpl(PortletInvocation invocation, PortletRequestImpl preq)
{
super(invocation, preq);
//
- UpdateNavigationalStateResponse rr = new UpdateNavigationalStateResponse();
- rr.setNavigationalState(new PortletParametersStateString());
-
- //
- this.response = rr;
- this.decision = WANT_NOTHING;
+ this.decision = null;
}
public StateResponse getResponse()
{
- return response;
+ Decision decision = this.decision;
+
+ //
+ if (decision == null)
+ {
+ decision = new WantUpdate();
+ }
+
+ //
+ return decision.getResponse();
}
- public void setWindowState(WindowState windowState) throws WindowStateException
+ protected WantUpdate wantUpdate(String errorMsg)
{
- if (decision == WANT_NOTHING || decision == WANT_RENDER)
+ if (decision instanceof WantUpdate)
{
- if (!preq.isWindowStateAllowed(windowState))
- {
- throw new WindowStateException("Not supported", windowState);
- }
- ((UpdateNavigationalStateResponse)response).setWindowState(org.jboss.portal.WindowState.create(windowState.toString()));
- decision = WANT_RENDER;
+ return (WantUpdate)decision;
}
+ else if (decision == null)
+ {
+ return new WantUpdate();
+ }
else
{
- throw new IllegalStateException("Window state cannot be set after redirect");
+ throw new IllegalStateException(errorMsg);
}
}
- public void setPortletMode(PortletMode portletMode) throws PortletModeException
+ public void setWindowState(WindowState windowState) throws WindowStateException
{
- if (decision == WANT_NOTHING || decision == WANT_RENDER)
+ WantUpdate update = wantUpdate("Window state cannot be set after redirect");
+
+ //
+ if (!preq.isWindowStateAllowed(windowState))
{
- if (portletMode == null)
- {
- // The spec does not define that case
- // we just issue a warn
- log.warn("Set null portlet mode");
- }
- else
- {
- if (!preq.isPortletModeAllowed(portletMode))
- {
- throw new PortletModeException("Not supported", portletMode);
- }
- Mode mode = Mode.create(portletMode.toString());
- ((UpdateNavigationalStateResponse)response).setMode(mode);
- }
- decision = WANT_RENDER;
+ throw new WindowStateException("Not supported", windowState);
}
- else
- {
- throw new IllegalStateException("Portlet mode cannot be set after redirect");
- }
+
+ //
+ update.windowState = org.jboss.portal.WindowState.create(windowState.toString());
+ decision = update;
}
- /**
- * Generic send redirect.
- *
- * @param redirect
- * @throws IllegalStateException implement jsr168 behavior if the portlet as already commited stuff
- */
- protected final void sendRedirect(RedirectionResponse redirect) throws IllegalStateException
+ public void setPortletMode(PortletMode portletMode) throws PortletModeException
{
- if (decision == WANT_NOTHING || decision == WANT_REDIRECT)
+ WantUpdate update = wantUpdate("Portlet mode cannot be set after redirect");
+
+ //
+ if (portletMode == null)
{
- response = redirect;
- decision = WANT_REDIRECT;
+ // The spec does not define that case
+ // we just issue a warn
+ log.warn("Set null portlet mode");
}
else
{
- throw new IllegalStateException("sendRedirect cannot be called after " +
- "setPortletMode/setWindowState/setRenderParameter/setRenderParameters " +
- "has been called previously");
+ if (!preq.isPortletModeAllowed(portletMode))
+ {
+ throw new PortletModeException("Not supported", portletMode);
+ }
+
+ //
+ update.mode = Mode.create(portletMode.toString());
+ decision = update;
}
}
@@ -169,15 +159,11 @@
PortletUtils.checkPortletParameterMapValidity(map);
//
- if (decision == WANT_NOTHING || decision == WANT_RENDER)
- {
- ((PortletParametersStateString)((UpdateNavigationalStateResponse)response).getNavigationalState()).replace(map);
- decision = WANT_RENDER;
- }
- else
- {
- throw new IllegalStateException("setRenderParameters cannot be called after redirect");
- }
+ WantUpdate update = wantUpdate("setRenderParameters cannot be called after redirect");
+
+ //
+ update.navigationalState.replace(map);
+ decision = update;
}
public void setRenderParameter(String name, String value)
@@ -185,15 +171,7 @@
PortletUtils.checkPortletParameterValidity(name, value);
//
- if (decision == WANT_NOTHING || decision == WANT_RENDER)
- {
- ((PortletParametersStateString)((UpdateNavigationalStateResponse)response).getNavigationalState()).setValue(name, value);
- decision = WANT_RENDER;
- }
- else
- {
- throw new IllegalStateException("setRenderParameter cannot be called after redirect");
- }
+ setRenderParameter(name, new String[]{value});
}
public void setRenderParameter(String name, String[] values)
@@ -201,15 +179,23 @@
PortletUtils.checkPortletParameterValidity(name, values);
//
- if (decision == WANT_NOTHING || decision == WANT_RENDER)
+ WantUpdate update = wantUpdate("setRenderParameter cannot be called after redirect");
+
+ // Find out
+ ContainerParameterInfo pi = preq.navigationInfo.getPublicParameter(name);
+
+ //
+ if (pi != null)
{
- ((PortletParametersStateString)((UpdateNavigationalStateResponse)response).getNavigationalState()).setValues(name, values);
- decision = WANT_RENDER;
+ update.publicNavigationalState.setValues(name, values);
}
else
{
- throw new IllegalStateException("setRenderParameter cannot be called after redirect");
+ update.navigationalState.setValues(name, values);
}
+
+ //
+ decision = update;
}
private static final Set<? extends Class<? extends Serializable>> acceptedFinalClasses = Tools.toSet(
@@ -313,7 +299,7 @@
}
//
- response.addEvent(new StateResponse.Event(name, value));
+ queueEvent(name, value);
}
public void setEvent(String localName, Serializable value)
@@ -348,4 +334,79 @@
{
throw new NotYetImplemented();
}
+
+ protected final void queueEvent(QName name, Serializable value)
+ {
+ if (events == null)
+ {
+ events = new LinkedList<StateResponse.Event>();
+ }
+ events.add(new StateResponse.Event(name, value));
+ }
+
+ private abstract class Decision
+ {
+
+ protected StateResponse getResponse()
+ {
+ StateResponse response = createResponse();
+
+ //
+ if (events != null)
+ {
+ for (StateResponse.Event event : events)
+ {
+ response.queueEvent(event);
+ }
+ }
+
+ //
+ return response;
+ }
+
+ protected abstract StateResponse createResponse();
+
+ }
+
+ protected class WantUpdate extends Decision
+ {
+
+ /** The navigational state returned. */
+ protected PortletParameters navigationalState = new PortletParameters();
+
+ /** The new window state requested. */
+ protected org.jboss.portal.WindowState windowState;
+
+ /** The new mode requested. */
+ protected Mode mode;
+
+ /** The update to the shared parameters. */
+ protected ParameterMap publicNavigationalState = new ParameterMap();
+
+ protected StateResponse createResponse()
+ {
+ UpdateNavigationalStateResponse response = new UpdateNavigationalStateResponse();
+
+ //
+ response.setMode(mode);
+ response.setWindowState(windowState);
+ response.setPublicNavigationalState(publicNavigationalState);
+ response.setNavigationalState(new PortletParametersStateString(navigationalState));
+
+ //
+ return response;
+ }
+ }
+
+ protected class WantRedirect extends Decision
+ {
+
+ /** . */
+ protected String location;
+
+ protected StateResponse createResponse()
+ {
+ return new HTTPRedirectionResponse(location);
+ }
+ }
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractActionContext.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractActionContext.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractActionContext.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -28,6 +28,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.common.util.ParameterMap;
import java.io.BufferedReader;
import java.io.IOException;
@@ -51,11 +52,14 @@
Mode mode,
WindowState windowState,
StateString navigationalState,
+ ParameterMap publicNavigationalState,
MarkupInfo markupInfo,
StateString interactionState,
PortletParameters form)
{
- super(mode, windowState, navigationalState, markupInfo);
+ super(mode, windowState, navigationalState, publicNavigationalState, markupInfo);
+
+ //
this.interactionState = interactionState;
this.form = form;
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractEventContext.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractEventContext.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractEventContext.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -28,6 +28,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.common.util.ParameterMap;
import javax.xml.namespace.QName;
import java.io.Serializable;
@@ -49,11 +50,12 @@
Mode mode,
WindowState windowState,
StateString navigationalState,
+ ParameterMap publicNavigationalState,
MarkupInfo markupInfo,
QName name,
Serializable payload)
{
- super(mode, windowState, navigationalState, markupInfo);
+ super(mode, windowState, navigationalState, publicNavigationalState, markupInfo);
//
this.name = name;
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractPortletInvocationContext.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -24,6 +24,7 @@
import org.jboss.portal.common.invocation.AbstractInvocationContext;
import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.Mode;
@@ -53,11 +54,20 @@
/** . */
protected StateString navigationalState;
- protected AbstractPortletInvocationContext(Mode mode, WindowState windowState, StateString navigationalState, MarkupInfo markupInfo)
+ /** . */
+ protected ParameterMap publicNavigationalState;
+
+ protected AbstractPortletInvocationContext(
+ Mode mode,
+ WindowState windowState,
+ StateString navigationalState,
+ ParameterMap publicNavigationalState,
+ MarkupInfo markupInfo)
{
this.mode = mode;
this.windowState = windowState;
this.navigationalState = navigationalState;
+ this.publicNavigationalState = publicNavigationalState;
this.markupInfo = markupInfo;
}
@@ -105,6 +115,11 @@
return windowState;
}
+ public ParameterMap getPublicNavigationalState()
+ {
+ return publicNavigationalState;
+ }
+
public StateString getNavigationalState()
{
return navigationalState;
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractRenderContext.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractRenderContext.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/spi/AbstractRenderContext.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -27,6 +27,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.common.util.ParameterMap;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -38,8 +39,9 @@
Mode mode,
WindowState windowState,
StateString navigationalState,
+ ParameterMap publicNavigationalState,
MarkupInfo markupInfo)
{
- super(mode, windowState, navigationalState, markupInfo);
+ super(mode, windowState, navigationalState, publicNavigationalState, markupInfo);
}
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/NavigationInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/NavigationInfo.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/NavigationInfo.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -31,6 +31,8 @@
public interface NavigationInfo
{
+ ParameterInfo getPublicParameter(String id);
+
Collection<? extends ParameterInfo> getPublicParameters();
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/ParameterInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/ParameterInfo.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/ParameterInfo.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -34,6 +34,8 @@
public interface ParameterInfo
{
+ String getId();
+
QName getName();
Collection<QName> getAliases();
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/StateResponse.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/StateResponse.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/StateResponse.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -38,7 +38,7 @@
/** . */
private List<Event> producedEvents = Collections.emptyList();
- public void addEvent(Event event)
+ public void queueEvent(Event event)
{
if (event == null)
{
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/UpdateNavigationalStateResponse.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/UpdateNavigationalStateResponse.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/response/UpdateNavigationalStateResponse.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -24,13 +24,12 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
+import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.portlet.StateString;
/**
- * Want to be rendered.
+ * Update the navigational state.
*
- * @todo rename to UpdateNavigationalStateResponse
- *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 5477 $
*/
@@ -38,7 +37,7 @@
{
/** The navigational state returned. */
- protected StateString state;
+ protected StateString navigationalState;
/** The new window state requested. */
protected WindowState windowState;
@@ -46,11 +45,15 @@
/** The new mode requested. */
protected Mode mode;
+ /** The update to the shared parameters. */
+ protected ParameterMap publicNavigationalState;
+
public UpdateNavigationalStateResponse()
{
- state = null;
+ navigationalState = null;
windowState = null;
mode = null;
+ publicNavigationalState = null;
}
public Mode getMode()
@@ -75,11 +78,21 @@
public StateString getNavigationalState()
{
- return state;
+ return navigationalState;
}
public void setNavigationalState(StateString state)
{
- this.state = state;
+ this.navigationalState = state;
}
+
+ public ParameterMap getPublicNavigationalState()
+ {
+ return publicNavigationalState;
+ }
+
+ public void setPublicNavigationalState(ParameterMap publicNavigationalState)
+ {
+ this.publicNavigationalState = publicNavigationalState;
+ }
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/PortletInvocationContext.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/PortletInvocationContext.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/spi/PortletInvocationContext.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -26,6 +26,7 @@
import org.jboss.portal.WindowState;
import org.jboss.portal.common.invocation.InvocationContext;
import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.portlet.PortletURL;
import org.jboss.portal.portlet.StateString;
@@ -44,6 +45,8 @@
*/
StateString getNavigationalState();
+ ParameterMap getPublicNavigationalState();
+
/**
* Returns the mode for this invocation.
*
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/NavigationInfoSupport.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/NavigationInfoSupport.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/NavigationInfoSupport.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -25,9 +25,9 @@
import org.jboss.portal.portlet.info.NavigationInfo;
import org.jboss.portal.portlet.info.ParameterInfo;
-import java.util.List;
-import java.util.ArrayList;
import java.util.Collection;
+import java.util.Map;
+import java.util.LinkedHashMap;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -37,20 +37,25 @@
{
/** . */
- private final List<ParameterInfoSupport> publicParameters;
+ private final Map<String, ParameterInfoSupport> publicParameters;
public NavigationInfoSupport()
{
- publicParameters = new ArrayList<ParameterInfoSupport>();
+ publicParameters = new LinkedHashMap<String, ParameterInfoSupport>();
}
public void addPublicParameter(ParameterInfoSupport parameter)
{
- publicParameters.add(parameter);
+ publicParameters.put(parameter.getId(), parameter);
}
+ public ParameterInfo getPublicParameter(String id)
+ {
+ return publicParameters.get(id);
+ }
+
public Collection<? extends ParameterInfo> getPublicParameters()
{
- return publicParameters;
+ return publicParameters.values();
}
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/ParameterInfoSupport.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/ParameterInfoSupport.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/ParameterInfoSupport.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -38,25 +38,28 @@
{
/** . */
- private QName name;
+ private final String id;
/** . */
+ private final QName name;
+
+ /** . */
private LocalizedString description;
/** . */
private List<QName> aliases;
- public ParameterInfoSupport(QName name)
+ public ParameterInfoSupport(String id, QName name)
{
+ this.id = id;
this.name = name;
this.aliases = new ArrayList<QName>();
this.description = new LocalizedString("Description of event " + name);
}
- public ParameterInfoSupport(QName name, String type)
+ public String getId()
{
- this.name = name;
- this.aliases = new ArrayList<QName>();
+ return id;
}
public QName getName()
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/spi/PortletInvocationContextSupport.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/spi/PortletInvocationContextSupport.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/spi/PortletInvocationContextSupport.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -26,6 +26,7 @@
import org.jboss.portal.WindowState;
import org.jboss.portal.common.invocation.AbstractInvocationContext;
import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.portlet.PortletURL;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.spi.PortletInvocationContext;
@@ -52,6 +53,11 @@
throw new UnsupportedOperationException();
}
+ public ParameterMap getPublicNavigationalState()
+ {
+ throw new UnsupportedOperationException();
+ }
+
public MarkupInfo getMarkupInfo()
{
throw new UnsupportedOperationException();
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalNavigationalState.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalNavigationalState.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalNavigationalState.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -25,6 +25,7 @@
import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.portlet.PortletParameters;
+import javax.xml.namespace.QName;
import java.util.Map;
import java.util.HashMap;
import java.util.zip.GZIPOutputStream;
@@ -47,21 +48,21 @@
private final Map<String, WindowNavigationalState> windows = new HashMap<String, WindowNavigationalState>();
/** . */
- private final PortletParameters sharedParameters = new PortletParameters();
+ private final Map<QName, String[]> page = new HashMap<QName, String[]>();
- public WindowNavigationalState getWindow(String windowId)
+ public WindowNavigationalState getWindowNavigationalState(String windowId)
{
return windows.get(windowId);
}
- public void setWindow(String windowId, WindowNavigationalState window)
+ public void setWindowNavigationalState(String windowId, WindowNavigationalState windowNS)
{
- windows.put(windowId, window);
+ windows.put(windowId, windowNS);
}
- public ParameterMap getSharedParameters()
+ public Map<QName, String[]> getPageNavigationalState()
{
- return sharedParameters;
+ return page;
}
public byte[] getBytes() throws IOException
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -29,6 +29,8 @@
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.info.EventInfo;
+import org.jboss.portal.portlet.info.ParameterInfo;
+import org.jboss.portal.portlet.info.NavigationInfo;
import org.jboss.portal.portlet.impl.spi.AbstractRequestContext;
import org.jboss.portal.portlet.impl.spi.AbstractUserContext;
import org.jboss.portal.portlet.impl.spi.AbstractWindowContext;
@@ -52,12 +54,14 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
import java.io.UnsupportedEncodingException;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.List;
import java.util.ArrayList;
import java.util.LinkedList;
+import java.util.Map;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -70,7 +74,7 @@
private MarkupInfo MARKUP_INFO = new MarkupInfo(MediaType.HTML, "UTF8");
/** . */
- private final boolean redirectAfterAction = true;
+ // private final boolean redirectAfterAction = true;
/** . */
private final Logger log;
@@ -80,6 +84,30 @@
log = Logger.getLogger(PortletController.class);
}
+ private ParameterMap getPublicNavigationalState(
+ PortletControllerContext context,
+ Portlet portlet)
+ {
+ PortletInfo portletInfo = portlet.getInfo();
+ PortalNavigationalState portalNS = context.getNavigationalState();
+ Map<QName, String[]> pm = portalNS.getPageNavigationalState();
+ ParameterMap publicNavigationalState = null;
+ for (ParameterInfo parameterInfo : portletInfo.getNavigation().getPublicParameters())
+ {
+ String[] parameterValue = pm.get(parameterInfo.getName());
+ if (parameterValue != null)
+ {
+ String parameterId = parameterInfo.getId();
+ if (publicNavigationalState == null)
+ {
+ publicNavigationalState = new ParameterMap();
+ publicNavigationalState.put(parameterId, parameterValue);
+ }
+ }
+ }
+ return publicNavigationalState;
+ }
+
private PortletInvocationResponse handle(PortletControllerContext context, Action action) throws PortletInvokerException, IOException
{
if (action instanceof PortletRender)
@@ -97,7 +125,7 @@
HttpServletResponse resp = context.getClientResponse();
PortalNavigationalState navState = context.getNavigationalState();
PortletURLRenderer renderer = new PortletURLRenderer(navState, portlet, req, resp);
- WindowNavigationalState windowNS = navState.getWindow(action.portletId);
+ WindowNavigationalState windowNS = navState.getWindowNavigationalState(action.portletId);
//
StateString portletNS = null;
@@ -129,12 +157,16 @@
}
//
+ ParameterMap publicNS = getPublicNavigationalState(context, portlet);
+
+ //
TestInstanceContext instanceContext = new TestInstanceContext(req, portlet.getContext(), true);
TestActionContext actionContext = new TestActionContext(
renderer,
mode,
windowState,
portletNS,
+ publicNS,
MARKUP_INFO,
PortletParametersStateString.create(action.queryParameters),
action.bodyParameters != null ? new PortletParameters(action.bodyParameters) : null);
@@ -170,7 +202,7 @@
HttpServletResponse resp = context.getClientResponse();
PortalNavigationalState navState = context.getNavigationalState();
PortletURLRenderer renderer = new PortletURLRenderer(navState, portlet, req, resp);
- WindowNavigationalState windowNS = navState.getWindow(portlet.getContext().getId());
+ WindowNavigationalState windowNS = navState.getWindowNavigationalState(portlet.getContext().getId());
//
if (windowNS == null)
@@ -179,12 +211,16 @@
}
//
+ ParameterMap publicNS = getPublicNavigationalState(context, portlet);
+
+ //
TestInstanceContext instanceContext = new TestInstanceContext(req, portlet.getContext(), true);
TestEventContext actionContext = new TestEventContext(
renderer,
windowNS.getMode(),
windowNS.getWindowState(),
windowNS.getPortletNavigationalState(),
+ publicNS,
MARKUP_INFO,
event.getName(),
event.getPayload());
@@ -373,7 +409,7 @@
StateString portletNS = null;
//
- WindowNavigationalState windowNS = navState.getWindow(portlet.getContext().getId());
+ WindowNavigationalState windowNS = navState.getWindowNavigationalState(portlet.getContext().getId());
if (windowNS != null)
{
if (windowNS.getMode() != null)
@@ -390,8 +426,12 @@
}
}
+ //
+ ParameterMap publicNS = getPublicNavigationalState(context, portlet);
+
+ //
TestInstanceContext instanceContext = new TestInstanceContext(req, portlet.getContext(), false);
- TestRenderContext renderContext = new TestRenderContext(renderer, mode, windowState, portletNS, MARKUP_INFO);
+ TestRenderContext renderContext = new TestRenderContext(renderer, mode, windowState, portletNS, publicNS, MARKUP_INFO);
//
RenderInvocation render = new RenderInvocation(renderContext);
@@ -435,7 +475,7 @@
PortalNavigationalState portalNS = context.getNavigationalState();
//
- WindowNavigationalState windowNS = portalNS.getWindow(portletId);
+ WindowNavigationalState windowNS = portalNS.getWindowNavigationalState(portletId);
//
if (windowNS == null)
@@ -460,10 +500,26 @@
portletNS = update.getNavigationalState();
}
windowNS = new WindowNavigationalState(portletNS, mode, windowState);
- portalNS.setWindow(portletId, windowNS);
+ portalNS.setWindowNavigationalState(portletId, windowNS);
- // Now update shared state
-// portlet.getInfo().get
+ // Now update shared state scoped at page
+ ParameterMap publicNS = update.getPublicNavigationalState();
+ if (publicNS != null)
+ {
+ NavigationInfo navigationInfo = portlet.getInfo().getNavigation();
+ for (Map.Entry<String, String[]> entry : publicNS.entrySet())
+ {
+ String id = entry.getKey();
+ ParameterInfo parameterInfo = navigationInfo.getPublicParameter(id);
+
+ //
+ if (parameterInfo != null)
+ {
+ QName name = parameterInfo.getName();
+ portalNS.getPageNavigationalState().put(name, entry.getValue());
+ }
+ }
+ }
}
static class Action
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestActionContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestActionContext.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestActionContext.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -30,6 +30,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.common.invocation.resolver.PrincipalAttributeResolver;
import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
@@ -46,9 +47,17 @@
/** . */
private final PortletURLRenderer urlRenderer;
- public TestActionContext(PortletURLRenderer urlRenderer, Mode mode, WindowState windowState, StateString navigationalState, MarkupInfo markupInfo, StateString interactionState, PortletParameters form)
+ public TestActionContext(
+ PortletURLRenderer urlRenderer,
+ Mode mode,
+ WindowState windowState,
+ StateString navigationalState,
+ ParameterMap publicNavigationalState,
+ MarkupInfo markupInfo,
+ StateString interactionState,
+ PortletParameters form)
{
- super(mode, windowState, navigationalState, markupInfo, interactionState, form);
+ super(mode, windowState, navigationalState, publicNavigationalState, markupInfo, interactionState, form);
//
this.urlRenderer = urlRenderer;
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestEventContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestEventContext.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestEventContext.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -30,6 +30,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.common.invocation.resolver.PrincipalAttributeResolver;
import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
@@ -53,11 +54,12 @@
Mode mode,
WindowState windowState,
StateString navigationalState,
+ ParameterMap publicNavigationalState,
MarkupInfo markupInfo,
QName name,
Serializable payload)
{
- super(mode, windowState, navigationalState, markupInfo, name, payload);
+ super(mode, windowState, navigationalState, publicNavigationalState, markupInfo, name, payload);
//
this.urlRenderer = urlRenderer;
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestRenderContext.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestRenderContext.java 2008-01-15 21:14:33 UTC (rev 9516)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/TestRenderContext.java 2008-01-15 22:45:05 UTC (rev 9517)
@@ -29,6 +29,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.common.invocation.resolver.PrincipalAttributeResolver;
import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
@@ -45,9 +46,15 @@
/** . */
private final PortletURLRenderer urlRenderer;
- public TestRenderContext(PortletURLRenderer urlRenderer, Mode mode, WindowState windowState, StateString navigationalState, MarkupInfo markupInfo)
+ public TestRenderContext(
+ PortletURLRenderer urlRenderer,
+ Mode mode,
+ WindowState windowState,
+ StateString navigationalState,
+ ParameterMap publicNavigationalState,
+ MarkupInfo markupInfo)
{
- super(mode, windowState, navigationalState, markupInfo);
+ super(mode, windowState, navigationalState, publicNavigationalState, markupInfo);
//
this.urlRenderer = urlRenderer;
18 years, 3 months
JBoss Portal SVN: r9516 - in branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal: test/core/model/portal and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-01-15 16:14:33 -0500 (Tue, 15 Jan 2008)
New Revision: 9516
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java
Log:
[JBPORTAL-1840] Workaround to database that are not case sensitive by default.
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java 2008-01-15 19:07:36 UTC (rev 9515)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java 2008-01-15 21:14:33 UTC (rev 9516)
@@ -244,8 +244,9 @@
}
/**
+ * @throws DuplicatePortalObjectException
*/
- public void createChild(ObjectNode node)
+ public void createChild(ObjectNode node) throws DuplicatePortalObjectException
{
}
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java 2008-01-15 19:07:36 UTC (rev 9515)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java 2008-01-15 21:14:33 UTC (rev 9516)
@@ -26,6 +26,7 @@
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
+import org.hibernate.exception.ConstraintViolationException;
import org.jboss.logging.Logger;
import org.jboss.portal.core.model.portal.DuplicatePortalObjectException;
import org.jboss.portal.core.model.portal.PortalObjectId;
@@ -92,12 +93,21 @@
session.flush();
}
- public void createChild(ObjectNode node)
+ public void createChild(ObjectNode node) throws DuplicatePortalObjectException
{
Session session = sessionFactory.getCurrentSession();
- session.save(node);
- session.save(node.getObject());
- session.flush();
+ try
+ {
+ session.save(node);
+ session.save(node.getObject());
+ session.flush();
+ }
+ catch (ConstraintViolationException e)
+ {
+ log.warn("The configured database is probably case-insensitive. " + e.getMessage());
+ session.close();
+ throw new DuplicatePortalObjectException();
+ }
}
public void updated(ObjectNode node)
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java 2008-01-15 19:07:36 UTC (rev 9515)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java 2008-01-15 21:14:33 UTC (rev 9516)
@@ -119,11 +119,11 @@
TransactionAssert.beginTransaction();
PortalContainer ctx = container.getContext();
Portal n1 = ctx.createPortal("default");
- Page n2 = n1.createPage("default");
+ n1.createPage("default");
boolean duplicate = false;
try
{
- Page n3 = n1.createPage("default");
+ n1.createPage("default");
}
catch (DuplicatePortalObjectException e)
{
@@ -136,22 +136,31 @@
public void testRegisterObjectWithSameNameCaseInsensitive() throws Exception
{
+ // Some database will create 2 pages, while some other will consider
+ // both names as equal.
TransactionAssert.beginTransaction();
PortalContainer ctx = container.getContext();
Portal n1 = ctx.createPortal("default");
- Page n2 = n1.createPage("default");
- boolean duplicate = true;
+ n1.createPage("default");
+
+ TransactionAssert.commitTransaction();
+
+ boolean rollback = false;
+
+ TransactionAssert.beginTransaction();
try
{
- Page n3 = n1.createPage("dEfAuLt");
+ n1.createPage("dEfAuLt");
}
catch (DuplicatePortalObjectException e)
{
- duplicate = false;
+ rollback = true;
+ TransactionAssert.rollbackTransaction(false);
}
- assertTrue(duplicate);
-
- TransactionAssert.commitTransaction();
+ if (!rollback)
+ {
+ TransactionAssert.commitTransaction();
+ }
}
public void testPropertyUpdateDoesNotCascadeToDescendantsWhenTheyDeclareIt() throws Exception
18 years, 3 months
JBoss Portal SVN: r9515 - in modules/portlet/trunk: portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api and 4 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-15 14:07:36 -0500 (Tue, 15 Jan 2008)
New Revision: 9515
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/PortletInfoSupport.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java
modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfig-war/WEB-INF/portlet.xml
Log:
update public render parameter test case to pass with new public parameter meta data
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-01-15 18:19:23 UTC (rev 9514)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-01-15 19:07:36 UTC (rev 9515)
@@ -402,12 +402,6 @@
}
//
- for (String renderParameter : portletMD.getSupportedPublicRenderParameters())
- {
- containerPortletInfo.addRenderParameter(renderParameter);
- }
-
- //
return containerPortletInfo;
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java 2008-01-15 18:19:23 UTC (rev 9514)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java 2008-01-15 19:07:36 UTC (rev 9515)
@@ -28,7 +28,6 @@
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
-import java.util.LinkedHashSet;
/**
* For now implementation that use the portlet container directly.
@@ -71,9 +70,6 @@
private final Map<String, String> initParameters;
/** . */
- private final Set<String> renderParameterNames;
-
- /** . */
private final Boolean remotable;
/** . */
@@ -105,7 +101,6 @@
this.name = name;
this.className = className;
this.initParameters = new HashMap<String, String>();
- this.renderParameterNames = new LinkedHashSet<String>();
this.remotable = remotable;
this.bundleManager = bundleManager;
}
@@ -135,7 +130,6 @@
this.name = name;
this.className = className;
this.initParameters = new HashMap<String, String>();
- this.renderParameterNames = new LinkedHashSet<String>();
this.remotable = remotable;
this.bundleManager = bundleManager;
}
@@ -170,16 +164,6 @@
return initParameters.get(name);
}
- public void addRenderParameter(String parameterName)
- {
- renderParameterNames.add(parameterName);
- }
-
- public Set<String> getRenderParameterNames()
- {
- return renderParameterNames;
- }
-
public ContainerCapabilitiesInfo getCapabilities()
{
return capabilities;
@@ -215,7 +199,7 @@
return remotable;
}
- public ContainerEventingInfo getEvents()
+ public ContainerEventingInfo getEventing()
{
return events;
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java 2008-01-15 18:19:23 UTC (rev 9514)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java 2008-01-15 19:07:36 UTC (rev 9515)
@@ -23,9 +23,9 @@
package org.jboss.portal.portlet.impl.jsr168.api;
import org.jboss.portal.common.i18n.ResourceBundleManager;
-import org.jboss.portal.common.NotYetImplemented;
import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
import org.jboss.portal.portlet.impl.info.ContainerPortletApplicationInfo;
+import org.jboss.portal.portlet.impl.info.ContainerParameterInfo;
import org.jboss.portal.portlet.info.EventInfo;
import javax.portlet.PortletConfig;
@@ -64,6 +64,9 @@
/** . */
private List<QName> processingEventQNames;
+ /** . */
+ private List<String> publicRenderParameterNames;
+
public PortletConfigImpl(
ContainerPortletInfo portletInfo,
ContainerPortletApplicationInfo portletApplicationInfo,
@@ -71,7 +74,7 @@
ResourceBundleManager bundleMgr)
{
List<QName> publishingEventQNames = new ArrayList<QName>();
- for (EventInfo event : portletInfo.getEvents().getProducedEvents())
+ for (EventInfo event : portletInfo.getEventing().getProducedEvents())
{
QName eventName = event.getName();
publishingEventQNames.add(eventName);
@@ -79,19 +82,27 @@
//
List<QName> processingEventQNames = new ArrayList<QName>();
- for (EventInfo event : portletInfo.getEvents().getConsumedEvents())
+ for (EventInfo event : portletInfo.getEventing().getConsumedEvents())
{
QName eventName = event.getName();
processingEventQNames.add(eventName);
}
//
+ List<String> publicRenderParameterNames = new ArrayList<String>();
+ for (ContainerParameterInfo parameterInfo : portletInfo.getNavigation().getPublicParameters())
+ {
+ publicRenderParameterNames.add(parameterInfo.getId());
+ }
+
+ //
this.portletInfo = portletInfo;
this.portletApplicationInfo = portletApplicationInfo;
this.portletContext = portletContext;
this.bundleMgr = bundleMgr;
this.publishingEventQNames = publishingEventQNames;
this.processingEventQNames = processingEventQNames;
+ this.publicRenderParameterNames = publicRenderParameterNames;
}
public String getPortletName()
@@ -126,7 +137,7 @@
public Enumeration<String> getPublicRenderParameterNames()
{
- return Collections.enumeration(portletInfo.getRenderParameterNames());
+ return Collections.enumeration(publicRenderParameterNames);
}
public String getDefaultNamespace()
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java 2008-01-15 18:19:23 UTC (rev 9514)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java 2008-01-15 19:07:36 UTC (rev 9515)
@@ -287,7 +287,7 @@
}
//
- ContainerEventingInfo eventsInfo = preq.container.getInfo().getEvents();
+ ContainerEventingInfo eventsInfo = preq.container.getInfo().getEventing();
// Check type
for (ContainerEventInfo eventInfo : eventsInfo.getProducedEvents())
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java 2008-01-15 18:19:23 UTC (rev 9514)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java 2008-01-15 19:07:36 UTC (rev 9515)
@@ -86,7 +86,7 @@
*/
Boolean isRemotable();
- EventingInfo getEvents();
+ EventingInfo getEventing();
NavigationInfo getNavigation();
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/PortletInfoSupport.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/PortletInfoSupport.java 2008-01-15 18:19:23 UTC (rev 9514)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/PortletInfoSupport.java 2008-01-15 19:07:36 UTC (rev 9515)
@@ -81,7 +81,7 @@
this.remotable = remotable;
}
- public EventingInfoSupport getEvents()
+ public EventingInfoSupport getEventing()
{
return eventsSupport;
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java 2008-01-15 18:19:23 UTC (rev 9514)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java 2008-01-15 19:07:36 UTC (rev 9515)
@@ -265,7 +265,7 @@
PortletInfo portletInfo = portlet.getInfo();
//
- for (EventInfo eventInfo : portletInfo.getEvents().getConsumedEvents())
+ for (EventInfo eventInfo : portletInfo.getEventing().getConsumedEvents())
{
if (event.getName().equals(eventInfo.getName()))
{
Modified: modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfig-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfig-war/WEB-INF/portlet.xml 2008-01-15 18:19:23 UTC (rev 9514)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/portletconfig-war/WEB-INF/portlet.xml 2008-01-15 19:07:36 UTC (rev 9515)
@@ -202,4 +202,14 @@
<qname xmlns:a="urn:default-namespace">a:event6</qname>
</event-definition>
+ <public-render-parameter>
+ <identifier>render_param1</identifier>
+ <name>render_param_name</name>
+ </public-render-parameter>
+
+ <public-render-parameter>
+ <identifier>render_param2</identifier>
+ <name>render_param_name2</name>
+ </public-render-parameter>
+
</portlet-app>
18 years, 3 months
JBoss Portal SVN: r9514 - in modules/portlet/trunk: portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-15 13:19:23 -0500 (Tue, 15 Jan 2008)
New Revision: 9514
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerEventingInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerNavigationInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerParameterInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/EventingInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/NavigationInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/ParameterInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/EventingInfoSupport.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/NavigationInfoSupport.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/ParameterInfoSupport.java
Removed:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerEventsInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/EventsInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/EventsInfoSupport.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/PortletInfoSupport.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java
Log:
- added runtime metadata support for public render parameter
- renamed EventsInfo to EventingInfo
Copied: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerEventingInfo.java (from rev 9505, modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerEventsInfo.java)
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerEventingInfo.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerEventingInfo.java 2008-01-15 18:19:23 UTC (rev 9514)
@@ -0,0 +1,69 @@
+/******************************************************************************
+ * 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. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.info;
+
+import org.jboss.portal.portlet.info.EventingInfo;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ContainerEventingInfo implements EventingInfo
+{
+
+ /** . */
+ private final List<ContainerEventInfo> producedEvents;
+
+ /** . */
+ private final List<ContainerEventInfo> consumedEvents;
+
+ public ContainerEventingInfo()
+ {
+ producedEvents = new ArrayList<ContainerEventInfo>();
+ consumedEvents = new ArrayList<ContainerEventInfo>();
+ }
+
+ public void addProducedEvent(ContainerEventInfo producedEvent)
+ {
+ producedEvents.add(producedEvent);
+ }
+
+ public void addConsumedEvent(ContainerEventInfo consumedEvent)
+ {
+ consumedEvents.add(consumedEvent);
+ }
+
+ public Collection<ContainerEventInfo> getProducedEvents()
+ {
+ return producedEvents;
+ }
+
+ public Collection<ContainerEventInfo> getConsumedEvents()
+ {
+ return consumedEvents;
+ }
+}
Deleted: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerEventsInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerEventsInfo.java 2008-01-15 16:16:29 UTC (rev 9513)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerEventsInfo.java 2008-01-15 18:19:23 UTC (rev 9514)
@@ -1,69 +0,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. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.info;
-
-import org.jboss.portal.portlet.info.EventsInfo;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Collection;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class ContainerEventsInfo implements EventsInfo
-{
-
- /** . */
- private final List<ContainerEventInfo> producedEvents;
-
- /** . */
- private final List<ContainerEventInfo> consumedEvents;
-
- public ContainerEventsInfo()
- {
- producedEvents = new ArrayList<ContainerEventInfo>();
- consumedEvents = new ArrayList<ContainerEventInfo>();
- }
-
- public void addProducedEvent(ContainerEventInfo producedEvent)
- {
- producedEvents.add(producedEvent);
- }
-
- public void addConsumedEvent(ContainerEventInfo consumedEvent)
- {
- consumedEvents.add(consumedEvent);
- }
-
- public Collection<ContainerEventInfo> getProducedEvents()
- {
- return producedEvents;
- }
-
- public Collection<ContainerEventInfo> getConsumedEvents()
- {
- return consumedEvents;
- }
-}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-01-15 16:16:29 UTC (rev 9513)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-01-15 18:19:23 UTC (rev 9514)
@@ -37,6 +37,7 @@
import org.jboss.portal.portlet.impl.metadata.event.EventDefinitionMetaData;
import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
import org.jboss.portal.portlet.impl.metadata.PortletApplication20MetaData;
+import org.jboss.portal.portlet.impl.metadata.PublicRenderParameterMetaData;
import org.jboss.portal.portlet.info.MetaInfo;
import org.jboss.portal.common.util.ConversionException;
import org.jboss.portal.common.value.Value;
@@ -88,6 +89,9 @@
private final Map<QName, ContainerEventInfo> events;
/** . */
+ private final Map<String, ContainerParameterInfo> publicParameters;
+
+ /** . */
private ContainerPortletApplicationInfo portletApplication;
/** . */
@@ -102,7 +106,8 @@
{
this.portletApplicationMD = portletApplicationMD;
this.context = context;
- this.events = new HashMap<QName, ContainerEventInfo>();
+ this.events = new LinkedHashMap<QName, ContainerEventInfo>();
+ this.publicParameters = new LinkedHashMap<String, ContainerParameterInfo>();
this.portlets = new LinkedHashMap<String, ContainerPortletInfo>();
}
@@ -125,6 +130,10 @@
{
tmp.setEvents(new ArrayList<EventDefinitionMetaData>());
}
+ if (tmp.getPublicRenderParameters() == null)
+ {
+ tmp.setPublicRenderParameters(new ArrayList<PublicRenderParameterMetaData>());
+ }
if (tmp.getDefaultNamespace() == null)
{
try
@@ -274,12 +283,40 @@
log.error("Cannot load event class " + e.getClassName(), e);
}
}
+
+ //
+ for (PublicRenderParameterMetaData parameterMD : tmp.getPublicRenderParameters())
+ {
+ ContainerParameterInfo parameter = build(parameterMD);
+
+ //
+ publicParameters.put(parameter.getId(), parameter);
+ }
}
//
return new ContainerPortletApplicationInfo(defaultNamespace);
}
+ private ContainerParameterInfo build(PublicRenderParameterMetaData parameterMD)
+ {
+ QName name = getName(parameterMD.getQname(), parameterMD.getName());
+ ResourceBundleManager bundleMgr = context.getBundleManager();
+
+ //
+ LocalizedString description = bundleMgr.getLocalizedValue(
+ "javax.portlet.app.public-render-parameter." + name + ".description",
+ "Description of public render parameter " + name);
+
+ //
+ return new ContainerParameterInfo(
+ parameterMD.getIdentifier(),
+ name,
+ parameterMD.getAlias(),
+ description
+ );
+ }
+
private ContainerEventInfo build(EventDefinitionMetaData eventDefinitionMD) throws NoSuchClassException
{
QName name = getName(eventDefinitionMD.getQname(), eventDefinitionMD.getName());
@@ -296,8 +333,12 @@
//
- LocalizedString displayName = bundleMgr.getLocalizedValue("javax.portlet.app.event-definition.." + name + ".display-name", "Event " + name);
- LocalizedString description = bundleMgr.getLocalizedValue("javax.portlet.app.event-definition." + name + ".description", "Description of event " + name);
+ LocalizedString displayName = bundleMgr.getLocalizedValue(
+ "javax.portlet.app.event-definition.." + name + ".display-name",
+ "Event " + name);
+ LocalizedString description = bundleMgr.getLocalizedValue(
+ "javax.portlet.app.event-definition." + name + ".description",
+ "Description of event " + name);
//
return new ContainerEventInfo(name, type, displayName, description);
@@ -319,7 +360,8 @@
ContainerPortletInfo containerPortletInfo;
if (portletApplicationMD instanceof PortletApplication20MetaData)
{
- ContainerEventsInfo containerEvents = buildContainerEventsInfo(portletMD);
+ ContainerEventingInfo containerEvents = buildContainerEventsInfo(portletMD);
+ ContainerNavigationInfo containerNavigation = buildContainerNavigationInfo(portletMD);
//
containerPortletInfo = new ContainerPortletInfo(
@@ -329,7 +371,8 @@
containerSecurity,
containerCache,
containerSession,
- containerEvents,
+ containerEvents,
+ containerNavigation,
portletMD.getPortletName(),
portletMD.getPortletClass(),
false,
@@ -368,11 +411,35 @@
return containerPortletInfo;
}
- private ContainerEventsInfo buildContainerEventsInfo(PortletMetaData portletMD)
+ private ContainerNavigationInfo buildContainerNavigationInfo(PortletMetaData portletMD)
{
- ContainerEventsInfo portletEvents = new ContainerEventsInfo();
+ ContainerNavigationInfo navigation = new ContainerNavigationInfo();
//
+ for (String parameterId : portletMD.getSupportedPublicRenderParameters())
+ {
+ ContainerParameterInfo parameter = publicParameters.get(parameterId);
+
+ //
+ if (parameter == null)
+ {
+ // Do something
+ }
+ else
+ {
+ navigation.addPublicParameter(parameter);
+ }
+ }
+
+ //
+ return navigation;
+ }
+
+ private ContainerEventingInfo buildContainerEventsInfo(PortletMetaData portletMD)
+ {
+ ContainerEventingInfo portletEvents = new ContainerEventingInfo();
+
+ //
for (EventDefinitionReferenceMetaData eventDefinitionReferenceMD : portletMD.getSupportedProcessingEvent())
{
QName name = getName(eventDefinitionReferenceMD.getQname(), eventDefinitionReferenceMD.getName());
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerNavigationInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerNavigationInfo.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerNavigationInfo.java 2008-01-15 18:19:23 UTC (rev 9514)
@@ -0,0 +1,60 @@
+/******************************************************************************
+ * 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. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.info;
+
+import org.jboss.portal.portlet.info.NavigationInfo;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ContainerNavigationInfo implements NavigationInfo
+{
+
+ /** . */
+ private Map<String, ContainerParameterInfo> publicParameters;
+
+ public ContainerNavigationInfo()
+ {
+ this.publicParameters = new HashMap<String, ContainerParameterInfo>();
+ }
+
+ public void addPublicParameter(ContainerParameterInfo publicParameter)
+ {
+ publicParameters.put(publicParameter.getId(), publicParameter);
+ }
+
+ public ContainerParameterInfo getPublicParameter(String id)
+ {
+ return publicParameters.get(id);
+ }
+
+ public Collection<ContainerParameterInfo> getPublicParameters()
+ {
+ return publicParameters.values();
+ }
+}
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerParameterInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerParameterInfo.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerParameterInfo.java 2008-01-15 18:19:23 UTC (rev 9514)
@@ -0,0 +1,78 @@
+/******************************************************************************
+ * 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. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.info;
+
+import org.jboss.portal.portlet.info.ParameterInfo;
+import org.jboss.portal.common.i18n.LocalizedString;
+
+import javax.xml.namespace.QName;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ContainerParameterInfo implements ParameterInfo
+{
+
+ /** The id used by the portlet to reference. */
+ private final String id;
+
+ /** . */
+ private final QName name;
+
+ /** . */
+ private final List<QName> aliases;
+
+ /** . */
+ private final LocalizedString description;
+
+ public ContainerParameterInfo(String id, QName name, List<QName> aliases, LocalizedString description)
+ {
+ this.id = id;
+ this.name = name;
+ this.aliases = aliases;
+ this.description = description;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public QName getName()
+ {
+ return name;
+ }
+
+ public Collection<QName> getAliases()
+ {
+ return aliases;
+ }
+
+ public LocalizedString getDescription()
+ {
+ return description;
+ }
+}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java 2008-01-15 16:16:29 UTC (rev 9513)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java 2008-01-15 18:19:23 UTC (rev 9514)
@@ -59,7 +59,7 @@
private final ContainerSessionInfo session;
/** . */
- private final ContainerEventsInfo events;
+ private final ContainerEventingInfo events;
/** . */
private final String name;
@@ -79,6 +79,9 @@
/** . */
private final ResourceBundleManager bundleManager;
+ /** . */
+ private final ContainerNavigationInfo navigation;
+
public ContainerPortletInfo(
ContainerCapabilitiesInfo capabilities,
ContainerPreferencesInfo preferences,
@@ -97,7 +100,8 @@
this.security = security;
this.cache = cache;
this.session = session;
- this.events = new ContainerEventsInfo();
+ this.events = new ContainerEventingInfo();
+ this.navigation = new ContainerNavigationInfo();
this.name = name;
this.className = className;
this.initParameters = new HashMap<String, String>();
@@ -113,7 +117,8 @@
ContainerSecurityInfo security,
ContainerCacheInfo cache,
ContainerSessionInfo session,
- ContainerEventsInfo events,
+ ContainerEventingInfo events,
+ ContainerNavigationInfo navigation,
String name,
String className,
Boolean remotable,
@@ -126,6 +131,7 @@
this.cache = cache;
this.session = session;
this.events = events;
+ this.navigation = navigation;
this.name = name;
this.className = className;
this.initParameters = new HashMap<String, String>();
@@ -209,8 +215,13 @@
return remotable;
}
- public ContainerEventsInfo getEvents()
+ public ContainerEventingInfo getEvents()
{
return events;
}
+
+ public ContainerNavigationInfo getNavigation()
+ {
+ return navigation;
+ }
}
\ No newline at end of file
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java 2008-01-15 16:16:29 UTC (rev 9513)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/StateAwareResponseImpl.java 2008-01-15 18:19:23 UTC (rev 9514)
@@ -29,7 +29,7 @@
import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
-import org.jboss.portal.portlet.impl.info.ContainerEventsInfo;
+import org.jboss.portal.portlet.impl.info.ContainerEventingInfo;
import org.jboss.portal.portlet.impl.info.ContainerPortletApplicationInfo;
import org.jboss.portal.portlet.impl.info.ContainerTypeInfo;
import org.jboss.portal.portlet.impl.info.ContainerEventInfo;
@@ -287,7 +287,7 @@
}
//
- ContainerEventsInfo eventsInfo = preq.container.getInfo().getEvents();
+ ContainerEventingInfo eventsInfo = preq.container.getInfo().getEvents();
// Check type
for (ContainerEventInfo eventInfo : eventsInfo.getProducedEvents())
Copied: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/EventingInfo.java (from rev 9505, modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/EventsInfo.java)
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/EventingInfo.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/EventingInfo.java 2008-01-15 18:19:23 UTC (rev 9514)
@@ -0,0 +1,38 @@
+/******************************************************************************
+ * 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. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.info;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface EventingInfo
+{
+
+ Collection<? extends EventInfo> getProducedEvents();
+
+ Collection<? extends EventInfo> getConsumedEvents();
+
+}
Deleted: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/EventsInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/EventsInfo.java 2008-01-15 16:16:29 UTC (rev 9513)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/EventsInfo.java 2008-01-15 18:19:23 UTC (rev 9514)
@@ -1,38 +0,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. *
- ******************************************************************************/
-package org.jboss.portal.portlet.info;
-
-import java.util.Collection;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public interface EventsInfo
-{
-
- Collection<? extends EventInfo> getProducedEvents();
-
- Collection<? extends EventInfo> getConsumedEvents();
-
-}
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/NavigationInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/NavigationInfo.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/NavigationInfo.java 2008-01-15 18:19:23 UTC (rev 9514)
@@ -0,0 +1,36 @@
+/******************************************************************************
+ * 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. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.info;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface NavigationInfo
+{
+
+ Collection<? extends ParameterInfo> getPublicParameters();
+
+}
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/ParameterInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/ParameterInfo.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/ParameterInfo.java 2008-01-15 18:19:23 UTC (rev 9514)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * 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. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.info;
+
+import org.jboss.portal.common.i18n.LocalizedString;
+
+import javax.xml.namespace.QName;
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface ParameterInfo
+{
+
+ QName getName();
+
+ Collection<QName> getAliases();
+
+ LocalizedString getDescription();
+
+}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java 2008-01-15 16:16:29 UTC (rev 9513)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java 2008-01-15 18:19:23 UTC (rev 9514)
@@ -86,5 +86,7 @@
*/
Boolean isRemotable();
- EventsInfo getEvents();
+ EventingInfo getEvents();
+
+ NavigationInfo getNavigation();
}
Copied: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/EventingInfoSupport.java (from rev 9505, modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/EventsInfoSupport.java)
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/EventingInfoSupport.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/EventingInfoSupport.java 2008-01-15 18:19:23 UTC (rev 9514)
@@ -0,0 +1,70 @@
+/******************************************************************************
+ * 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. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.portlet.info.EventingInfo;
+import org.jboss.portal.portlet.info.EventInfo;
+
+import java.util.Collection;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class EventingInfoSupport implements EventingInfo
+{
+
+ /** . */
+ private List<EventInfoSupport> producedEvents;
+
+ /** . */
+ private List<EventInfoSupport> consumedEvents;
+
+ public EventingInfoSupport()
+ {
+ producedEvents = new ArrayList<EventInfoSupport>();
+ consumedEvents = new ArrayList<EventInfoSupport>();
+ }
+
+ public void addProducedEvent(EventInfoSupport event)
+ {
+ producedEvents.add(event);
+ }
+
+ public void addConsumedEvent(EventInfoSupport event)
+ {
+ producedEvents.add(event);
+ }
+
+ public Collection<? extends EventInfo> getProducedEvents()
+ {
+ return producedEvents;
+ }
+
+ public Collection<? extends EventInfo> getConsumedEvents()
+ {
+ return consumedEvents;
+ }
+}
Deleted: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/EventsInfoSupport.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/EventsInfoSupport.java 2008-01-15 16:16:29 UTC (rev 9513)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/EventsInfoSupport.java 2008-01-15 18:19:23 UTC (rev 9514)
@@ -1,70 +0,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. *
- ******************************************************************************/
-package org.jboss.portal.portlet.support.info;
-
-import org.jboss.portal.portlet.info.EventsInfo;
-import org.jboss.portal.portlet.info.EventInfo;
-
-import java.util.Collection;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class EventsInfoSupport implements EventsInfo
-{
-
- /** . */
- private List<EventInfoSupport> producedEvents;
-
- /** . */
- private List<EventInfoSupport> consumedEvents;
-
- public EventsInfoSupport()
- {
- producedEvents = new ArrayList<EventInfoSupport>();
- consumedEvents = new ArrayList<EventInfoSupport>();
- }
-
- public void addProducedEvent(EventInfoSupport event)
- {
- producedEvents.add(event);
- }
-
- public void addConsumedEvent(EventInfoSupport event)
- {
- producedEvents.add(event);
- }
-
- public Collection<? extends EventInfo> getProducedEvents()
- {
- return producedEvents;
- }
-
- public Collection<? extends EventInfo> getConsumedEvents()
- {
- return consumedEvents;
- }
-}
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/NavigationInfoSupport.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/NavigationInfoSupport.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/NavigationInfoSupport.java 2008-01-15 18:19:23 UTC (rev 9514)
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * 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. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.portlet.info.NavigationInfo;
+import org.jboss.portal.portlet.info.ParameterInfo;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class NavigationInfoSupport implements NavigationInfo
+{
+
+ /** . */
+ private final List<ParameterInfoSupport> publicParameters;
+
+ public NavigationInfoSupport()
+ {
+ publicParameters = new ArrayList<ParameterInfoSupport>();
+ }
+
+ public void addPublicParameter(ParameterInfoSupport parameter)
+ {
+ publicParameters.add(parameter);
+ }
+
+ public Collection<? extends ParameterInfo> getPublicParameters()
+ {
+ return publicParameters;
+ }
+}
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/ParameterInfoSupport.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/ParameterInfoSupport.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/ParameterInfoSupport.java 2008-01-15 18:19:23 UTC (rev 9514)
@@ -0,0 +1,86 @@
+/******************************************************************************
+ * 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. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.portlet.info.ParameterInfo;
+import org.jboss.portal.common.i18n.LocalizedString;
+
+import javax.xml.namespace.QName;
+import java.util.Collection;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ParameterInfoSupport implements ParameterInfo
+{
+
+ /** . */
+ private QName name;
+
+ /** . */
+ private LocalizedString description;
+
+ /** . */
+ private List<QName> aliases;
+
+ public ParameterInfoSupport(QName name)
+ {
+ this.name = name;
+ this.aliases = new ArrayList<QName>();
+ this.description = new LocalizedString("Description of event " + name);
+ }
+
+ public ParameterInfoSupport(QName name, String type)
+ {
+ this.name = name;
+ this.aliases = new ArrayList<QName>();
+ }
+
+ public QName getName()
+ {
+ return name;
+ }
+
+ public LocalizedString getDescription()
+ {
+ return description;
+ }
+
+ public Collection<QName> getAliases()
+ {
+ return aliases;
+ }
+
+ public void setDescription(LocalizedString description)
+ {
+ this.description = description;
+ }
+
+ public void addAlias(QName alias)
+ {
+ aliases.add(alias);
+ }
+}
\ No newline at end of file
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/PortletInfoSupport.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/PortletInfoSupport.java 2008-01-15 16:16:29 UTC (rev 9513)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/PortletInfoSupport.java 2008-01-15 18:19:23 UTC (rev 9514)
@@ -22,14 +22,8 @@
******************************************************************************/
package org.jboss.portal.portlet.support.info;
-import org.jboss.portal.portlet.info.CacheInfo;
import org.jboss.portal.portlet.info.CapabilitiesInfo;
-import org.jboss.portal.portlet.info.MetaInfo;
import org.jboss.portal.portlet.info.PortletInfo;
-import org.jboss.portal.portlet.info.PreferencesInfo;
-import org.jboss.portal.portlet.info.SecurityInfo;
-import org.jboss.portal.portlet.info.SessionInfo;
-import org.jboss.portal.portlet.info.EventsInfo;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -44,7 +38,8 @@
private CacheInfoSupport cacheSupport = new CacheInfoSupport();
private SessionInfoSupport sessionSupport = new SessionInfoSupport();
private MetaInfoSupport metaSupport = new MetaInfoSupport();
- private EventsInfoSupport eventsSupports = new EventsInfoSupport();
+ private EventingInfoSupport eventsSupport = new EventingInfoSupport();
+ private NavigationInfoSupport navigationSupport = new NavigationInfoSupport();
public CapabilitiesInfo getCapabilities()
{
@@ -86,8 +81,13 @@
this.remotable = remotable;
}
- public EventsInfoSupport getEvents()
+ public EventingInfoSupport getEvents()
{
- return eventsSupports;
+ return eventsSupport;
}
+
+ public NavigationInfoSupport getNavigation()
+ {
+ return navigationSupport;
+ }
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java 2008-01-15 16:16:29 UTC (rev 9513)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java 2008-01-15 18:19:23 UTC (rev 9514)
@@ -246,7 +246,7 @@
// Update portlet NS
if (response instanceof UpdateNavigationalStateResponse)
{
- updateNavigationalState(navState, action.portletId, (UpdateNavigationalStateResponse)response);
+ updateNavigationalState(context, action.portletId, (UpdateNavigationalStateResponse)response);
}
// Create event list and feed it with the events that may have been produced
@@ -285,7 +285,7 @@
UpdateNavigationalStateResponse update = (UpdateNavigationalStateResponse)eventResponse;
// Update ns
- updateNavigationalState(navState, consumer.getContext().getId(), update);
+ updateNavigationalState(context, consumer.getContext().getId(), update);
// Add events if any
queue.addAll(update.getEvents());
@@ -427,13 +427,17 @@
}
private void updateNavigationalState(
- PortalNavigationalState portalNS,
- String windowId,
- UpdateNavigationalStateResponse update)
+ PortletControllerContext context,
+ String portletId,
+ UpdateNavigationalStateResponse update) throws PortletInvokerException
{
- WindowNavigationalState windowNS = portalNS.getWindow(windowId);
+ Portlet portlet = context.getPortlet(portletId);
+ PortalNavigationalState portalNS = context.getNavigationalState();
//
+ WindowNavigationalState windowNS = portalNS.getWindow(portletId);
+
+ //
if (windowNS == null)
{
windowNS = new WindowNavigationalState();
@@ -456,7 +460,10 @@
portletNS = update.getNavigationalState();
}
windowNS = new WindowNavigationalState(portletNS, mode, windowState);
- portalNS.setWindow(windowId, windowNS);
+ portalNS.setWindow(portletId, windowNS);
+
+ // Now update shared state
+// portlet.getInfo().get
}
static class Action
18 years, 3 months
JBoss Portal SVN: r9513 - in modules/portlet/trunk/test/src: test/resources/portlet-test-war/WEB-INF and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-01-15 11:16:29 -0500 (Tue, 15 Jan 2008)
New Revision: 9513
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationDeployer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContextImpl.java
modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml
Log:
- Minor code improvements and generification.
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationDeployer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationDeployer.java 2008-01-15 14:39:35 UTC (rev 9512)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationDeployer.java 2008-01-15 16:16:29 UTC (rev 9513)
@@ -22,38 +22,38 @@
******************************************************************************/
package org.jboss.portal.portlet.test;
-import org.jboss.portal.web.WebAppListener;
-import org.jboss.portal.web.WebAppEvent;
-import org.jboss.portal.web.WebAppLifeCycleEvent;
-import org.jboss.portal.web.WebApp;
-import org.jboss.portal.web.ServletContainer;
+import org.apache.log4j.Logger;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.portlet.container.PortletApplication;
+import org.jboss.portal.portlet.container.PortletApplicationRegistrationContext;
+import org.jboss.portal.portlet.container.PortletApplicationRegistry;
+import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
import static org.jboss.portal.portlet.impl.metadata.PortletMetaDataConstants.PORTLET_JSR_168_NS;
import static org.jboss.portal.portlet.impl.metadata.PortletMetaDataConstants.PORTLET_JSR_286_NS;
-import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
-import org.jboss.portal.portlet.test.metadata.impl.AnnotationPortletApplication20MetaData;
+import org.jboss.portal.portlet.test.metadata.factory.PortletApplicationModelFactory;
import org.jboss.portal.portlet.test.metadata.impl.AnnotationPortletApplication10MetaData;
+import org.jboss.portal.portlet.test.metadata.impl.AnnotationPortletApplication20MetaData;
import org.jboss.portal.portlet.test.metadata.impl.ValueTrimmingFilter;
-import org.jboss.portal.portlet.test.metadata.factory.PortletApplicationModelFactory;
-import org.jboss.portal.portlet.container.PortletApplication;
-import org.jboss.portal.portlet.container.PortletContainer;
-import org.jboss.portal.portlet.container.PortletApplicationRegistry;
-import org.jboss.portal.portlet.container.PortletApplicationRegistrationContext;
-import org.jboss.portal.common.io.IOTools;
-import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.kernel.Kernel;
+import org.jboss.portal.web.ServletContainer;
+import org.jboss.portal.web.WebApp;
+import org.jboss.portal.web.WebAppEvent;
+import org.jboss.portal.web.WebAppLifeCycleEvent;
+import org.jboss.portal.web.WebAppListener;
+import org.jboss.xb.binding.JBossXBException;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.JBossXBException;
-import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory;
import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
-import org.apache.log4j.Logger;
+import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory;
-import java.util.Map;
-import java.util.HashMap;
-import java.net.URL;
-import java.io.InputStream;
import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -62,18 +62,12 @@
public class PortletApplicationDeployer implements WebAppListener, KernelControllerContextAware
{
- /** The schema resolver factory. */
- private static SingletonSchemaResolverFactory factory;
-
- /** The schema resolver. */
- private static DefaultSchemaResolver resolver;
-
static
{
try
{
- factory = SingletonSchemaResolverFactory.getInstance();
- resolver = (DefaultSchemaResolver) factory.getSchemaBindingResolver();
+ SingletonSchemaResolverFactory factory = SingletonSchemaResolverFactory.getInstance();
+ DefaultSchemaResolver resolver = (DefaultSchemaResolver)factory.getSchemaBindingResolver();
/** SchemaResolver */
resolver.addSchemaLocation(PORTLET_JSR_168_NS, "portlet-app_1_0.xsd");
@@ -100,13 +94,14 @@
private KernelControllerContext controllerContext;
/** . */
- private Map deploymentMap = new HashMap();
+ private Map<String, PortletApplicationDeployment> deploymentMap = new HashMap<String, PortletApplicationDeployment>();
/** . */
private ClassLoader classLoader;
/** . */
- private final Map registrationContextMap = new HashMap();
+ private final Map<PortletApplication, PortletApplicationRegistrationContext> registrationContextMap =
+ new HashMap<PortletApplication, PortletApplicationRegistrationContext>();
/** . */
private Object driver;
@@ -147,7 +142,7 @@
{
WebAppLifeCycleEvent lifeCycleEvent = (WebAppLifeCycleEvent)event;
String cp = event.getWebApp().getContextPath();
- switch(lifeCycleEvent.getType())
+ switch (lifeCycleEvent.getType())
{
case WebAppLifeCycleEvent.ADDED:
log.debug("Going to install war file" + cp);
@@ -197,7 +192,7 @@
private void remove(WebApp webApp)
{
- PortletApplicationDeployment deployment = (PortletApplicationDeployment)deploymentMap.remove(webApp.getContextPath());
+ PortletApplicationDeployment deployment = deploymentMap.remove(webApp.getContextPath());
if (deployment != null)
{
ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
@@ -290,38 +285,30 @@
return null;
}
- /**
- * Called by MC to install application.
- */
+ /** Called by MC to install application. */
public void installPortletApplication(PortletApplication application)
{
PortletApplicationRegistrationContext context = registry.registerPortletApplication(application);
registrationContextMap.put(application, context);
}
- /**
- * Called by MC to install container.
- */
+ /** Called by MC to install container. */
public void installPortletContainer(PortletContainer container)
{
- PortletApplicationRegistrationContext context = (PortletApplicationRegistrationContext)registrationContextMap.get(container.getApplication());
+ PortletApplicationRegistrationContext context = registrationContextMap.get(container.getApplication());
context.registerPortlet(container);
}
- /**
- * Called by MC to uninstall application.
- */
+ /** Called by MC to uninstall application. */
public void uninstallPortletApplication(PortletApplication application)
{
registry.unregisterPortletApplication(application);
}
- /**
- * Called by MC to uninstall container.
- */
+ /** Called by MC to uninstall container. */
public void uninstallPortletContainer(PortletContainer container)
{
- PortletApplicationRegistrationContext context = (PortletApplicationRegistrationContext)registrationContextMap.get(container.getApplication());
+ PortletApplicationRegistrationContext context = registrationContextMap.get(container.getApplication());
context.unregisterPortlet(container);
}
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContextImpl.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContextImpl.java 2008-01-15 14:39:35 UTC (rev 9512)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletControllerContextImpl.java 2008-01-15 16:16:29 UTC (rev 9513)
@@ -22,24 +22,24 @@
******************************************************************************/
package org.jboss.portal.portlet.test;
-import org.jboss.portal.web.IllegalRequestException;
-import org.jboss.portal.web.WebRequest;
-import org.jboss.portal.web.Body;
-import org.jboss.portal.portlet.test.url.ParameterDecoder;
-import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.common.util.Tools;
import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.PortletContext;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.common.util.ParameterMap;
-import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.test.url.ParameterDecoder;
+import org.jboss.portal.web.Body;
+import org.jboss.portal.web.IllegalRequestException;
+import org.jboss.portal.web.WebRequest;
+import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import javax.servlet.ServletContext;
import java.io.IOException;
import java.util.Collection;
@@ -73,7 +73,7 @@
/** . */
private final PortletInvoker invoker;
-
+
public PortletControllerContextImpl(
HttpServletRequest req,
HttpServletResponse resp,
@@ -89,13 +89,14 @@
//
PortletInvoker invoker = (PortletInvoker)servletContext.getAttribute("ConsumerPortletInvoker");
- //
- String pathInfo = req.getPathInfo();
- String targetId;
+ PortalNavigationalState navState;
+ PortletController.Action action;
+ // decode request
+ String pathInfo = req.getPathInfo();
if (pathInfo != null && pathInfo.startsWith("/") && pathInfo.length() > 1)
{
- targetId = StringCodec.decode(pathInfo.substring(1));
+ String targetId = StringCodec.decode(pathInfo.substring(1));
WebRequest ri = new WebRequest(req);
ParameterDecoder decoder = PortletURLRenderer.builder.createDecoder();
@@ -104,7 +105,6 @@
//
ParameterMap metaParameters = decoder.getMetaParameters();
- PortalNavigationalState navState;
if (navStateScope == NAV_SCOPE)
{
String ns = metaParameters.getValue("ns");
@@ -134,7 +134,6 @@
}
//
- PortletController.Action action;
String type = metaParameters.getValue("type");
//
@@ -152,23 +151,11 @@
{
action = new PortletController.PortletRender(targetId, actualParameters, formParameters, mode, windowState);
}
-
- //
- this.navState = navState;
- this.action = action;
- this.req = req;
- this.resp = resp;
- this.servletContext = servletContext;
- this.invoker = invoker;
}
else
{
- this.navState = new PortalNavigationalState();
- this.action = null;
- this.req = req;
- this.resp = resp;
- this.servletContext = servletContext;
- this.invoker = invoker;
+ navState = new PortalNavigationalState();
+ action = null;
//
if (navStateScope == SESSION_SCOPE)
@@ -176,6 +163,13 @@
req.getSession().setAttribute("nav_state", navState);
}
}
+
+ this.navState = navState;
+ this.action = action;
+ this.req = req;
+ this.resp = resp;
+ this.servletContext = servletContext;
+ this.invoker = invoker;
}
public PortletController.Action getRequest()
Modified: modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml 2008-01-15 14:39:35 UTC (rev 9512)
+++ modules/portlet/trunk/test/src/test/resources/portlet-test-war/WEB-INF/jboss-beans.xml 2008-01-15 16:16:29 UTC (rev 9513)
@@ -25,10 +25,10 @@
xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
xmlns="urn:jboss:bean-deployer">
- <bean name="TestDriverServer" class="org.jboss.unit.remote.driver.RemoteTestDriverServer">
- </bean>
+ <bean name="TestDriverServer" class="org.jboss.unit.remote.driver.RemoteTestDriverServer"/>
- <bean name="TestDriverServerExporter" class="org.jboss.portal.test.framework.impl.generic.server.GenericServiceExporter">
+ <bean name="TestDriverServerExporter"
+ class="org.jboss.portal.test.framework.impl.generic.server.GenericServiceExporter">
<constructor>
<parameter>socket://localhost:5400</parameter>
<parameter><inject bean="TestDriverServer"/></parameter>
@@ -37,8 +37,8 @@
</bean>
<!-- An application registry mainly for listeners -->
- <bean name="PortletApplicationRegistry" class="org.jboss.portal.portlet.impl.container.PortletApplicationRegistryImpl">
- </bean>
+ <bean name="PortletApplicationRegistry"
+ class="org.jboss.portal.portlet.impl.container.PortletApplicationRegistryImpl"/>
<bean name="PortletApplicationDeployer" class="org.jboss.portal.portlet.test.PortletApplicationDeployer">
<property name="registry"><inject bean="PortletApplicationRegistry"/></property>
@@ -46,8 +46,7 @@
<property name="driver"><inject bean="TestDriverServer"/></property>
</bean>
- <bean name="PortletAPIFactory" class="org.jboss.portal.portlet.impl.jsr168.PortletAPIFactoryImpl">
- </bean>
+ <bean name="PortletAPIFactory" class="org.jboss.portal.portlet.impl.jsr168.PortletAPIFactoryImpl"/>
<!-- The ServletContainerFactory -->
<bean name="ServletContainerFactory" class="org.jboss.portal.web.impl.DefaultServletContainerFactory">
@@ -79,22 +78,18 @@
</bean>
<!-- Container stack -->
- <bean name="ValveInterceptor" class="org.jboss.portal.portlet.aspects.portlet.ValveInterceptor">
- </bean>
- <bean name="SecureTransportInterceptor" class="org.jboss.portal.portlet.aspects.portlet.SecureTransportInterceptor">
- </bean>
- <bean name="ContextDispatcherInterceptor" class="org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor">
+ <bean name="ValveInterceptor" class="org.jboss.portal.portlet.aspects.portlet.ValveInterceptor"/>
+ <bean name="SecureTransportInterceptor" class="org.jboss.portal.portlet.aspects.portlet.SecureTransportInterceptor"/>
+ <bean name="ContextDispatcherInterceptor"
+ class="org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor">
<property name="servletContainerFactory"><inject bean="ServletContainerFactory"/></property>
</bean>
- <bean name="WindowStatesInterceptor" class="org.jboss.portal.portlet.aspects.portlet.WindowStatesInterceptor">
- </bean>
- <bean name="ModesInterceptor" class="org.jboss.portal.portlet.aspects.portlet.ModesInterceptor">
- </bean>
- <bean name="ProducerCacheInterceptor" class="org.jboss.portal.portlet.aspects.portlet.ProducerCacheInterceptor">
- </bean>
+ <bean name="WindowStatesInterceptor" class="org.jboss.portal.portlet.aspects.portlet.WindowStatesInterceptor"/>
+ <bean name="ModesInterceptor" class="org.jboss.portal.portlet.aspects.portlet.ModesInterceptor"/>
+ <bean name="ProducerCacheInterceptor" class="org.jboss.portal.portlet.aspects.portlet.ProducerCacheInterceptor"/>
<bean name="ContainerStackFactory" class="org.jboss.portal.portlet.test.InterceptorStackFactoryImpl">
<property name="interceptors">
- <array >
+ <array>
<inject bean="ValveInterceptor"/>
<inject bean="SecureTransportInterceptor"/>
<inject bean="ContextDispatcherInterceptor"/>
@@ -112,7 +107,8 @@
</bean>
<!-- The producer persistence manager -->
- <bean name="ProducerPersistenceManager" class="org.jboss.portal.portlet.impl.state.producer.PortletStatePersistenceManagerService"></bean>
+ <bean name="ProducerPersistenceManager"
+ class="org.jboss.portal.portlet.impl.state.producer.PortletStatePersistenceManagerService"/>
<!-- The producer state management policy -->
<bean name="ProducerStateManagementPolicy" class="org.jboss.portal.portlet.impl.state.StateManagementPolicyService">
@@ -120,7 +116,7 @@
</bean>
<!-- The producer state converter -->
- <bean name="ProducerStateConverter" class="org.jboss.portal.portlet.impl.state.StateConverterV0"></bean>
+ <bean name="ProducerStateConverter" class="org.jboss.portal.portlet.impl.state.StateConverterV0"/>
<!-- The producer portlet invoker -->
<bean name="ProducerPortletInvoker" class="org.jboss.portal.portlet.state.producer.ProducerPortletInvoker">
18 years, 3 months
JBoss Portal SVN: r9512 - branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/test/core/model/portal.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-01-15 09:39:35 -0500 (Tue, 15 Jan 2008)
New Revision: 9512
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java
Log:
Adding a test case that *will* fail.
I know it passes on HSQLDB, i know it fails on MySQL, i'm curious about the other databases.
I will commit a fix soon after the results (or comment it out if the commit takes longer than expected)
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java 2008-01-15 14:38:23 UTC (rev 9511)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java 2008-01-15 14:39:35 UTC (rev 9512)
@@ -114,6 +114,46 @@
TransactionAssert.commitTransaction();
}
+ public void testRegisterObjectWithSameName() throws Exception
+ {
+ TransactionAssert.beginTransaction();
+ PortalContainer ctx = container.getContext();
+ Portal n1 = ctx.createPortal("default");
+ Page n2 = n1.createPage("default");
+ boolean duplicate = false;
+ try
+ {
+ Page n3 = n1.createPage("default");
+ }
+ catch (DuplicatePortalObjectException e)
+ {
+ duplicate = true;
+ }
+ assertTrue(duplicate);
+
+ TransactionAssert.commitTransaction();
+ }
+
+ public void testRegisterObjectWithSameNameCaseInsensitive() throws Exception
+ {
+ TransactionAssert.beginTransaction();
+ PortalContainer ctx = container.getContext();
+ Portal n1 = ctx.createPortal("default");
+ Page n2 = n1.createPage("default");
+ boolean duplicate = true;
+ try
+ {
+ Page n3 = n1.createPage("dEfAuLt");
+ }
+ catch (DuplicatePortalObjectException e)
+ {
+ duplicate = false;
+ }
+ assertTrue(duplicate);
+
+ TransactionAssert.commitTransaction();
+ }
+
public void testPropertyUpdateDoesNotCascadeToDescendantsWhenTheyDeclareIt() throws Exception
{
TransactionAssert.beginTransaction();
18 years, 3 months
JBoss Portal SVN: r9511 - modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-15 09:38:23 -0500 (Tue, 15 Jan 2008)
New Revision: 9511
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalNavigationalState.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java
Log:
minor foreach
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalNavigationalState.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalNavigationalState.java 2008-01-15 14:26:15 UTC (rev 9510)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalNavigationalState.java 2008-01-15 14:38:23 UTC (rev 9511)
@@ -22,6 +22,9 @@
******************************************************************************/
package org.jboss.portal.portlet.test;
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.portlet.PortletParameters;
+
import java.util.Map;
import java.util.HashMap;
import java.util.zip.GZIPOutputStream;
@@ -43,6 +46,9 @@
/** . */
private final Map<String, WindowNavigationalState> windows = new HashMap<String, WindowNavigationalState>();
+ /** . */
+ private final PortletParameters sharedParameters = new PortletParameters();
+
public WindowNavigationalState getWindow(String windowId)
{
return windows.get(windowId);
@@ -53,6 +59,11 @@
windows.put(windowId, window);
}
+ public ParameterMap getSharedParameters()
+ {
+ return sharedParameters;
+ }
+
public byte[] getBytes() throws IOException
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java 2008-01-15 14:26:15 UTC (rev 9510)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java 2008-01-15 14:38:23 UTC (rev 9511)
@@ -55,7 +55,6 @@
import java.io.UnsupportedEncodingException;
import java.io.PrintWriter;
import java.io.IOException;
-import java.util.Iterator;
import java.util.List;
import java.util.ArrayList;
import java.util.LinkedList;
@@ -363,9 +362,8 @@
//
try
{
- for (Iterator i = context.getPortlets().iterator(); i.hasNext();)
+ for (Portlet portlet : context.getPortlets())
{
- Portlet portlet = (Portlet)i.next();
writer.print("<div><div>" + portlet.getContext() + "</div>");
PortletURLRenderer renderer = new PortletURLRenderer(navState, portlet, req, resp);
@@ -380,15 +378,15 @@
{
if (windowNS.getMode() != null)
{
- mode= windowNS.getMode();
+ mode = windowNS.getMode();
}
if (windowNS.getWindowState() != null)
{
- windowState= windowNS.getWindowState();
+ windowState = windowNS.getWindowState();
}
if (windowNS.getPortletNavigationalState() != null)
{
- portletNS= windowNS.getPortletNavigationalState();
+ portletNS = windowNS.getPortletNavigationalState();
}
}
18 years, 3 months
JBoss Portal SVN: r9510 - modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/url.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-15 09:26:15 -0500 (Tue, 15 Jan 2008)
New Revision: 9510
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/url/CodecBuilder.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/url/ParameterDecoder.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/url/ParameterEncoder.java
Log:
generified the parameterencoder / parameterdecoder classes
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/url/CodecBuilder.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/url/CodecBuilder.java 2008-01-15 12:30:39 UTC (rev 9509)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/url/CodecBuilder.java 2008-01-15 14:26:15 UTC (rev 9510)
@@ -33,20 +33,20 @@
{
/** . */
- final ArrayList metaParameterNames;
+ final ArrayList<String> metaParameterNames;
/** . */
final String reservedParameterName;
public CodecBuilder(CodecBuilder that)
{
- this.metaParameterNames = new ArrayList(that.metaParameterNames);
+ this.metaParameterNames = new ArrayList<String>(that.metaParameterNames);
this.reservedParameterName = that.reservedParameterName;
}
public CodecBuilder(String reservedParameter)
{
- this.metaParameterNames = new ArrayList();
+ this.metaParameterNames = new ArrayList<String>();
this.reservedParameterName = reservedParameter;
}
@@ -73,5 +73,4 @@
{
return new ParameterDecoder(this);
}
-
}
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/url/ParameterDecoder.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/url/ParameterDecoder.java 2008-01-15 12:30:39 UTC (rev 9509)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/url/ParameterDecoder.java 2008-01-15 14:26:15 UTC (rev 9510)
@@ -25,8 +25,6 @@
import org.jboss.portal.common.util.ParameterMap;
import java.util.Iterator;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.Map;
/**
@@ -68,7 +66,7 @@
metaParameters.clear();
// Get the meta parameter
- long reservedParameter = 0;
+ long reservedParameter;
String[] reservedParameters = parameters.getValues(builder.reservedParameterName);
if (reservedParameters != null)
{
@@ -99,7 +97,7 @@
}
//
- String parameterName = (String)builder.metaParameterNames.get(i--);
+ String parameterName = builder.metaParameterNames.get(i--);
//
if ((reservedParameter & 1) == 1)
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/url/ParameterEncoder.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/url/ParameterEncoder.java 2008-01-15 12:30:39 UTC (rev 9509)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/url/ParameterEncoder.java 2008-01-15 14:26:15 UTC (rev 9510)
@@ -25,7 +25,6 @@
import org.jboss.portal.common.util.ParameterMap;
import java.util.Map;
-import java.util.Iterator;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -59,9 +58,8 @@
long meta = 0;
//
- for (Iterator i = builder.metaParameterNames.iterator();i.hasNext();)
+ for (String mv : builder.metaParameterNames)
{
- String mv = (String)i.next();
String pv = metaParameters.getValue(mv);
//
@@ -91,10 +89,10 @@
String[] pvs = actualParameters.getValues(builder.reservedParameterName);
if (pvs != null)
{
- String[] blah = new String[1 + pvs.length];
- blah[0] = def;
- System.arraycopy(pvs, 0, blah, 1, pvs.length);
- parameters.setValues(builder.reservedParameterName, blah);
+ String[] tmp = new String[1 + pvs.length];
+ tmp[0] = def;
+ System.arraycopy(pvs, 0, tmp, 1, pvs.length);
+ parameters.setValues(builder.reservedParameterName, tmp);
}
else
{
@@ -102,13 +100,12 @@
}
//
- for (Iterator i = actualParameters.entrySet().iterator();i.hasNext();)
+ for (Map.Entry<String, String[]> entry : actualParameters.entrySet())
{
- Map.Entry entry = (Map.Entry)i.next();
- String name = (String)entry.getKey();
+ String name = entry.getKey();
if (!parameters.containsKey(name))
{
- String[] values = (String[])entry.getValue();
+ String[] values = entry.getValue();
parameters.setValues(name, values);
}
}
18 years, 3 months
JBoss Portal SVN: r9509 - in modules/portlet/trunk: portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/stateawareresponse and 6 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-15 07:30:39 -0500 (Tue, 15 Jan 2008)
New Revision: 9509
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/stateawareresponse/
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/stateawareresponse/SetRenderParametersTestCase.java
modules/portlet/trunk/test/src/test/resources/jsr286/tck/stateawareresponse-war/
modules/portlet/trunk/test/src/test/resources/jsr286/tck/stateawareresponse-war/WEB-INF/
modules/portlet/trunk/test/src/test/resources/jsr286/tck/stateawareresponse-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/jsr286/tck/stateawareresponse-war/WEB-INF/web.xml
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java
modules/portlet/trunk/test/src/test/build.xml
modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
Log:
JSR 286 TCK 103 test case : Using the setRenderParameter and setRenderParameters methods portlets may set render parameters. A call to any of the setRenderParameter methods must replace any parameter with the same name previously set.
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/stateawareresponse/SetRenderParametersTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/stateawareresponse/SetRenderParametersTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/stateawareresponse/SetRenderParametersTestCase.java 2008-01-15 12:30:39 UTC (rev 9509)
@@ -0,0 +1,166 @@
+/******************************************************************************
+ * 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. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.tck.stateawareresponse;
+
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.unit.actions.PortletActionTestAction;
+import org.jboss.portal.unit.actions.PortletEventTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.*;
+import static org.jboss.unit.api.Assert.assertEquals;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+
+import javax.portlet.RenderRequest;
+import javax.portlet.Portlet;
+import javax.portlet.RenderResponse;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.PortletRequest;
+import javax.xml.namespace.QName;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+(a)TestCase({Assertion.JSR286_103})
+public class SetRenderParametersTestCase
+{
+ public SetRenderParametersTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+ seq.bindAction(1, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ response.setRenderParameter("foo", "fooaction1");
+ }
+ });
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ assertRenderParameter(request, "foo", "fooaction1");
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ //
+ seq.bindAction(2, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ response.setRenderParameter("foo", "fooaction2");
+ response.setEvent("Foo", null);
+ }
+ });
+ seq.bindAction(2, UTP1.EVENT_JOIN_POINT, new PortletEventTestAction()
+ {
+ protected void run(Portlet portlet, EventRequest request, EventResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ if ("Foo".equals(request.getEvent().getName()))
+ {
+ assertRenderParameter(request, "foo", "fooaction2");
+ response.setRenderParameter("foo", "fooevent1");
+ }
+ else
+ {
+ fail();
+ }
+ }
+ });
+ seq.bindAction(2, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ assertRenderParameter(request, "foo", "fooevent1");
+ return new InvokeGetResponse(response.createActionURL().toString());
+ }
+ });
+
+ //
+ seq.bindAction(3, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ response.setRenderParameter("foo", "fooaction3");
+ response.setEvent("Foo", null);
+ }
+ });
+ seq.bindAction(3, UTP1.EVENT_JOIN_POINT, new PortletEventTestAction()
+ {
+ protected void run(Portlet portlet, EventRequest request, EventResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ String eventName = request.getEvent().getName();
+ if ("Foo".equals(eventName))
+ {
+ assertRenderParameter(request, "foo", "fooaction3");
+ response.setRenderParameter("foo", "fooevent2");
+ response.setEvent("Bar", null);
+ }
+ else if ("Bar".equals(eventName))
+ {
+ assertRenderParameter(request, "foo", "fooevent2");
+ response.setRenderParameter("foo", "fooevent3");
+ }
+ else
+ {
+ fail();
+ }
+ }
+ });
+ seq.bindAction(3, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ assertRenderParameter(request, "foo", "fooevent3");
+ return new EndTestResponse();
+ }
+ });
+ }
+
+ private void assertRenderParameter(PortletRequest request, String name, String value)
+ {
+ assertEquals(1, request.getParameterMap().size());
+ assertTrue(request.getParameterMap().containsKey(name));
+ assertEquals(new String[]{value}, request.getParameterMap().get(name));
+ assertEquals(value, request.getParameter(name));
+ assertEquals(new String[]{value}, request.getParameterValues(name));
+ }
+
+}
\ No newline at end of file
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java 2008-01-15 11:46:05 UTC (rev 9508)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java 2008-01-15 12:30:39 UTC (rev 9509)
@@ -460,7 +460,13 @@
"supported locales found in the portlet definition in the deployment descriptor with the supported-locale " +
"element or an empty enumeration if no supported locales are defined for the current portlet definition."),
+ // PLT.12 Portlet Responses
+ JSR286_103(new TCK(103), "Using the setRenderParameter and setRenderParameters methods portlets may set " +
+ "render parameters. A call to any of the setRenderParameter methods must replace any " +
+ "parameter with the same name previously set."),
+
+
// PLT.15 Coordination between portlets
JSR286_133(new TCK(133), "PLT.15.2.2", "The event must always have a name and may optionally have a value."),
JSR286_134(new TCK(134), "PLT.15.2.2", "If the event has a value it must be based on the type defined in the " +
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-01-15 11:46:05 UTC (rev 9508)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-01-15 12:30:39 UTC (rev 9509)
@@ -228,6 +228,7 @@
<package-jsr286-tck-test test="portletconfignonamespace"/>
<package-jsr286-tck-test test="event"/>
<package-jsr286-tck-test test="eventnonamespace"/>
+ <package-jsr286-tck-test test="stateawareresponse"/>
<package-jsr286-api-test test="event"/>
Added: modules/portlet/trunk/test/src/test/resources/jsr286/tck/stateawareresponse-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/stateawareresponse-war/WEB-INF/portlet.xml (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/stateawareresponse-war/WEB-INF/portlet.xml 2008-01-15 12:30:39 UTC (rev 9509)
@@ -0,0 +1,58 @@
+<?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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<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>
+ <portlet-name>UniversalTestPortletA</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP1</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <supported-processing-event>
+ <name>Foo</name>
+ </supported-processing-event>
+ <supported-processing-event>
+ <name>Bar</name>
+ </supported-processing-event>
+ <supported-publishing-event>
+ <name>Foo</name>
+ </supported-publishing-event>
+ <supported-publishing-event>
+ <name>Bar</name>
+ </supported-publishing-event>
+ </portlet>
+
+ <event-definition>
+ <name>Foo</name>
+ </event-definition>
+
+ <event-definition>
+ <name>Bar</name>
+ </event-definition>
+
+</portlet-app>
Added: modules/portlet/trunk/test/src/test/resources/jsr286/tck/stateawareresponse-war/WEB-INF/web.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/stateawareresponse-war/WEB-INF/web.xml (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/stateawareresponse-war/WEB-INF/web.xml 2008-01-15 12:30:39 UTC (rev 9509)
@@ -0,0 +1,32 @@
+<?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>
+ <listener>
+ <listener-class>org.jboss.portal.unit.PortletTestSuite</listener-class>
+ </listener>
+</web-app>
Modified: modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-01-15 11:46:05 UTC (rev 9508)
+++ modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-01-15 12:30:39 UTC (rev 9509)
@@ -163,6 +163,10 @@
<class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId" value="test-jsr286-tck-eventnonamespace.war"/>
</generic>
+ <generic>
+ <class name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
+ <property name="archiveId" value="test-jsr286-tck-stateawareresponse.war"/>
+ </generic>
<!--Spec API Assertions tests-->
<generic>
18 years, 3 months
JBoss Portal SVN: r9508 - in branches/JBoss_Portal_Branch_2_6: core/src/main/org/jboss/portal/core/controller/command/response and 2 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-01-15 06:46:05 -0500 (Tue, 15 Jan 2008)
New Revision: 9508
Modified:
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/command/StreamContentCommand.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/command/response/StreamContentResponse.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/handler/HTTPResponse.java
Log:
[JBPORTAL-1867] Fail to set `Last-Modified' HTTP header - content not cached, bad for reverse proxy
Contribution from Mike Millson
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java 2008-01-15 11:34:57 UTC (rev 9507)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java 2008-01-15 11:46:05 UTC (rev 9508)
@@ -126,7 +126,7 @@
else if (controllerResponse instanceof StreamContentResponse)
{
StreamContentResponse scr = (StreamContentResponse)controllerResponse;
- return HTTPResponse.sendBinary(scr.getContentType(), scr.getInputStream());
+ return HTTPResponse.sendBinary(scr.getContentType(), scr.getLastModified(), scr.getInputStream());
}
else if (controllerResponse instanceof SecurityErrorResponse)
{
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/command/response/StreamContentResponse.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/command/response/StreamContentResponse.java 2008-01-15 11:34:57 UTC (rev 9507)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/command/response/StreamContentResponse.java 2008-01-15 11:46:05 UTC (rev 9508)
@@ -35,11 +35,17 @@
/** . */
private String contentType;
+
+ /**
+ * The time the content was last modified, measured in milliseconds since
+ * the epoch (00:00:00 GMT, January 1, 1970).
+ */
+ private long lastModified;
/** . */
private InputStream inputStream;
- public StreamContentResponse(String contentType, InputStream inputStream)
+ public StreamContentResponse(String contentType, long lastModified, InputStream inputStream)
{
if (contentType == null)
{
@@ -50,6 +56,7 @@
throw new IllegalArgumentException();
}
this.contentType = contentType;
+ this.lastModified = lastModified;
this.inputStream = inputStream;
}
@@ -57,6 +64,11 @@
{
return contentType;
}
+
+ public long getLastModified()
+ {
+ return lastModified;
+ }
public InputStream getInputStream()
{
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/handler/HTTPResponse.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/handler/HTTPResponse.java 2008-01-15 11:34:57 UTC (rev 9507)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/handler/HTTPResponse.java 2008-01-15 11:46:05 UTC (rev 9508)
@@ -54,7 +54,7 @@
};
}
- public static HTTPResponse sendBinary(final String contentType, final InputStream in)
+ public static HTTPResponse sendBinary(final String contentType, final long lastModified, final InputStream in)
{
return new HTTPResponse()
{
@@ -62,6 +62,7 @@
{
HttpServletResponse resp = ctx.getClientResponse();
resp.setContentType(contentType);
+ resp.addDateHeader("Last-Modified", lastModified);
ServletOutputStream sout = null;
try
{
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/command/StreamContentCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/command/StreamContentCommand.java 2008-01-15 11:34:57 UTC (rev 9507)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/command/StreamContentCommand.java 2008-01-15 11:46:05 UTC (rev 9508)
@@ -86,8 +86,18 @@
}
Content content = file.getContent();
String mimeType = content.getMimeType();
+ long lastModified;
+ if(content.getLastModified() != null)
+ {
+ lastModified = content.getLastModified().getTime();
+ }
+ else
+ {
+ // Use current time in none available
+ lastModified = System.currentTimeMillis();
+ }
InputStream inputStream = content.getStream();
- return new StreamContentResponse(mimeType, inputStream);
+ return new StreamContentResponse(mimeType, lastModified, inputStream);
}
catch (Exception e)
{
18 years, 3 months