Author: julien(a)jboss.com
Date: 2008-01-28 05:22:35 -0500 (Mon, 28 Jan 2008)
New Revision: 9618
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/LifeCyclePhase.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchType.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/ContentServlet.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/ContentTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/DispatchingFilter.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/DispatchingFilterTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/FiltersTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/GetRequestURITestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/RequestHeaderAccessTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/ServletFilter.java
modules/portlet/trunk/test/src/test/resources/jsr286/ext/dispatcher-war/
modules/portlet/trunk/test/src/test/resources/jsr286/ext/dispatcher-war/WEB-INF/
modules/portlet/trunk/test/src/test/resources/jsr286/ext/dispatcher-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/jsr286/ext/dispatcher-war/WEB-INF/web.xml
modules/portlet/trunk/test/src/test/resources/jsr286/ext/dispatcher-war/dispatchedFromFilter.jsp
Removed:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/dispatcher/
modules/portlet/trunk/test/src/test/resources/jsr168/ext/dispatcher-war/
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java
modules/portlet/trunk/test/src/test/build.xml
modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml
Log:
- moved ext dispatcher test to 286 (since it is ext)
- started to add forward implemenation and test cases
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/LifeCyclePhase.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/LifeCyclePhase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/LifeCyclePhase.java 2008-01-28
10:22:35 UTC (rev 9618)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * 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;
+
+/**
+ * Enumerate the life cycle phase of a Portlet.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public enum LifeCyclePhase
+{
+ ACTION, EVENT, RENDER, RESOURCE
+}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchType.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchType.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchType.java 2008-01-28
10:22:35 UTC (rev 9618)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * 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;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public enum DispatchType
+{
+
+ INCLUDE, FORWARD
+
+}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java 2008-01-27
13:39:31 UTC (rev 9617)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java 2008-01-28
10:22:35 UTC (rev 9618)
@@ -48,18 +48,35 @@
public class DispatchedHttpServletRequest extends HttpServletRequestWrapper
{
+ /** . */
private static final String REQUEST_URI =
"javax.servlet.include.request_uri";
+
+ /** . */
private static final String CONTEXT_PATH =
"javax.servlet.include.context_path";
+
+ /** . */
private static final String SERVLET_PATH =
"javax.servlet.include.servlet_path";
+
+ /** . */
private static final String PATH_INFO = "javax.servlet.include.path_info";
+
+ /** . */
private static final String QUERY_STRING =
"javax.servlet.include.query_string";
+ /** . */
+ final DispatchType dispatchType;
+
+ /** . */
private RenderRequestImpl rreq;
+
+ /** . */
private HttpServletRequest dreq;
- private final Map parameters;
+ /** . */
+ private final Map<String, String[]> parameters;
public DispatchedHttpServletRequest(
+ DispatchType dispatchType,
RenderRequestImpl rreq,
HttpServletRequest dreq,
String path)
@@ -67,6 +84,7 @@
super(dreq);
//
+ this.dispatchType = dispatchType;
this.rreq = rreq;
this.dreq = dreq;
@@ -75,6 +93,7 @@
{
String queryString;
+ //
int endOfServletPath = path.indexOf('/', 1);
if (endOfServletPath == -1)
{
@@ -314,7 +333,7 @@
}
//
- String[] values = (String[])parameters.get(name);
+ String[] values = parameters.get(name);
if (values != null)
{
return values[0];
@@ -337,10 +356,10 @@
}
//
- String[] values = (String[])parameters.get(name);
+ String[] values = parameters.get(name);
if (values != null)
{
- return (String[])values.clone();
+ return values.clone();
}
//
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java 2008-01-27
13:39:31 UTC (rev 9617)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java 2008-01-28
10:22:35 UTC (rev 9618)
@@ -39,12 +39,38 @@
public class DispatchedHttpServletResponse extends HttpServletResponseWrapper
{
+ /** . */
+ DispatchedHttpServletRequest req;
+
+ /** . */
private RenderResponse rresp;
+
+ /** . */
private ServletOutputStream sos;
- public DispatchedHttpServletResponse(RenderResponse rresp, HttpServletResponse dresp)
+ public DispatchedHttpServletResponse(
+ DispatchedHttpServletRequest req,
+ RenderResponse rresp,
+ HttpServletResponse dresp)
{
super(dresp);
+
+ //
+// switch (req.dispatchType)
+// {
+// case INCLUDE:
+// break;
+// case FORWARD:
+//
+// // Discard existing content
+// rresp.reset();
+//
+// //
+// break;
+// }
+
+ //
+ this.req = req;
this.rresp = rresp;
this.sos = null;
}
@@ -104,7 +130,8 @@
{
sos = new ServletOutputStream()
{
- private OutputStream out = rresp.getPortletOutputStream();
+ /** . */
+ private final OutputStream out = rresp.getPortletOutputStream();
public void write(byte b[], int off, int len) throws IOException
{
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java 2008-01-27
13:39:31 UTC (rev 9617)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java 2008-01-28
10:22:35 UTC (rev 9618)
@@ -27,6 +27,8 @@
import org.jboss.portal.portlet.impl.jsr168.APIConstants;
import org.jboss.portal.portlet.impl.jsr168.DispatchedHttpServletRequest;
import org.jboss.portal.portlet.impl.jsr168.DispatchedHttpServletResponse;
+import org.jboss.portal.portlet.impl.jsr168.DispatchType;
+import org.jboss.portal.portlet.LifeCyclePhase;
import org.jboss.portal.common.NotYetImplemented;
import javax.portlet.PortletException;
@@ -35,6 +37,9 @@
import javax.portlet.RenderResponse;
import javax.portlet.PortletRequest;
import javax.portlet.PortletResponse;
+import javax.portlet.ActionRequest;
+import javax.portlet.EventRequest;
+import javax.portlet.ResourceRequest;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -68,6 +73,42 @@
public void include(RenderRequest req, RenderResponse resp) throws PortletException,
IOException
{
+ dispatch(DispatchType.INCLUDE, req, resp);
+ }
+
+ public void include(PortletRequest req, PortletResponse resp) throws PortletException,
IOException
+ {
+ dispatch(DispatchType.INCLUDE, req, resp);
+ }
+
+ public void forward(PortletRequest req, PortletResponse resp) throws PortletException,
IOException, IllegalStateException
+ {
+ dispatch(DispatchType.FORWARD, req, resp);
+ }
+
+ private void dispatch(
+ DispatchType type,
+ PortletRequest req,
+ PortletResponse resp) throws PortletException, IOException
+ {
+ LifeCyclePhase phase;
+ if (req instanceof ActionRequest)
+ {
+ phase = LifeCyclePhase.ACTION;
+ }
+ else if (req instanceof EventRequest)
+ {
+ phase = LifeCyclePhase.EVENT;
+ }
+ else if (req instanceof RenderRequest)
+ {
+ phase = LifeCyclePhase.RENDER;
+ }
+ else if (req instanceof ResourceRequest)
+ {
+ phase = LifeCyclePhase.RESOURCE;
+ }
+
try
{
// Get the invocation that is still in the request
@@ -77,16 +118,20 @@
HttpServletRequest dreq = invocation.getDispatchedRequest();
HttpServletResponse dresp = invocation.getDispatchedResponse();
- // It was set by the PortletContainerInvoker before diving into the portlet, so
let's just reuse them
- RenderRequest rreq =
(RenderRequest)req.getAttribute(APIConstants.JAVAX_PORTLET_REQUEST);
- RenderResponse rresp =
(RenderResponse)req.getAttribute(APIConstants.JAVAX_PORTLET_RESPONSE);
-
//
- DispatchedHttpServletRequest direq = new
DispatchedHttpServletRequest((RenderRequestImpl)rreq, dreq, path);
- DispatchedHttpServletResponse diresp = new DispatchedHttpServletResponse(rresp,
dresp);
+ DispatchedHttpServletRequest direq = new DispatchedHttpServletRequest(type,
(RenderRequestImpl)req, dreq, path);
+ DispatchedHttpServletResponse diresp = new DispatchedHttpServletResponse(direq,
(RenderResponse)resp, dresp);
//
- dispatcher.include(direq, diresp);
+ switch (type)
+ {
+ case INCLUDE:
+ dispatcher.include(direq, diresp);
+ break;
+ case FORWARD:
+ dispatcher.forward(direq, diresp);
+ break;
+ }
}
catch (ServletException e)
{
@@ -94,14 +139,4 @@
throw new PortletException(e);
}
}
-
- public void include(PortletRequest portletRequest, PortletResponse portletResponse)
throws PortletException, IOException
- {
- throw new NotYetImplemented();
- }
-
- public void forward(PortletRequest portletRequest, PortletResponse portletResponse)
throws PortletException, IOException, IllegalStateException
- {
- throw new NotYetImplemented();
- }
}
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/ContentServlet.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/ContentServlet.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/ContentServlet.java 2008-01-28
10:22:35 UTC (rev 9618)
@@ -0,0 +1,51 @@
+/******************************************************************************
+ * 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.ext.dispatcher;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ContentServlet extends HttpServlet
+{
+
+ /** . */
+ public static final ThreadLocal<String> value = new
ThreadLocal<String>();
+
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws
ServletException, IOException
+ {
+ PrintWriter writer = resp.getWriter();
+ String s = value.get();
+ if (s != null)
+ {
+ writer.print(value.get());
+ }
+ }
+}
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/ContentTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/ContentTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/ContentTestCase.java 2008-01-28
10:22:35 UTC (rev 9618)
@@ -0,0 +1,111 @@
+/******************************************************************************
+ * 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.ext.dispatcher;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP4;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.*;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class ContentTestCase
+{
+ public ContentTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP4.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ response.setContentType("text/html");
+ PrintWriter writer = response.getWriter();
+ writer.print("@ShouldNotBePresent@");
+
+ //
+ PortletRequestDispatcher prd =
request.getPortletSession().getPortletContext().getRequestDispatcher("/ForwardedRequestContentServlet");
+ assertNotNull(prd);
+ ContentServlet.value.set("@ForwardedRequestContent@");
+ prd.forward(request, response);
+
+ //
+ assertTrue(response.isCommitted());
+
+ //
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+ seq.bindAction(1, UTP4.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ byte[] bytes = context.getResponseBody();
+ String s = new String(bytes);
+ assertFalse("Page " + s + " should not contain the string
@ShouldNotBePresent@", s.contains("@ShouldNotBePresent@"));
+ assertTrue("Page " + s + " should contain the string
@ForwardedRequestContent@", s.contains("@ForwardedRequestContent@"));
+
+ //
+ response.setContentType("text/html");
+ PrintWriter writer = response.getWriter();
+ writer.print("@ShouldNotBePresent@");
+
+ //
+ PortletRequestDispatcher prd =
request.getPortletSession().getPortletContext().getRequestDispatcher("/NamedRequestContentServlet");
+ assertNotNull(prd);
+ ContentServlet.value.set("@NamedRequestContent@");
+ prd.forward(request, response);
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ seq.bindAction(1, UTP4.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ byte[] bytes = context.getResponseBody();
+ String s = new String(bytes);
+ assertFalse("Page " + s + " should not contain the string
@ShouldNotBePresent@", s.contains("@ShouldNotBePresent@"));
+ assertTrue("Page " + s + " should contain the string
@NamedRequestContent@", s.contains("@NamedRequestContent@"));
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/DispatchingFilter.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/DispatchingFilter.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/DispatchingFilter.java 2008-01-28
10:22:35 UTC (rev 9618)
@@ -0,0 +1,67 @@
+/******************************************************************************
+ * 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.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 javax.servlet.RequestDispatcher;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class DispatchingFilter implements Filter
+{
+
+ private FilterConfig cfg;
+
+ public void init(FilterConfig cfg) throws ServletException
+ {
+ this.cfg = cfg;
+ }
+
+ public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain)
throws IOException, ServletException
+ {
+
+ System.out.println("In the CHAIN " + cfg.getFilterName());
+ System.out.println("In the CHAIN " + cfg.getFilterName());
+ System.out.println("In the CHAIN " + cfg.getFilterName());
+ System.out.println("In the CHAIN " + cfg.getFilterName());
+ System.out.println("In the CHAIN " + cfg.getFilterName());
+ System.out.println("In the CHAIN " + cfg.getFilterName());
+
+ RequestDispatcher rd =
cfg.getServletContext().getRequestDispatcher("/dispatchedFromFilter.jsp");
+ rd.include(req, resp);
+
+ }
+
+ public void destroy()
+ {
+ this.cfg = null;
+ }
+}
\ No newline at end of file
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/DispatchingFilterTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/DispatchingFilterTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/DispatchingFilterTestCase.java 2008-01-28
10:22:35 UTC (rev 9618)
@@ -0,0 +1,73 @@
+/******************************************************************************
+ * 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.ext.dispatcher;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP3;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.assertNotNull;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+@TestCase
+public class DispatchingFilterTestCase
+{
+ public DispatchingFilterTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP3.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+
+ // Need to set content type as we will include a JSP that will produce
output
+ response.setContentType("text/html");
+
+ //
+ PortletRequestDispatcher prd =
request.getPortletSession().getPortletContext().getNamedDispatcher("TargetForIncludeNamedDispatchingFilter");
+ assertNotNull(prd);
+ prd.include(request, response);
+
+ //
+ prd =
request.getPortletSession().getPortletContext().getRequestDispatcher("/TargetForIncludeURLPatternDispatchingFilter");
+ assertNotNull(prd);
+ prd.include(request, response);
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
\ No newline at end of file
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/FiltersTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/FiltersTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/FiltersTestCase.java 2008-01-28
10:22:35 UTC (rev 9618)
@@ -0,0 +1,89 @@
+/******************************************************************************
+ * 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.ext.dispatcher;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP2;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.assertNotNull;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import java.io.IOException;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+@TestCase
+public class FiltersTestCase
+{
+ public FiltersTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP2.RENDER_JOIN_POINT, 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(Tools.toSet("INCLUDE_URL_PATTERN_FILTER",
"INCLUDE_NAMED_FILTER"), 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);
+
+ //
+ prd =
request.getPortletSession().getPortletContext().getRequestDispatcher("/noop");
+ assertNotNull(prd);
+ ServletFilter.ids.clear();
+ prd.forward(request, response);
+ assertEquals(Tools.toSet("FORWARD_URL_PATTERN_FILTER",
"FORWARD_NAMED_FILTER"), ServletFilter.ids);
+
+ //
+ prd =
request.getPortletSession().getPortletContext().getNamedDispatcher("NoopServlet");
+ assertNotNull(prd);
+ ServletFilter.ids.clear();
+ prd.forward(request, response);
+ assertEquals(Collections.singleton("FORWARD_NAMED_FILTER"),
ServletFilter.ids);
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ }
+}
\ No newline at end of file
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/GetRequestURITestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/GetRequestURITestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/GetRequestURITestCase.java 2008-01-28
10:22:35 UTC (rev 9618)
@@ -0,0 +1,81 @@
+/******************************************************************************
+ * 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.ext.dispatcher;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.unit.actions.ServletServiceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTS1;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+@TestCase
+public class GetRequestURITestCase
+{
+
+ public static final String SERVLET_A_URI =
"/test-jsr286-ext-dispatcher/universalServletA";
+
+ public GetRequestURITestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ PortletRequestDispatcher dispatcher =
((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/universalServletA");
+ response.setContentType("text/html");
+ dispatcher.include(request, response);
+ return null;
+ }
+ });
+
+
+ seq.bindAction(0, UTS1.SERVICE_JOIN_POINT, new ServletServiceTestAction()
+ {
+ protected DriverResponse run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context) throws ServletException,
IOException
+ {
+ assertEquals(SERVLET_A_URI, request.getRequestURI());
+ return new EndTestResponse();
+ }
+ });
+ }
+}
\ No newline at end of file
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/RequestHeaderAccessTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/RequestHeaderAccessTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/RequestHeaderAccessTestCase.java 2008-01-28
10:22:35 UTC (rev 9618)
@@ -0,0 +1,107 @@
+/******************************************************************************
+ * 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.ext.dispatcher;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.unit.actions.ServletServiceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTS1;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.assertFalse;
+import static org.jboss.unit.api.Assert.assertNull;
+import static org.jboss.unit.api.Assert.assertTrue;
+import static org.jboss.unit.api.Assert.assertEquals;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Set;
+import java.util.Enumeration;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+@TestCase
+public class RequestHeaderAccessTestCase
+{
+ public RequestHeaderAccessTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context)
+ {
+ // Test the value is not there yet
+ Set propertyNames = Tools.toSet(request.getPropertyNames());
+ assertFalse(propertyNames.contains("myheader"));
+ assertNull(request.getProperty("myheader"));
+ assertFalse(request.getProperties("myheader").hasMoreElements());
+
+ // Invoke render with header
+ InvokeGetResponse render = new
InvokeGetResponse(response.createRenderURL().toString());
+ render.addHeader("myheader").addElement("render-value");
+ return render;
+ }
+ });
+
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ PortletRequestDispatcher dispatcher =
((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/universalServletA");
+ response.setContentType("text/html");
+ dispatcher.include(request, response);
+ return null;
+ }
+ });
+
+ seq.bindAction(1, UTS1.SERVICE_JOIN_POINT, new ServletServiceTestAction()
+ {
+ protected DriverResponse run(Servlet servlet, HttpServletRequest request,
HttpServletResponse response, PortletTestContext context)
+ {
+ // Test the header is here
+ Set headerNames = Tools.toSet(request.getHeaderNames());
+ assertTrue(headerNames.contains("myheader"));
+ assertEquals("render-value",
request.getHeader("myheader"));
+ Enumeration values = request.getHeaders("myheader");
+ assertTrue(values.hasMoreElements());
+ assertEquals("render-value", values.nextElement());
+ assertFalse(values.hasMoreElements());
+ return new EndTestResponse();
+ }
+ });
+ }
+}
\ No newline at end of file
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/ServletFilter.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/ServletFilter.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/ServletFilter.java 2008-01-28
10:22:35 UTC (rev 9618)
@@ -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.jsr286.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;
+ }
+}
\ No newline at end of file
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-27
13:39:31 UTC (rev 9617)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java 2008-01-28
10:22:35 UTC (rev 9618)
@@ -739,9 +739,16 @@
writer.print("<body>");
for (FragmentResponse fragment : fragments)
{
- writer.print("<div>");
- // Do something with fragment
- writer.print("</div>");
+ if (fragment.getType() != FragmentResponse.TYPE_EMPTY)
+ {
+ writer.print("<div id=\"portlet\">");
+ writer.print(fragment.getContent());
+ writer.print("</div>");
+ }
+ else
+ {
+ writer.print("<div/>");
+ }
}
writer.print("</body></html>");
}
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-01-27 13:39:31 UTC (rev 9617)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-01-28 10:22:35 UTC (rev 9618)
@@ -233,7 +233,6 @@
<package-ext-test test="portletrequests"/>
<package-ext-test test="portletmode"/>
<package-ext-test test="portletconfig"/>
- <package-ext-test test="dispatcher"/>
<package-ext-test test="taglib"/>
<package-misc-test test="log4j"/>
@@ -250,6 +249,7 @@
<package-jsr286-ext-test test="portletrequests"/>
<package-jsr286-ext-test test="portletresponses"/>
+ <package-jsr286-ext-test test="dispatcher"/>
<jar jarfile="${test.temp.lib}/portlet-test-lib.jar">
<fileset dir="${target}/test-classes"/>
Added:
modules/portlet/trunk/test/src/test/resources/jsr286/ext/dispatcher-war/WEB-INF/portlet.xml
===================================================================
---
modules/portlet/trunk/test/src/test/resources/jsr286/ext/dispatcher-war/WEB-INF/portlet.xml
(rev 0)
+++
modules/portlet/trunk/test/src/test/resources/jsr286/ext/dispatcher-war/WEB-INF/portlet.xml 2008-01-28
10:22:35 UTC (rev 9618)
@@ -0,0 +1,75 @@
+<?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_1_0.xsd"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1...
http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0">
+
+
+ <portlet>
+ <portlet-name>TestUniversalPortletA</portlet-name>
+
<portlet-class>org.jboss.portal.test.portlet.framework.UTP1</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </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>
+ <portlet-name>TestUniversalPortletC</portlet-name>
+
<portlet-class>org.jboss.portal.test.portlet.framework.UTP3</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
+ <portlet-name>TestUniversalPortletD</portlet-name>
+
<portlet-class>org.jboss.portal.test.portlet.framework.UTP4</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ </supports>
+ <portlet-info>
+ <title></title>
+ </portlet-info>
+ </portlet>
+
+</portlet-app>
Added:
modules/portlet/trunk/test/src/test/resources/jsr286/ext/dispatcher-war/WEB-INF/web.xml
===================================================================
---
modules/portlet/trunk/test/src/test/resources/jsr286/ext/dispatcher-war/WEB-INF/web.xml
(rev 0)
+++
modules/portlet/trunk/test/src/test/resources/jsr286/ext/dispatcher-war/WEB-INF/web.xml 2008-01-28
10:22:35 UTC (rev 9618)
@@ -0,0 +1,210 @@
+<?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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<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.jsr286.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.jsr286.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.jsr286.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.jsr286.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.jsr286.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.jsr286.ext.dispatcher.ServletFilter</filter-class>
+ <init-param>
+ <param-name>id</param-name>
+ <param-value>FORWARD_NAMED_FILTER</param-value>
+ </init-param>
+ </filter>
+
+ <filter>
+ <filter-name>IncludeNamedJSPDispatchingFilter</filter-name>
+
<filter-class>org.jboss.portal.test.portlet.jsr286.ext.dispatcher.DispatchingFilter</filter-class>
+ <init-param>
+ <param-name>id</param-name>
+ <param-value>INCLUDE_NAMED_FILTER</param-value>
+ </init-param>
+ </filter>
+
+ <filter>
+ <filter-name>IncludeURLPatternJSPDispatchingFilter</filter-name>
+
<filter-class>org.jboss.portal.test.portlet.jsr286.ext.dispatcher.DispatchingFilter</filter-class>
+ <init-param>
+ <param-name>id</param-name>
+ <param-value>INCLUDE_URL_PATTERN_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>
+
+ <filter-mapping>
+ <filter-name>IncludeNamedJSPDispatchingFilter</filter-name>
+ <servlet-name>TargetForIncludeNamedDispatchingFilter</servlet-name>
+ <dispatcher>INCLUDE</dispatcher>
+ </filter-mapping>
+
+ <filter-mapping>
+ <filter-name>IncludeURLPatternJSPDispatchingFilter</filter-name>
+
<url-pattern>/TargetForIncludeURLPatternDispatchingFilter</url-pattern>
+ <dispatcher>INCLUDE</dispatcher>
+ </filter-mapping>
+
+ <listener>
+
<listener-class>org.jboss.portal.unit.PortletTestSuite</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>UniversalServletA</servlet-name>
+
<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>
+ <servlet-name>TargetForIncludeNamedDispatchingFilter</servlet-name>
+
<servlet-class>org.jboss.portal.test.portlet.framework.NoopServlet</servlet-class>
+ </servlet>
+
+ <servlet>
+
<servlet-name>TargetForIncludeURLPatternDispatchingFilter</servlet-name>
+
<servlet-class>org.jboss.portal.test.portlet.framework.NoopServlet</servlet-class>
+ </servlet>
+
+ <servlet>
+ <servlet-name>ForwardedRequestContentServlet</servlet-name>
+
<servlet-class>org.jboss.portal.test.portlet.jsr286.ext.dispatcher.ContentServlet</servlet-class>
+ </servlet>
+
+ <servlet>
+ <servlet-name>ForwardedNamedContentServlet</servlet-name>
+
<servlet-class>org.jboss.portal.test.portlet.jsr286.ext.dispatcher.ContentServlet</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>
+
+ <servlet-mapping>
+
<servlet-name>TargetForIncludeURLPatternDispatchingFilter</servlet-name>
+
<url-pattern>/TargetForIncludeURLPatternDispatchingFilter</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>ForwardedRequestContentServlet</servlet-name>
+ <url-pattern>/ForwardedRequestContentServlet</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>ForwardedNamedContentServlet</servlet-name>
+ <url-pattern>/ForwardedNamedContentServlet</url-pattern>
+ </servlet-mapping>
+
+</web-app>
Added:
modules/portlet/trunk/test/src/test/resources/jsr286/ext/dispatcher-war/dispatchedFromFilter.jsp
===================================================================
---
modules/portlet/trunk/test/src/test/resources/jsr286/ext/dispatcher-war/dispatchedFromFilter.jsp
(rev 0)
+++
modules/portlet/trunk/test/src/test/resources/jsr286/ext/dispatcher-war/dispatchedFromFilter.jsp 2008-01-28
10:22:35 UTC (rev 9618)
@@ -0,0 +1,8 @@
+<%@ page language="java" %>
+
+<%
+ System.out.println("HELLO FROM JSP");
+ System.out.println("HELLO FROM JSP");
+ System.out.println("HELLO FROM JSP");
+ System.out.println("HELLO FROM JSP");
+%>
\ No newline at end of file
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-27
13:39:31 UTC (rev 9617)
+++ modules/portlet/trunk/test/src/test/resources/test/remote-jboss-unit.xml 2008-01-28
10:22:35 UTC (rev 9618)
@@ -107,10 +107,6 @@
<!--Ext Tests-->
<generic>
<class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
- <property name="archiveId"
value="test-jsr168-ext-dispatcher.war"/>
- </generic>
- <generic>
- <class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId"
value="test-jsr168-ext-portletconfig.war"/>
</generic>
<generic>
@@ -195,6 +191,10 @@
<class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
<property name="archiveId"
value="test-jsr286-ext-portletresponses.war"/>
</generic>
+ <generic>
+ <class
name="org.jboss.unit.remote.driver.RemoteTestDriverClient"/>
+ <property name="archiveId"
value="test-jsr286-ext-dispatcher.war"/>
+ </generic>
<!--Misc Tests-->
<!--