JBoss Portal SVN: r6855 - trunk/build/ide/intellij/idea60/modules/core.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-03-27 20:50:40 -0400 (Tue, 27 Mar 2007)
New Revision: 6855
Modified:
trunk/build/ide/intellij/idea60/modules/core/core.iml
Log:
- Updated to add freemarker lib.
Modified: trunk/build/ide/intellij/idea60/modules/core/core.iml
===================================================================
--- trunk/build/ide/intellij/idea60/modules/core/core.iml 2007-03-27 23:18:47 UTC (rev 6854)
+++ trunk/build/ide/intellij/idea60/modules/core/core.iml 2007-03-28 00:50:40 UTC (rev 6855)
@@ -260,6 +260,15 @@
<orderEntry type="module" module-name="workflow" />
<orderEntry type="module" module-name="portlet-federation" />
<orderEntry type="module" module-name="portlet-server" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/freemarker/lib/freemarker.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
17 years, 7 months
JBoss Portal SVN: r6854 - in trunk/portlet/src: main/org/jboss/portal/portlet/impl/jsr168/api and 5 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-27 19:18:47 -0400 (Tue, 27 Mar 2007)
New Revision: 6854
Added:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestAttributes.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/framework/NoopServlet.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/dispatcher/ServletFilter.java
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractRequestContext.java
trunk/portlet/src/main/org/jboss/portal/portlet/spi/RequestContext.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/dispatcher/DispatcherSequenceBuilder.java
trunk/portlet/src/resources/test/jsr168/ext/dispatcher-war/WEB-INF/portlet.xml
trunk/portlet/src/resources/test/jsr168/ext/dispatcher-war/WEB-INF/web.xml
Log:
- improved implementation of how a portlet request handle request attributes
- added test cases for servlet filter calls when a portlet request dispatches to a servlet : only filters using the INCLUDE dispatcher should be called
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java 2007-03-27 17:58:02 UTC (rev 6853)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java 2007-03-27 23:18:47 UTC (rev 6854)
@@ -25,8 +25,8 @@
import org.jboss.portal.common.http.QueryStringParser;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.portlet.PortletParameters;
+import org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl;
-import javax.portlet.RenderRequest;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletInputStream;
import javax.servlet.http.Cookie;
@@ -42,7 +42,7 @@
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
-import java.util.Set;
+import java.util.Iterator;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -57,14 +57,14 @@
private static final String PATH_INFO = "javax.servlet.include.path_info";
private static final String QUERY_STRING = "javax.servlet.include.query_string";
- private RenderRequest rreq;
+ private RenderRequestImpl rreq;
private HttpServletRequest dreq;
private final Map attrs;
private final Map parameters;
public DispatchedHttpServletRequest(
- RenderRequest rreq,
+ RenderRequestImpl rreq,
HttpServletRequest dreq,
String path)
{
@@ -116,12 +116,13 @@
String requestURI = rreq.getContextPath() + servletPath + pathInfo;
//
- this.attrs = new HashMap();
- this.attrs.put(CONTEXT_PATH, rreq.getContextPath());
- this.attrs.put(SERVLET_PATH, servletPath);
- this.attrs.put(PATH_INFO, pathInfo);
- this.attrs.put(QUERY_STRING, queryString);
- this.attrs.put(REQUEST_URI, requestURI);
+ Map attrs = new HashMap(5);
+ attrs.put(CONTEXT_PATH, rreq.getContextPath());
+ attrs.put(SERVLET_PATH, servletPath);
+ attrs.put(PATH_INFO, pathInfo);
+ attrs.put(QUERY_STRING, queryString);
+ attrs.put(REQUEST_URI, requestURI);
+ this.attrs = Collections.unmodifiableMap(attrs);
//
if (queryString.length() > 0)
@@ -214,16 +215,20 @@
public Object getAttribute(String s)
{
- if (attrs.containsKey(s))
+ // First try the special values
+ Object value = attrs.get(s);
+ if (value != null)
{
- return attrs.get(s);
+ return value;
}
- return rreq.getAttribute(s);
+
+ // Otherwise try the render request modified attributes
+ return rreq.getAttributes().getAttribute(s, (HttpServletRequest)getRequest());
}
public Enumeration getAttributeNames()
{
- final Enumeration e = rreq.getAttributeNames();
+ final Iterator i = rreq.getAttributes().getAttributeNames((HttpServletRequest)getRequest());
return new Enumeration()
{
// The next element
@@ -250,9 +255,9 @@
next = null;
while (true)
{
- if (e.hasMoreElements())
+ if (i.hasNext())
{
- Object next = e.nextElement();
+ Object next = i.next();
if (attrs != null && !attrs.containsKey(next))
{
this.next = next;
@@ -270,12 +275,12 @@
public void setAttribute(String s, Object o)
{
- rreq.setAttribute(s, o);
+ rreq.getAttributes().setAttribute(s, o);
}
public void removeAttribute(String s)
{
- rreq.removeAttribute(s);
+ rreq.getAttributes().removeAttribute(s);
}
public Locale getLocale()
Added: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestAttributes.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestAttributes.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestAttributes.java 2007-03-27 23:18:47 UTC (rev 6854)
@@ -0,0 +1,190 @@
+/******************************************************************************
+ * 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.Tools;
+import org.jboss.portal.portlet.impl.jsr168.metadata.PortletApplicationMetaData;
+import org.jboss.portal.portlet.spi.UserContext;
+import org.jboss.portal.portlet.container.PortletContainer;
+
+import javax.portlet.PortletRequest;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Map;
+import java.util.Enumeration;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.HashMap;
+import java.util.Collections;
+
+/**
+ * Hold the portlet request attributes and holds only the modified state. That is the reason motivating the
+ * presence of an <code>HttpServletRequest</code> on the methods returning data reading the state. The object
+ * can be used either during the render request where the dispatched request will be used. It can also be used
+ * during a request dispatch made from the portlet to a servlet, in that situation the request provided will
+ * be the one valid during the dispatching operation.
+ *
+ * The other motivation of this class is to hold the state of the attributes that have been modified by the
+ * request to the portlet container, so it will not write in the portal request attributes.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletRequestAttributes
+{
+
+ /** Constant object to mark that a request attribute is removed. */
+ protected static final Object REMOVED_ATTRIBUTE = new Object();
+
+ private PortletContainer container;
+
+ private UserContext userContext;
+
+ /** The lazy request attributes map added or removed during the request of the portlet. */
+ private Map attributes;
+
+ public PortletRequestAttributes(PortletContainer container, UserContext userContext)
+ {
+ this.container = container;
+ this.userContext = userContext;
+ }
+
+ public Object getAttribute(String name, HttpServletRequest req)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name must not be null");
+ }
+ if (PortletRequest.USER_INFO.equals(name))
+ {
+ Map infos = userContext.getInformations();
+
+ //
+ if (infos != null)
+ {
+ // Get portlet application metadata
+ PortletApplicationImpl portletApp = (PortletApplicationImpl)container.getApplication();
+ PortletApplicationMetaData pamd = portletApp.getMetaData();
+ Map uaMD = pamd.getUserAttributes();
+
+ // Clone the map
+ infos = new HashMap(infos);
+
+ // Keep only what is of interest with respect to what the portlet app defines
+ infos.keySet().retainAll(uaMD.keySet());
+
+ // Make it immutable
+ infos = Collections.unmodifiableMap(infos);
+ }
+
+ //
+ return infos;
+ }
+ else
+ {
+ Object value = null;
+ if (attributes != null)
+ {
+ value = attributes.get(name);
+ }
+ if (value == null && req != null)
+ {
+ value = req.getAttribute(name);
+ }
+ else if (value == REMOVED_ATTRIBUTE)
+ {
+ value = null;
+ }
+ return value;
+ }
+ }
+
+ public Iterator getAttributeNames(HttpServletRequest req)
+ {
+ // Copy the attribute names to avoid ConcurrentModificationException
+ // one test in the TCK getPortalObjectContext the Enumeration then dispatch the call to a
+ // servlet where it use the Enumeration and it throws a CME if we don't copy
+ Set names = new HashSet();
+
+ //
+ if (req != null)
+ {
+ for (Enumeration e = req.getAttributeNames();e.hasMoreElements();)
+ {
+ names.add(e.nextElement());
+ }
+ }
+
+ //
+ if (attributes != null)
+ {
+ for (Iterator i = attributes.entrySet().iterator(); i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ String name = (String)entry.getKey();
+ Object value = entry.getValue();
+ if (value == REMOVED_ATTRIBUTE)
+ {
+ names.remove(name);
+ }
+ else
+ {
+ names.add(name);
+ }
+ }
+ }
+ names.add(PortletRequest.USER_INFO);
+
+ //
+ return names.iterator();
+ }
+
+ public void setAttribute(String name, Object value)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name must not be null");
+ }
+ if (!PortletRequest.USER_INFO.equals(name))
+ {
+ if (value == null)
+ {
+ value = REMOVED_ATTRIBUTE;
+ }
+ if (attributes == null)
+ {
+ attributes = new HashMap();
+ }
+ attributes.put(name, value);
+ }
+ }
+
+ public void removeAttribute(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name must not be null");
+ }
+ setAttribute(name, null);
+ }
+}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java 2007-03-27 17:58:02 UTC (rev 6853)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java 2007-03-27 23:18:47 UTC (rev 6854)
@@ -79,7 +79,7 @@
RenderResponse rresp = (RenderResponse)req.getAttribute(APIConstants.JAVAX_PORTLET_RESPONSE);
//
- DispatchedHttpServletRequest direq = new DispatchedHttpServletRequest(rreq, dreq, path);
+ DispatchedHttpServletRequest direq = new DispatchedHttpServletRequest((RenderRequestImpl)rreq, dreq, path);
DispatchedHttpServletResponse diresp = new DispatchedHttpServletResponse(rresp, dresp);
//
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java 2007-03-27 17:58:02 UTC (rev 6853)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java 2007-03-27 23:18:47 UTC (rev 6854)
@@ -30,10 +30,10 @@
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.info.ContainerPreferencesInfo;
import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
import org.jboss.portal.portlet.impl.jsr168.info.ContentTypes;
-import org.jboss.portal.portlet.impl.jsr168.metadata.PortletApplicationMetaData;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.spi.InstanceContext;
import org.jboss.portal.portlet.spi.RequestContext;
@@ -54,7 +54,6 @@
import java.security.Principal;
import java.util.Collections;
import java.util.Enumeration;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Locale;
@@ -73,9 +72,6 @@
public abstract class PortletRequestImpl implements PortletRequest
{
- /** Constant object to mark that a request attribute is removed. */
- protected static final Object REMOVED_ATTRIBUTE = new Object();
-
protected static final Logger log = Logger.getLogger(PortletRequestImpl.class);
protected PortletInvocation invocation;
@@ -84,20 +80,18 @@
protected RequestContext requestContext;
protected InstanceContext instanceContext;
protected PortletPreferences preferences;
-
protected PortletContainerImpl container;
protected ContentTypes contentTypes;
protected HttpServletRequest dreq;
protected PortalContext portalContext;
protected PortletSessionImpl psession;
-
protected int sessionStatus;
/** . */
protected PortletParameters parameters;
- /** The lazy request attributes map added or removed during the request of the portlet. */
- protected Map attributes;
+ /** . */
+ protected final PortletRequestAttributes attributes;
public PortletRequestImpl(PortletInvocation invocation)
{
@@ -112,6 +106,7 @@
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;
@@ -193,114 +188,25 @@
// PLT.11.1.3
- public Object getAttribute(String name)
- {
- if (name == null)
- {
- throw new IllegalArgumentException("name must not be null");
- }
- if (PortletRequest.USER_INFO.equals(name))
- {
- Map infos = userContext.getInformations();
- //
- if (infos != null)
- {
- // Get portlet application metadata
- PortletApplicationImpl portletApp = (PortletApplicationImpl)container.getApplication();
- PortletApplicationMetaData pamd = portletApp.getMetaData();
- Map uaMD = pamd.getUserAttributes();
-
- // Clone the map
- infos = new HashMap(infos);
-
- // Keep only what is of interest with respect to what the portlet app defines
- infos.keySet().retainAll(uaMD.keySet());
-
- // Make it immutable
- infos = Collections.unmodifiableMap(infos);
- }
-
- //
- return infos;
- }
- else
- {
- Object value = null;
- if (attributes != null)
- {
- value = attributes.get(name);
- }
- if (value == null)
- {
- value = requestContext.getAttribute(name);
- }
- else if (value == REMOVED_ATTRIBUTE)
- {
- value = null;
- }
- return value;
- }
+ public Object getAttribute(String name) throws IllegalArgumentException
+ {
+ return attributes.getAttribute(name, dreq);
}
public Enumeration getAttributeNames()
{
- // Copy the attribute names to avoid ConcurrentModificationException
- // one test in the TCK getPortalObjectContext the Enumeration then dispatch the call to a
- // servlet where it use the Enumeration and it throws a CME if we don't copy
- Set names = new HashSet();
- for (Enumeration e = requestContext.getAttributeNames(); e.hasMoreElements();)
- {
- names.add(e.nextElement());
- }
- if (attributes != null)
- {
- for (Iterator i = attributes.entrySet().iterator(); i.hasNext();)
- {
- Map.Entry entry = (Map.Entry)i.next();
- String name = (String)entry.getKey();
- Object value = entry.getValue();
- if (value == REMOVED_ATTRIBUTE)
- {
- names.remove(name);
- }
- else
- {
- names.add(name);
- }
- }
- }
- names.add(PortletRequest.USER_INFO);
- return Tools.toEnumeration(names.iterator());
+ return Tools.toEnumeration(attributes.getAttributeNames(dreq));
}
public void setAttribute(String name, Object value)
{
- if (name == null)
- {
- throw new IllegalArgumentException("name must not be null");
- }
- if (!PortletRequest.USER_INFO.equals(name))
- {
- if (value == null)
- {
- value = REMOVED_ATTRIBUTE;
- }
- if (attributes == null)
- {
- attributes = new HashMap();
- }
- attributes.put(name, value);
- }
+ attributes.setAttribute(name, value);
}
public void removeAttribute(String name)
{
- if (name == null)
- {
- throw new IllegalArgumentException("name must not be null");
- }
- setAttribute(name, null);
+ attributes.removeAttribute(name);
}
// PLT.11.1.4
@@ -559,4 +465,11 @@
{
return preferences;
}
+
+ //
+
+ public PortletRequestAttributes getAttributes()
+ {
+ return attributes;
+ }
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractRequestContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractRequestContext.java 2007-03-27 17:58:02 UTC (rev 6853)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractRequestContext.java 2007-03-27 23:18:47 UTC (rev 6854)
@@ -24,12 +24,8 @@
import org.jboss.portal.portlet.spi.RequestContext;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.Enumeration;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -65,16 +61,6 @@
return resp;
}
- public Object getAttribute(String name)
- {
- return req.getAttribute(name);
- }
-
- public Enumeration getAttributeNames()
- {
- return req.getAttributeNames();
- }
-
public String getScheme()
{
return getClientRequest().getScheme();
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/spi/RequestContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/spi/RequestContext.java 2007-03-27 17:58:02 UTC (rev 6853)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/spi/RequestContext.java 2007-03-27 23:18:47 UTC (rev 6854)
@@ -24,7 +24,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import java.util.Enumeration;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -35,16 +34,6 @@
/**
*
*/
- Object getAttribute(String name);
-
- /**
- *
- */
- Enumeration getAttributeNames();
-
- /**
- *
- */
String getScheme();
/**
Added: trunk/portlet/src/main/org/jboss/portal/test/portlet/framework/NoopServlet.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/framework/NoopServlet.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/framework/NoopServlet.java 2007-03-27 23:18:47 UTC (rev 6854)
@@ -0,0 +1,41 @@
+/******************************************************************************
+ * 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.framework;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class NoopServlet extends HttpServlet
+{
+
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ }
+}
Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/dispatcher/DispatcherSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/dispatcher/DispatcherSequenceBuilder.java 2007-03-27 17:58:02 UTC (rev 6853)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/dispatcher/DispatcherSequenceBuilder.java 2007-03-27 23:18:47 UTC (rev 6854)
@@ -23,6 +23,7 @@
package org.jboss.portal.test.portlet.jsr168.ext.dispatcher;
import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.common.util.CollectionBuilder;
import org.jboss.portal.common.test.driver.response.EndTestResponse;
import org.jboss.portal.test.framework.driver.http.response.InvokeGetResponse;
import org.jboss.portal.common.test.driver.DriverResponse;
@@ -35,6 +36,7 @@
import org.jboss.portal.test.framework.portlet.components.AbstractUniversalTestPortlet;
import org.jboss.portal.test.portlet.framework.UTP1;
import org.jboss.portal.test.portlet.framework.UTS1;
+import org.jboss.portal.test.portlet.framework.UTP2;
import javax.portlet.Portlet;
import javax.portlet.PortletException;
@@ -48,8 +50,11 @@
import java.io.IOException;
import java.util.Enumeration;
import java.util.Set;
+import java.util.Collections;
/**
+ * Tests for request dispatching from a portlet to a servlet.
+ *
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
* @version $Revision$
*/
@@ -134,4 +139,31 @@
}
});
}
+
+ public void createBlah(PortletTestDriver registry)
+ {
+ PortletTest seq = new PortletTest();
+ registry.addSequence("Blah", seq);
+ seq.addAction(0, UTP2.RENDER_JOINPOINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ PortletRequestDispatcher prd = request.getPortletSession().getPortletContext().getRequestDispatcher("/noop");
+ assertNotNull(prd);
+ ServletFilter.ids.clear();
+ prd.include(request, response);
+ assertEquals(new CollectionBuilder().add("INCLUDE_URL_PATTERN_FILTER").add("INCLUDE_NAMED_FILTER").toHashSet(), ServletFilter.ids);
+
+ //
+ prd = request.getPortletSession().getPortletContext().getNamedDispatcher("NoopServlet");
+ assertNotNull(prd);
+ ServletFilter.ids.clear();
+ prd.include(request, response);
+ assertEquals(Collections.singleton("INCLUDE_NAMED_FILTER"), ServletFilter.ids);
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
}
Added: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/dispatcher/ServletFilter.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/dispatcher/ServletFilter.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/ext/dispatcher/ServletFilter.java 2007-03-27 23:18:47 UTC (rev 6854)
@@ -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.test.portlet.jsr168.ext.dispatcher;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.FilterChain;
+import java.io.IOException;
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ServletFilter implements Filter
+{
+
+ public static final Set ids = new HashSet();
+
+ private String id;
+
+ public void init(FilterConfig cfg) throws ServletException
+ {
+ id = cfg.getInitParameter("id");
+ }
+
+ public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException
+ {
+ if (id == null)
+ {
+ throw new ServletException("No id found in the servlet filter config");
+ }
+
+ //
+ ids.add(id);
+
+ //
+ chain.doFilter(req, resp);
+ }
+
+ public void destroy()
+ {
+ id = null;
+ }
+}
Modified: trunk/portlet/src/resources/test/jsr168/ext/dispatcher-war/WEB-INF/portlet.xml
===================================================================
--- trunk/portlet/src/resources/test/jsr168/ext/dispatcher-war/WEB-INF/portlet.xml 2007-03-27 17:58:02 UTC (rev 6853)
+++ trunk/portlet/src/resources/test/jsr168/ext/dispatcher-war/WEB-INF/portlet.xml 2007-03-27 23:18:47 UTC (rev 6854)
@@ -39,5 +39,15 @@
</portlet-info>
</portlet>
-
+ <portlet>
+ <portlet-name>TestUniversalPortletB</portlet-name>
+ <portlet-class>org.jboss.portal.test.portlet.framework.UTP2</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
</portlet-app>
Modified: trunk/portlet/src/resources/test/jsr168/ext/dispatcher-war/WEB-INF/web.xml
===================================================================
--- trunk/portlet/src/resources/test/jsr168/ext/dispatcher-war/WEB-INF/web.xml 2007-03-27 17:58:02 UTC (rev 6853)
+++ trunk/portlet/src/resources/test/jsr168/ext/dispatcher-war/WEB-INF/web.xml 2007-03-27 23:18:47 UTC (rev 6854)
@@ -22,11 +22,102 @@
~ 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>
+<web-app
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+ <filter>
+ <filter-name>IncludeURLPatternFilter</filter-name>
+ <filter-class>org.jboss.portal.test.portlet.jsr168.ext.dispatcher.ServletFilter</filter-class>
+ <init-param>
+ <param-name>id</param-name>
+ <param-value>INCLUDE_URL_PATTERN_FILTER</param-value>
+ </init-param>
+ </filter>
+
+ <filter>
+ <filter-name>IncludeNamedFilter</filter-name>
+ <filter-class>org.jboss.portal.test.portlet.jsr168.ext.dispatcher.ServletFilter</filter-class>
+ <init-param>
+ <param-name>id</param-name>
+ <param-value>INCLUDE_NAMED_FILTER</param-value>
+ </init-param>
+ </filter>
+
+ <filter>
+ <filter-name>RequestURLPatternFilter</filter-name>
+ <filter-class>org.jboss.portal.test.portlet.jsr168.ext.dispatcher.ServletFilter</filter-class>
+ <init-param>
+ <param-name>id</param-name>
+ <param-value>REQUEST_URL_PATTERN_FILTER</param-value>
+ </init-param>
+ </filter>
+
+ <filter>
+ <filter-name>RequestNamedFilter</filter-name>
+ <filter-class>org.jboss.portal.test.portlet.jsr168.ext.dispatcher.ServletFilter</filter-class>
+ <init-param>
+ <param-name>id</param-name>
+ <param-value>REQUEST_NAMED_FILTER</param-value>
+ </init-param>
+ </filter>
+
+ <filter>
+ <filter-name>ForwardURLPatternFilter</filter-name>
+ <filter-class>org.jboss.portal.test.portlet.jsr168.ext.dispatcher.ServletFilter</filter-class>
+ <init-param>
+ <param-name>id</param-name>
+ <param-value>FORWARD_URL_PATTERN_FILTER</param-value>
+ </init-param>
+ </filter>
+
+ <filter>
+ <filter-name>ForwardNamedFilter</filter-name>
+ <filter-class>org.jboss.portal.test.portlet.jsr168.ext.dispatcher.ServletFilter</filter-class>
+ <init-param>
+ <param-name>id</param-name>
+ <param-value>FORWARD_NAMED_FILTER</param-value>
+ </init-param>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>IncludeURLPatternFilter</filter-name>
+ <url-pattern>/noop</url-pattern>
+ <dispatcher>INCLUDE</dispatcher>
+ </filter-mapping>
+
+ <filter-mapping>
+ <filter-name>IncludeNamedFilter</filter-name>
+ <servlet-name>NoopServlet</servlet-name>
+ <dispatcher>INCLUDE</dispatcher>
+ </filter-mapping>
+
+ <filter-mapping>
+ <filter-name>ForwardURLPatternFilter</filter-name>
+ <url-pattern>/noop</url-pattern>
+ <dispatcher>FORWARD</dispatcher>
+ </filter-mapping>
+
+ <filter-mapping>
+ <filter-name>ForwardNamedFilter</filter-name>
+ <servlet-name>NoopServlet</servlet-name>
+ <dispatcher>FORWARD</dispatcher>
+ </filter-mapping>
+
+ <filter-mapping>
+ <filter-name>RequestURLPatternFilter</filter-name>
+ <url-pattern>/noop</url-pattern>
+ <dispatcher>REQUEST</dispatcher>
+ </filter-mapping>
+
+ <filter-mapping>
+ <filter-name>RequestNamedFilter</filter-name>
+ <servlet-name>NoopServlet</servlet-name>
+ <dispatcher>REQUEST</dispatcher>
+ </filter-mapping>
+
<listener>
<listener-class>org.jboss.portal.test.portlet.jsr168.ext.dispatcher.DispatcherSequenceBuilder</listener-class>
</listener>
@@ -36,9 +127,19 @@
<servlet-class>org.jboss.portal.test.portlet.framework.UTS1</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>NoopServlet</servlet-name>
+ <servlet-class>org.jboss.portal.test.portlet.framework.NoopServlet</servlet-class>
+ </servlet>
+
<servlet-mapping>
<servlet-name>UniversalServletA</servlet-name>
<url-pattern>/universalServletA</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>NoopServlet</servlet-name>
+ <url-pattern>/noop</url-pattern>
+ </servlet-mapping>
+
</web-app>
17 years, 7 months
JBoss Portal SVN: r6853 - trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-03-27 13:58:02 -0400 (Tue, 27 Mar 2007)
New Revision: 6853
Modified:
trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml
Log:
- A given RegistrationInfo can be used by several ProducerInfo (this is what happens with the default one). Fixes problem with createConsumer.
Modified: trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml 2007-03-27 17:01:38 UTC (rev 6852)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml 2007-03-27 17:58:02 UTC (rev 6853)
@@ -43,7 +43,6 @@
<many-to-one name="registrationInfo"
column="REGISTRATION_ID"
class="org.jboss.portal.wsrp.consumer.RegistrationInfo"
- unique="true"
not-null="false"
cascade="all"
lazy="false"/>
17 years, 7 months
JBoss Portal SVN: r6852 - trunk/common/src/main/org/jboss/portal/common/net.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-03-27 13:01:38 -0400 (Tue, 27 Mar 2007)
New Revision: 6852
Modified:
trunk/common/src/main/org/jboss/portal/common/net/URLNavigator.java
Log:
- Added visit method without filter parameter for legacy support. (Should fix build).
Modified: trunk/common/src/main/org/jboss/portal/common/net/URLNavigator.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/net/URLNavigator.java 2007-03-27 13:08:36 UTC (rev 6851)
+++ trunk/common/src/main/org/jboss/portal/common/net/URLNavigator.java 2007-03-27 17:01:38 UTC (rev 6852)
@@ -25,8 +25,8 @@
import org.jboss.portal.common.net.file.FileURLNavigationProvider;
import org.jboss.portal.common.net.jar.JarURLNavigationProvider;
+import java.io.IOException;
import java.net.URL;
-import java.io.IOException;
/**
* The URLNavigator class is a registry for various URLNavigationProvider.
@@ -41,12 +41,36 @@
private static final URLNavigationProvider jarNav = new JarURLNavigationProvider();
+ private static final URLFilter NULL_FILTER = new URLFilter()
+ {
+ public boolean acceptFile(URL url)
+ {
+ return true;
+ }
+
+ public boolean acceptDir(URL url)
+ {
+ return true;
+ }
+ };
+
public static void visit(URL url, URLVisitor visitor, URLFilter filter) throws IllegalArgumentException, IOException
{
URLNavigationProvider provider = getProvider(url);
+
+ if (filter == null)
+ {
+ filter = NULL_FILTER;
+ }
+
provider.visit(url, visitor, filter);
}
+ public static void visit(URL url, URLVisitor visitor) throws IOException
+ {
+ visit(url, visitor, null);
+ }
+
/**
* Return an URLNavigationProvider for the specified URL.
*
17 years, 7 months
JBoss Portal SVN: r6851 - trunk/core/src/main/org/jboss/portal/core/impl/model/content/generic.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-03-27 09:08:36 -0400 (Tue, 27 Mar 2007)
New Revision: 6851
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java
Log:
Was caching a bit too much
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java 2007-03-27 12:36:13 UTC (rev 6850)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/content/generic/InternalGenericContentProvider.java 2007-03-27 13:08:36 UTC (rev 6851)
@@ -166,7 +166,7 @@
// Initialize the navigational state with the URI when needed
PortletParametersStateString navigationalState = (PortletParametersStateString)context.getAttribute(RenderWindowCommand.NAVIGATIONAL_STATE_SCOPE, windowId);
- if (navigationalState == null)
+ if (navigationalState == null || !content.getURI().equals(navigationalState.getValue("uri")))
{
navigationalState = new PortletParametersStateString();
17 years, 7 months
JBoss Portal SVN: r6850 - docs/tags.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-27 08:36:13 -0400 (Tue, 27 Mar 2007)
New Revision: 6850
Added:
docs/tags/JBoss_Portal_2_4_2_CR1/
Log:
tagging 2.4.2 CR1
Copied: docs/tags/JBoss_Portal_2_4_2_CR1 (from rev 6849, docs/branches/JBoss_Portal_Branch_2_4)
17 years, 7 months
JBoss Portal SVN: r6849 - docs/tags.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-27 08:35:55 -0400 (Tue, 27 Mar 2007)
New Revision: 6849
Removed:
docs/tags/JBoss_Portal_2_4_2_CR1/
Log:
tagging 2.4.2 CR1
17 years, 7 months
JBoss Portal SVN: r6848 - docs/branches/JBoss_Portal_Branch_2_4/readmeFiles.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-27 08:35:40 -0400 (Tue, 27 Mar 2007)
New Revision: 6848
Modified:
docs/branches/JBoss_Portal_Branch_2_4/readmeFiles/jboss-portal-bin.README
docs/branches/JBoss_Portal_Branch_2_4/readmeFiles/jboss-portal-ha-bin.README
docs/branches/JBoss_Portal_Branch_2_4/readmeFiles/jboss-portal-src.README
Log:
version change for 2.4.2
Modified: docs/branches/JBoss_Portal_Branch_2_4/readmeFiles/jboss-portal-bin.README
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_4/readmeFiles/jboss-portal-bin.README 2007-03-27 12:34:15 UTC (rev 6847)
+++ docs/branches/JBoss_Portal_Branch_2_4/readmeFiles/jboss-portal-bin.README 2007-03-27 12:35:40 UTC (rev 6848)
@@ -1,5 +1,5 @@
- JBoss Portal 2.4.1
+ JBoss Portal 2.4.2
LGPL Licensed (See http://www.gnu.org/copyleft/lesser.html for details on the product usage)
JBoss Portal is the next generation open source content management system (CMS) and portal
Modified: docs/branches/JBoss_Portal_Branch_2_4/readmeFiles/jboss-portal-ha-bin.README
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_4/readmeFiles/jboss-portal-ha-bin.README 2007-03-27 12:34:15 UTC (rev 6847)
+++ docs/branches/JBoss_Portal_Branch_2_4/readmeFiles/jboss-portal-ha-bin.README 2007-03-27 12:35:40 UTC (rev 6848)
@@ -1,5 +1,5 @@
- JBoss Portal 2.4.1
+ JBoss Portal 2.4.2
LGPL Licensed (See http://www.gnu.org/copyleft/lesser.html for details on the product usage)
JBoss Portal is the next generation open source content management system (CMS) and portal
Modified: docs/branches/JBoss_Portal_Branch_2_4/readmeFiles/jboss-portal-src.README
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_4/readmeFiles/jboss-portal-src.README 2007-03-27 12:34:15 UTC (rev 6847)
+++ docs/branches/JBoss_Portal_Branch_2_4/readmeFiles/jboss-portal-src.README 2007-03-27 12:35:40 UTC (rev 6848)
@@ -1,5 +1,5 @@
- JBoss Portal 2.4.1
+ JBoss Portal 2.4.2
LGPL Licensed (See http://www.gnu.org/copyleft/lesser.html for details on the product usage)
JBoss Portal is the next generation open source content management system (CMS) and portal
17 years, 7 months
JBoss Portal SVN: r6847 - tags.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-27 08:34:15 -0400 (Tue, 27 Mar 2007)
New Revision: 6847
Added:
tags/JBoss_Portal_2_4_2_CR1/
Log:
tagging 2.4.2 CR1
Copied: tags/JBoss_Portal_2_4_2_CR1 (from rev 6846, branches/JBoss_Portal_Branch_2_4)
17 years, 7 months
JBoss Portal SVN: r6846 - tags.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-27 08:34:03 -0400 (Tue, 27 Mar 2007)
New Revision: 6846
Removed:
tags/JBoss_Portal_2_4_2_CR1/
Log:
tagging 2.4.2 CR1
17 years, 7 months