Author: julien(a)jboss.com
Date: 2008-01-30 13:36:14 -0500 (Wed, 30 Jan 2008)
New Revision: 9657
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/Dispatch.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/RequestDispatcherImpl.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NFRFContainerAttributesTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NFRIContainerAttributesTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NIRFContainerAttributesTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NIRIContainerAttributesTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RFRFContainerAttributesTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RFRIContainerAttributesTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RIRFContainerAttributesTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RIRIContainerAttributesTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestForwardHopServlet.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestIncludeHopServlet.java
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/api/PortletRequestDispatcherImpl.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/DispatchedContainerAttributesTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NamedForwardContainerAttributesTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NamedIncludeContainerAttributesTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestForwardContainerAttributesTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestIncludeContainerAttributesTestCase.java
modules/portlet/trunk/test/src/test/resources/jsr286/tck/dispatcher-war/WEB-INF/web.xml
Log:
- merged stuff with Bolek and make a few of his test case not pass anymore (will fix
after)
- implemented double request dispatch
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/Dispatch.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/Dispatch.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/Dispatch.java 2008-01-30
18:36:14 UTC (rev 9657)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * 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 class Dispatch
+{
+
+ /** . */
+ private final DispatchType type;
+
+ /** . */
+ private final String path;
+
+ public Dispatch(DispatchType type, String path)
+ {
+ this.type = type;
+ this.path = path;
+ }
+
+ public DispatchType getType()
+ {
+ return type;
+ }
+
+ public String getPath()
+ {
+ return path;
+ }
+}
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-30
18:33:53 UTC (rev 9656)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java 2008-01-30
18:36:14 UTC (rev 9657)
@@ -46,6 +46,7 @@
import java.util.HashMap;
import java.util.Collections;
import java.util.Iterator;
+import java.util.LinkedList;
import java.io.UnsupportedEncodingException;
import java.io.IOException;
import java.io.BufferedReader;
@@ -91,7 +92,7 @@
"javax.servlet.forward.context_path"
};
- /** . */
+ /** The initial dispatch. */
final DispatchType dispatchType;
/** . */
@@ -107,95 +108,49 @@
private final String[] containerKeys;
/** . */
- private final Map<String, String> containerAttrs;
+ private final int sessionScope = PortletSession.APPLICATION_SCOPE;
/** . */
- private final int sessionScope = PortletSession.APPLICATION_SCOPE;
+ private final LinkedList<Map<String, String>> containerAttributeStack;
+ /** . */
+ private final LinkedList<Dispatch> dispatchStack;
+
public DispatchedHttpServletRequest(
- DispatchType dispatchType,
+ Dispatch dispatch,
PortletRequestImpl preq,
- HttpServletRequest dreq,
- String path)
+ HttpServletRequest dreq)
{
super(dreq);
//
- this.dispatchType = dispatchType;
+ this.dispatchType = dispatch.getType();
this.preq = preq;
this.dreq = dreq;
this.containerKeys = dispatchType == DispatchType.INCLUDE ? INCLUDE_KEYS :
FORWARD_KEYS;
+ this.containerAttributeStack = new LinkedList<Map<String, String>>();
+ this.dispatchStack = new LinkedList<Dispatch>();
+ // Push dispatch
+ pushDispatch(dispatch);
+
//
- if (path != null)
+ String queryString =
containerAttributeStack.getLast().get(containerKeys[QUERY_STRING]);
+ Map<String, String[]> parameters;
+ if (queryString != null && queryString.length() > 0)
{
- String servletPath;
- String pathInfo;
- String queryString;
- int endOfServletPath = path.indexOf('/', 1);
- if (endOfServletPath == -1)
- {
- endOfServletPath = path.indexOf('?', 1);
- if (endOfServletPath == -1)
- {
- servletPath = path;
- pathInfo = null;
- queryString = "";
- }
- else
- {
- servletPath = path.substring(0, endOfServletPath);
- pathInfo = null;
- queryString = path.substring(endOfServletPath + 1);
- }
- }
- else
- {
- servletPath = path.substring(0, endOfServletPath);
- int endOfPathInfo = path.indexOf('?', endOfServletPath + 1);
- if (endOfPathInfo == -1)
- {
- pathInfo = path.substring(endOfServletPath);
- queryString = "";
- }
- else
- {
- pathInfo = path.substring(endOfServletPath, endOfPathInfo);
- queryString = path.substring(endOfPathInfo + 1);
- }
- }
- String requestURI = preq.getContextPath() + servletPath + (pathInfo != null ?
pathInfo : "");
-
- //
- Map<String, String> attrs = new HashMap<String, String>();
- attrs.put(containerKeys[SERVLET_PATH], servletPath);
- attrs.put(containerKeys[PATH_INFO], pathInfo);
- attrs.put(containerKeys[QUERY_STRING], queryString);
- attrs.put(containerKeys[REQUEST_URI], requestURI);
- attrs.put(containerKeys[CONTEXT_PATH], preq.getContextPath());
-
- //
- if (queryString.length() > 0)
- {
- ParameterMap tmp = new ParameterMap();
- tmp.putAll(QueryStringParser.getInstance().parseQueryString(queryString));
- tmp.append(preq.getParameterMap());
-
- //
- this.containerAttrs = attrs;
- this.parameters = tmp;
- }
- else
- {
- this.containerAttrs = Collections.emptyMap();
- this.parameters = preq.getParameterMap();
- }
+ ParameterMap tmp = new ParameterMap();
+ tmp.putAll(QueryStringParser.getInstance().parseQueryString(queryString));
+ tmp.append(preq.getParameterMap());
+ parameters = tmp;
}
else
{
- this.containerAttrs = Collections.emptyMap();
- this.parameters = preq.getParameterMap();
+ parameters = preq.getParameterMap();
}
+
+ //
+ this.parameters = parameters;
}
// Must return null
@@ -288,9 +243,12 @@
public final Object getAttribute(String s)
{
- if (containerAttrs.containsKey(s))
+ Map<String, String> containerAttributes = getCurrentContainerAttributes();
+
+ //
+ if (containerAttributes.containsKey(s))
{
- return containerAttrs.get(s);
+ return containerAttributes.get(s);
}
//
@@ -299,6 +257,7 @@
public final Enumeration getAttributeNames()
{
+ final Map<String, String> containerAttributes =
getCurrentContainerAttributes();
final Iterator<String> i =
preq.getAttributes().getAttributeNames((HttpServletRequest)getRequest());
//
@@ -331,7 +290,7 @@
if (i.hasNext())
{
String next = i.next();
- if (!containerAttrs.containsKey(next))
+ if (!containerAttributes.containsKey(next))
{
this.next = next;
break;
@@ -348,7 +307,10 @@
public final void setAttribute(String s, Object o)
{
- if (s != null && !containerAttrs.containsKey(s))
+ Map<String, String> containerAttributes = getCurrentContainerAttributes();
+
+ //
+ if (s != null && !containerAttributes.containsKey(s))
{
preq.getAttributes().setAttribute(s, o);
}
@@ -356,7 +318,10 @@
public final void removeAttribute(String s)
{
- if (s != null && !containerAttrs.containsKey(s))
+ Map<String, String> containerAttributes = getCurrentContainerAttributes();
+
+ //
+ if (s != null && !containerAttributes.containsKey(s))
{
preq.getAttributes().removeAttribute(s);
}
@@ -507,7 +472,7 @@
public final RequestDispatcher getRequestDispatcher(String s)
{
- return dreq.getRequestDispatcher(s);
+ return new RequestDispatcherImpl(dreq.getRequestDispatcher(s), s);
}
public final boolean isUserInRole(String s)
@@ -540,13 +505,97 @@
return isRequestedSessionIdFromURL();
}
- // The getProtocol method of the HttpServletRequest must always return �HTTP/1.1�
+ // The getProtocol method of the HttpServletRequest must always return ‘HTTP/1.1’
public final String getProtocol()
{
return "HTTP/1.1";
}
+ void pushDispatch(Dispatch dispatch)
+ {
+ String path = dispatch.getPath();
+ Map<String, String> attrs;
+ if (path != null)
+ {
+ String servletPath;
+ String pathInfo;
+ String queryString;
+ int endOfServletPath = path.indexOf('/', 1);
+ if (endOfServletPath == -1)
+ {
+ endOfServletPath = path.indexOf('?', 1);
+ if (endOfServletPath == -1)
+ {
+ servletPath = path;
+ pathInfo = null;
+ queryString = "";
+ }
+ else
+ {
+ servletPath = path.substring(0, endOfServletPath);
+ pathInfo = "";
+ queryString = path.substring(endOfServletPath + 1);
+ }
+ }
+ else
+ {
+ servletPath = path.substring(0, endOfServletPath);
+ int endOfPathInfo = path.indexOf('?', endOfServletPath + 1);
+ if (endOfPathInfo == -1)
+ {
+ pathInfo = path.substring(endOfServletPath);
+ queryString = "";
+ }
+ else
+ {
+ pathInfo = path.substring(endOfServletPath, endOfPathInfo);
+ queryString = path.substring(endOfPathInfo + 1);
+ }
+ }
+ String requestURI = preq.getContextPath() + servletPath + (pathInfo != null ?
pathInfo : "");
+
+ //
+ attrs = new HashMap<String, String>();
+ attrs.put(containerKeys[SERVLET_PATH], servletPath);
+ attrs.put(containerKeys[PATH_INFO], pathInfo);
+ attrs.put(containerKeys[QUERY_STRING], queryString);
+ attrs.put(containerKeys[REQUEST_URI], requestURI);
+ attrs.put(containerKeys[CONTEXT_PATH], preq.getContextPath());
+ }
+ else
+ {
+ attrs = Collections.emptyMap();
+ }
+
+ //
+ containerAttributeStack.addLast(attrs);
+ dispatchStack.addLast(dispatch);
+ }
+
+ void popDispatch()
+ {
+ containerAttributeStack.removeLast();
+ dispatchStack.removeLast();
+ }
+
+ private Map<String, String> getCurrentContainerAttributes()
+ {
+ Dispatch dispatch = dispatchStack.getLast();
+
+ //
+ if (dispatch.getType() == DispatchType.INCLUDE)
+ {
+ return containerAttributeStack.getLast();
+ }
+ else
+ {
+ return containerAttributeStack.getFirst();
+ }
+ }
+
+ // Subclasses
+
public static abstract class ClientData extends DispatchedHttpServletRequest
{
@@ -556,9 +605,9 @@
/** . */
private final ClientDataRequestImpl cdreq;
- public ClientData(DispatchType dispatchType, ClientDataRequestImpl cdreq,
HttpServletRequest dreq, String path)
+ public ClientData(Dispatch dispatch, ClientDataRequestImpl cdreq,
HttpServletRequest dreq)
{
- super(dispatchType, cdreq, dreq, path);
+ super(dispatch, cdreq, dreq);
//
this.cdreq = cdreq;
@@ -624,26 +673,26 @@
public static final class Action extends ClientData
{
- public Action(DispatchType dispatchType, ActionRequestImpl areq, HttpServletRequest
dreq, String path)
+ public Action(Dispatch dispatch, ActionRequestImpl areq, HttpServletRequest dreq)
{
- super(dispatchType, areq, dreq, path);
+ super(dispatch, areq, dreq);
}
}
public static final class Resource extends ClientData
{
- public Resource(DispatchType dispatchType, ResourceRequestImpl rreq,
HttpServletRequest dreq, String path)
+ public Resource(Dispatch dispatch, ResourceRequestImpl rreq, HttpServletRequest
dreq)
{
- super(dispatchType, rreq, dreq, path);
+ super(dispatch, rreq, dreq);
}
}
public static abstract class Mime extends DispatchedHttpServletRequest
{
- public Mime(DispatchType dispatchType, PortletRequestImpl preq, HttpServletRequest
dreq, String path)
+ public Mime(Dispatch dispatch, PortletRequestImpl preq, HttpServletRequest dreq)
{
- super(dispatchType, preq, dreq, path);
+ super(dispatch, preq, dreq);
}
public final String getCharacterEncoding()
@@ -682,9 +731,9 @@
/** . */
private final EventRequestImpl ereq;
- public Event(DispatchType dispatchType, EventRequestImpl ereq, HttpServletRequest
dreq, String path)
+ public Event(Dispatch dispatch, EventRequestImpl ereq, HttpServletRequest dreq)
{
- super(dispatchType, ereq, dreq, path);
+ super(dispatch, ereq, dreq);
//
this.ereq = ereq;
@@ -699,9 +748,9 @@
public static final class Render extends Mime
{
- public Render(DispatchType dispatchType, RenderRequestImpl rreq, HttpServletRequest
dreq, String path)
+ public Render(Dispatch dispatch, RenderRequestImpl rreq, HttpServletRequest dreq)
{
- super(dispatchType, rreq, dreq, path);
+ super(dispatch, rreq, dreq);
}
public String getMethod()
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/RequestDispatcherImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/RequestDispatcherImpl.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/RequestDispatcherImpl.java 2008-01-30
18:36:14 UTC (rev 9657)
@@ -0,0 +1,77 @@
+/******************************************************************************
+ * 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 javax.servlet.RequestDispatcher;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.ServletException;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class RequestDispatcherImpl implements RequestDispatcher
+{
+
+ /** . */
+ private final RequestDispatcher realDispatcher;
+
+ /** . */
+ private final String path;
+
+ public RequestDispatcherImpl(RequestDispatcher realDispatcher, String path)
+ {
+ this.realDispatcher = realDispatcher;
+ this.path = path;
+ }
+
+ public void include(ServletRequest req, ServletResponse resp) throws ServletException,
IOException
+ {
+ Dispatch dispatch = new Dispatch(DispatchType.INCLUDE, path);
+ ((DispatchedHttpServletRequest)req).pushDispatch(dispatch);
+ try
+ {
+ realDispatcher.include(req, resp);
+ }
+ finally
+ {
+ ((DispatchedHttpServletRequest)req).popDispatch();
+ }
+ }
+
+ public void forward(ServletRequest req, ServletResponse resp) throws ServletException,
IOException
+ {
+ Dispatch dispatch = new Dispatch(DispatchType.FORWARD, path);
+ ((DispatchedHttpServletRequest)req).pushDispatch(dispatch);
+ try
+ {
+ realDispatcher.forward(req, resp);
+ }
+ finally
+ {
+ ((DispatchedHttpServletRequest)req).popDispatch();
+ }
+ }
+}
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-30
18:33:53 UTC (rev 9656)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java 2008-01-30
18:36:14 UTC (rev 9657)
@@ -27,6 +27,7 @@
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.impl.jsr168.Dispatch;
import javax.portlet.PortletException;
import javax.portlet.PortletRequestDispatcher;
@@ -87,6 +88,9 @@
PortletRequest req,
PortletResponse resp) throws PortletException, IOException
{
+ Dispatch dispatch = new Dispatch(type, path);
+
+ //
try
{
// Get the invocation that is still in the request
@@ -101,22 +105,22 @@
DispatchedHttpServletResponse diresp;
if (req instanceof ActionRequest)
{
- direq = new DispatchedHttpServletRequest.Action(type, (ActionRequestImpl)req,
dreq, path);
+ direq = new DispatchedHttpServletRequest.Action(dispatch,
(ActionRequestImpl)req, dreq);
diresp = new DispatchedHttpServletResponse.StateAware(direq,
(StateAwareResponseImpl)resp, dresp);
}
else if (req instanceof EventRequest)
{
- direq = new DispatchedHttpServletRequest.Event(type, (EventRequestImpl)req,
dreq, path);
+ direq = new DispatchedHttpServletRequest.Event(dispatch,
(EventRequestImpl)req, dreq);
diresp = new DispatchedHttpServletResponse.StateAware(direq,
(StateAwareResponseImpl)resp, dresp);
}
else if (req instanceof RenderRequest)
{
- direq = new DispatchedHttpServletRequest.Render(type, (RenderRequestImpl)req,
dreq, path);
+ direq = new DispatchedHttpServletRequest.Render(dispatch,
(RenderRequestImpl)req, dreq);
diresp = new DispatchedHttpServletResponse.Mime(direq,
(MimeResponseImpl)resp, dresp);
}
else
{
- direq = new DispatchedHttpServletRequest.Resource(type,
(ResourceRequestImpl)req, dreq, path);
+ direq = new DispatchedHttpServletRequest.Resource(dispatch,
(ResourceRequestImpl)req, dreq);
diresp = new DispatchedHttpServletResponse.Mime(direq,
(MimeResponseImpl)resp, dresp);
}
@@ -127,13 +131,6 @@
dispatcher.include(direq, diresp);
break;
case FORWARD:
-// diresp.resetBuffer();
-//
-// //
-// dispatcher.include(direq, diresp);
-//
-// // Flush
-// diresp.flushBuffer();
dispatcher.forward(direq, diresp);
break;
}
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/DispatchedContainerAttributesTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/DispatchedContainerAttributesTestCase.java 2008-01-30
18:33:53 UTC (rev 9656)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/DispatchedContainerAttributesTestCase.java 2008-01-30
18:36:14 UTC (rev 9657)
@@ -32,6 +32,7 @@
import org.jboss.portal.unit.actions.PortletResourceTestAction;
import org.jboss.portal.test.portlet.framework.UTP1;
import org.jboss.portal.test.portlet.framework.UTS1;
+import org.jboss.portal.portlet.LifeCyclePhase;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.response.EndTestResponse;
import static org.jboss.unit.api.Assert.assertEquals;
@@ -56,7 +57,6 @@
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
-import java.util.Collections;
import java.util.HashMap;
/**
@@ -67,62 +67,6 @@
{
/** . */
- public static final Map<String, String> EXPECTED_INCLUDE_ATTRIBUTES_SET =
buildIncludedSetMap();
-
- /** . */
- public static final Map<String, String> EXPECTED_FORWARD_ATTRIBUTES_SET =
buildForwardSetMap();
-
- /** . */
- public static final Map<String, String> EXPECTED_INCLUDE_ATTRIBUTES_NOT_SET =
buildIncludedNotSetMap();
-
- /** . */
- public static final Map<String, String> EXPECTED_FORWARD_ATTRIBUTES_NOT_SET =
buildForwardNotSetMap();
-
- private static Map<String, String> buildIncludedSetMap()
- {
- Map<String, String> map = new HashMap<String, String>();
- map.put("javax.servlet.include.request_uri",
"/test-jsr286-tck-dispatcher/universalServletA/pathinfo");
- map.put("javax.servlet.include.context_path",
"/test-jsr286-tck-dispatcher");
- map.put("javax.servlet.include.servlet_path",
"/universalServletA");
- map.put("javax.servlet.include.path_info", "/pathinfo");
- map.put("javax.servlet.include.query_string", "foo=bar");
- return Collections.unmodifiableMap(map);
- }
-
- private static Map<String, String> buildForwardSetMap()
- {
- Map<String, String> map = new HashMap<String, String>();
- map.put("javax.servlet.forward.request_uri",
"/test-jsr286-tck-dispatcher/universalServletA/pathinfo");
- map.put("javax.servlet.forward.context_path",
"/test-jsr286-tck-dispatcher");
- map.put("javax.servlet.forward.servlet_path",
"/universalServletA");
- map.put("javax.servlet.forward.path_info", "/pathinfo");
- map.put("javax.servlet.forward.query_string", "foo=bar");
- return Collections.unmodifiableMap(map);
- }
-
- private static Map<String, String> buildIncludedNotSetMap()
- {
- Map<String, String> map = new HashMap<String, String>();
- map.put("javax.servlet.include.request_uri", null);
- map.put("javax.servlet.include.context_path", null);
- map.put("javax.servlet.include.servlet_path", null);
- map.put("javax.servlet.include.path_info", null);
- map.put("javax.servlet.include.query_string", null);
- return Collections.unmodifiableMap(map);
- }
-
- private static Map<String, String> buildForwardNotSetMap()
- {
- Map<String, String> map = new HashMap<String, String>();
- map.put("javax.servlet.forward.request_uri", null);
- map.put("javax.servlet.forward.context_path", null);
- map.put("javax.servlet.forward.servlet_path", null);
- map.put("javax.servlet.forward.path_info", null);
- map.put("javax.servlet.forward.query_string", null);
- return Collections.unmodifiableMap(map);
- }
-
- /** . */
private final Map<String, String> expectedAttributes;
/** . */
@@ -144,7 +88,10 @@
{
protected void run(Portlet portlet, ActionRequest request, ActionResponse
response, PortletTestContext context) throws PortletException, IOException
{
- checkAttributes(portlet, request, response);
+ if (performTest(LifeCyclePhase.ACTION))
+ {
+ doTest(portlet, request, response);
+ }
//
response.setEvent("Event", null);
@@ -154,14 +101,20 @@
{
protected void run(Portlet portlet, EventRequest request, EventResponse
response, PortletTestContext context) throws PortletException, IOException
{
- checkAttributes(portlet, request, response);
+ if (performTest(LifeCyclePhase.EVENT))
+ {
+ doTest(portlet, request, response);
+ }
}
});
seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
{
protected DriverResponse run(Portlet portlet, RenderRequest request,
RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
- checkAttributes(portlet, request, response);
+ if (performTest(LifeCyclePhase.RENDER))
+ {
+ doTest(portlet, request, response);
+ }
//
return new InvokeGetResponse(response.createResourceURL().toString());
@@ -172,7 +125,10 @@
{
protected DriverResponse run(Portlet portlet, ResourceRequest request,
ResourceResponse response, PortletTestContext context) throws PortletException,
IOException
{
- checkAttributes(portlet, request, response);
+ if (performTest(LifeCyclePhase.RESOURCE))
+ {
+ doTest(portlet, request, response);
+ }
//
return new EndTestResponse();
@@ -183,7 +139,12 @@
protected abstract void dispatch(PortletRequest request, PortletResponse response,
PortletContext portletContext) throws IOException, PortletException;
- private void checkAttributes(
+ protected boolean performTest(LifeCyclePhase phase)
+ {
+ return true;
+ }
+
+ private void doTest(
Portlet portlet,
PortletRequest request,
PortletResponse response) throws PortletException, IOException
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NFRFContainerAttributesTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NFRFContainerAttributesTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NFRFContainerAttributesTestCase.java 2008-01-30
18:36:14 UTC (rev 9657)
@@ -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.tck.dispatcher;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.portlet.LifeCyclePhase;
+
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletContext;
+import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class NFRFContainerAttributesTestCase extends
DispatchedContainerAttributesTestCase
+{
+
+ /** . */
+ public static final Map<String, String> EXPECTED_ATTRIBUTES_SET =
buildIncludedSetMap();
+
+ private static Map<String, String> buildIncludedSetMap()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("javax.servlet.include.request_uri", null);
+ map.put("javax.servlet.include.context_path", null);
+ map.put("javax.servlet.include.servlet_path", null);
+ map.put("javax.servlet.include.path_info", null);
+ map.put("javax.servlet.include.query_string", null);
+ map.put("javax.servlet.forward.request_uri", null);
+ map.put("javax.servlet.forward.context_path",
"/test-jsr286-tck-dispatcher");
+ map.put("javax.servlet.forward.servlet_path", null);
+ map.put("javax.servlet.forward.path_info", null);
+ map.put("javax.servlet.forward.query_string", null);
+ return Collections.unmodifiableMap(map);
+ }
+
+ public NFRFContainerAttributesTestCase(PortletTestCase seq)
+ {
+ super(seq, EXPECTED_ATTRIBUTES_SET);
+ }
+
+ protected boolean performTest(LifeCyclePhase phase)
+ {
+ return phase != LifeCyclePhase.ACTION && phase != LifeCyclePhase.EVENT;
+ }
+
+ protected void dispatch(PortletRequest request, PortletResponse response,
PortletContext portletContext) throws IOException, PortletException
+ {
+ PortletRequestDispatcher dispatcher =
portletContext.getNamedDispatcher("RequestForwardHopServlet");
+ dispatcher.forward(request, response);
+ }
+}
\ No newline at end of file
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NFRIContainerAttributesTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NFRIContainerAttributesTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NFRIContainerAttributesTestCase.java 2008-01-30
18:36:14 UTC (rev 9657)
@@ -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.tck.dispatcher;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.portlet.LifeCyclePhase;
+
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletContext;
+import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class NFRIContainerAttributesTestCase extends
DispatchedContainerAttributesTestCase
+{
+
+ /** . */
+ public static final Map<String, String> EXPECTED_ATTRIBUTES_SET =
buildIncludedSetMap();
+
+ private static Map<String, String> buildIncludedSetMap()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("javax.servlet.include.request_uri",
"/test-jsr286-tck-dispatcher/universalServletA/pathinfo2");
+ map.put("javax.servlet.include.context_path",
"/test-jsr286-tck-dispatcher");
+ map.put("javax.servlet.include.servlet_path",
"/universalServletA");
+ map.put("javax.servlet.include.path_info", "/pathinfo2");
+ map.put("javax.servlet.include.query_string", "foo2=bar2");
+// map.put("javax.servlet.forward.request_uri", null);
+// map.put("javax.servlet.forward.context_path", null);
+// map.put("javax.servlet.forward.servlet_path", null);
+// map.put("javax.servlet.forward.path_info", null);
+// map.put("javax.servlet.forward.query_string", null);
+ return Collections.unmodifiableMap(map);
+ }
+
+ public NFRIContainerAttributesTestCase(PortletTestCase seq)
+ {
+ super(seq, EXPECTED_ATTRIBUTES_SET);
+ }
+
+ protected boolean performTest(LifeCyclePhase phase)
+ {
+ return phase != LifeCyclePhase.ACTION && phase != LifeCyclePhase.EVENT;
+ }
+
+ protected void dispatch(PortletRequest request, PortletResponse response,
PortletContext portletContext) throws IOException, PortletException
+ {
+ PortletRequestDispatcher dispatcher =
portletContext.getNamedDispatcher("RequestIncludeHopServlet");
+ dispatcher.forward(request, response);
+ }
+}
\ No newline at end of file
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NIRFContainerAttributesTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NIRFContainerAttributesTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NIRFContainerAttributesTestCase.java 2008-01-30
18:36:14 UTC (rev 9657)
@@ -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.tck.dispatcher;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.portlet.LifeCyclePhase;
+
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletContext;
+import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class NIRFContainerAttributesTestCase extends
DispatchedContainerAttributesTestCase
+{
+
+ /** . */
+ public static final Map<String, String> EXPECTED_ATTRIBUTES_SET =
buildIncludedSetMap();
+
+ private static Map<String, String> buildIncludedSetMap()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("javax.servlet.include.request_uri", null);
+ map.put("javax.servlet.include.context_path", null);
+ map.put("javax.servlet.include.servlet_path", null);
+ map.put("javax.servlet.include.path_info", null);
+ map.put("javax.servlet.include.query_string", null);
+ map.put("javax.servlet.forward.request_uri", null);
+ map.put("javax.servlet.forward.context_path",
"/test-jsr286-tck-dispatcher");
+ map.put("javax.servlet.forward.servlet_path", null);
+ map.put("javax.servlet.forward.path_info", null);
+ map.put("javax.servlet.forward.query_string", null);
+ return Collections.unmodifiableMap(map);
+ }
+
+ public NIRFContainerAttributesTestCase(PortletTestCase seq)
+ {
+ super(seq, EXPECTED_ATTRIBUTES_SET);
+ }
+
+ protected boolean performTest(LifeCyclePhase phase)
+ {
+ return phase != LifeCyclePhase.ACTION && phase != LifeCyclePhase.EVENT;
+ }
+
+ protected void dispatch(PortletRequest request, PortletResponse response,
PortletContext portletContext) throws IOException, PortletException
+ {
+ PortletRequestDispatcher dispatcher =
portletContext.getNamedDispatcher("RequestForwardHopServlet");
+ dispatcher.include(request, response);
+ }
+}
\ No newline at end of file
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NIRIContainerAttributesTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NIRIContainerAttributesTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NIRIContainerAttributesTestCase.java 2008-01-30
18:36:14 UTC (rev 9657)
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.tck.dispatcher;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.annotations.TestCase;
+
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletContext;
+import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class NIRIContainerAttributesTestCase extends
DispatchedContainerAttributesTestCase
+{
+
+ /** . */
+ public static final Map<String, String> EXPECTED_ATTRIBUTES_SET =
buildIncludedSetMap();
+
+ private static Map<String, String> buildIncludedSetMap()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("javax.servlet.include.request_uri",
"/test-jsr286-tck-dispatcher/universalServletA/pathinfo2");
+ map.put("javax.servlet.include.context_path",
"/test-jsr286-tck-dispatcher");
+ map.put("javax.servlet.include.servlet_path",
"/universalServletA");
+ map.put("javax.servlet.include.path_info", "/pathinfo2");
+ map.put("javax.servlet.include.query_string", "foo2=bar2");
+ map.put("javax.servlet.forward.request_uri", null);
+ map.put("javax.servlet.forward.context_path", null);
+ map.put("javax.servlet.forward.servlet_path", null);
+ map.put("javax.servlet.forward.path_info", null);
+ map.put("javax.servlet.forward.query_string", null);
+ return Collections.unmodifiableMap(map);
+ }
+
+ public NIRIContainerAttributesTestCase(PortletTestCase seq)
+ {
+ super(seq, EXPECTED_ATTRIBUTES_SET);
+ }
+
+ protected void dispatch(PortletRequest request, PortletResponse response,
PortletContext portletContext) throws IOException, PortletException
+ {
+ PortletRequestDispatcher dispatcher =
portletContext.getNamedDispatcher("RequestIncludeHopServlet");
+ dispatcher.include(request, response);
+ }
+}
\ No newline at end of file
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NamedForwardContainerAttributesTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NamedForwardContainerAttributesTestCase.java 2008-01-30
18:33:53 UTC (rev 9656)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NamedForwardContainerAttributesTestCase.java 2008-01-30
18:36:14 UTC (rev 9657)
@@ -23,7 +23,6 @@
package org.jboss.portal.test.portlet.jsr286.tck.dispatcher;
import org.jboss.portal.unit.PortletTestCase;
-import org.jboss.portal.unit.Assertion;
import org.jboss.portal.unit.annotations.TestCase;
import javax.portlet.PortletRequestDispatcher;
@@ -32,6 +31,9 @@
import javax.portlet.PortletException;
import javax.portlet.PortletContext;
import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -41,9 +43,23 @@
public class NamedForwardContainerAttributesTestCase extends
DispatchedContainerAttributesTestCase
{
+ /** . */
+ public static final Map<String, String> EXPECTED_ATTRIBUTES_SET =
buildForwardNotSetMap();
+
+ private static Map<String, String> buildForwardNotSetMap()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("javax.servlet.forward.request_uri", null);
+ map.put("javax.servlet.forward.context_path", null);
+ map.put("javax.servlet.forward.servlet_path", null);
+ map.put("javax.servlet.forward.path_info", null);
+ map.put("javax.servlet.forward.query_string", null);
+ return Collections.unmodifiableMap(map);
+ }
+
public NamedForwardContainerAttributesTestCase(PortletTestCase seq)
{
- super(seq, EXPECTED_FORWARD_ATTRIBUTES_NOT_SET);
+ super(seq, EXPECTED_ATTRIBUTES_SET);
}
protected void dispatch(PortletRequest request, PortletResponse response,
PortletContext portletContext) throws IOException, PortletException
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NamedIncludeContainerAttributesTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NamedIncludeContainerAttributesTestCase.java 2008-01-30
18:33:53 UTC (rev 9656)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NamedIncludeContainerAttributesTestCase.java 2008-01-30
18:36:14 UTC (rev 9657)
@@ -32,6 +32,9 @@
import javax.portlet.PortletException;
import javax.portlet.PortletContext;
import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -40,9 +43,24 @@
@TestCase({Assertion.JSR168_127})
public class NamedIncludeContainerAttributesTestCase extends
DispatchedContainerAttributesTestCase
{
+
+ /** . */
+ public static final Map<String, String> EXPECTED_ATTRIBUTES_SET =
buildIncludedNotSetMap();
+
+ private static Map<String, String> buildIncludedNotSetMap()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("javax.servlet.include.request_uri", null);
+ map.put("javax.servlet.include.context_path", null);
+ map.put("javax.servlet.include.servlet_path", null);
+ map.put("javax.servlet.include.path_info", null);
+ map.put("javax.servlet.include.query_string", null);
+ return Collections.unmodifiableMap(map);
+ }
+
public NamedIncludeContainerAttributesTestCase(PortletTestCase seq)
{
- super(seq, EXPECTED_INCLUDE_ATTRIBUTES_NOT_SET);
+ super(seq, EXPECTED_ATTRIBUTES_SET);
}
protected void dispatch(PortletRequest request, PortletResponse response,
PortletContext portletContext) throws IOException, PortletException
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RFRFContainerAttributesTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RFRFContainerAttributesTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RFRFContainerAttributesTestCase.java 2008-01-30
18:36:14 UTC (rev 9657)
@@ -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.tck.dispatcher;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.portlet.LifeCyclePhase;
+
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletContext;
+import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class RFRFContainerAttributesTestCase extends
DispatchedContainerAttributesTestCase
+{
+
+ /** . */
+ public static final Map<String, String> EXPECTED_ATTRIBUTES_SET =
buildIncludedSetMap();
+
+ private static Map<String, String> buildIncludedSetMap()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("javax.servlet.include.request_uri", null);
+ map.put("javax.servlet.include.context_path", null);
+ map.put("javax.servlet.include.servlet_path", null);
+ map.put("javax.servlet.include.path_info", null);
+ map.put("javax.servlet.include.query_string", null);
+ map.put("javax.servlet.forward.request_uri",
"/test-jsr286-tck-dispatcher/requestForwardHopServlet/pathinfo1");
+ map.put("javax.servlet.forward.context_path",
"/test-jsr286-tck-dispatcher");
+ map.put("javax.servlet.forward.servlet_path",
"/requestForwardHopServlet");
+ map.put("javax.servlet.forward.path_info", "/pathinfo1");
+ map.put("javax.servlet.forward.query_string", "foo1=bar1");
+ return Collections.unmodifiableMap(map);
+ }
+
+ public RFRFContainerAttributesTestCase(PortletTestCase seq)
+ {
+ super(seq, EXPECTED_ATTRIBUTES_SET);
+ }
+
+ protected boolean performTest(LifeCyclePhase phase)
+ {
+ return phase != LifeCyclePhase.ACTION && phase != LifeCyclePhase.EVENT;
+ }
+
+ protected void dispatch(PortletRequest request, PortletResponse response,
PortletContext portletContext) throws IOException, PortletException
+ {
+ PortletRequestDispatcher dispatcher =
portletContext.getRequestDispatcher("/requestForwardHopServlet/pathinfo1?foo1=bar1");
+ dispatcher.forward(request, response);
+ }
+}
\ No newline at end of file
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RFRIContainerAttributesTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RFRIContainerAttributesTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RFRIContainerAttributesTestCase.java 2008-01-30
18:36:14 UTC (rev 9657)
@@ -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.tck.dispatcher;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.portlet.LifeCyclePhase;
+
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletContext;
+import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class RFRIContainerAttributesTestCase extends
DispatchedContainerAttributesTestCase
+{
+
+ /** . */
+ public static final Map<String, String> EXPECTED_ATTRIBUTES_SET =
buildIncludedSetMap();
+
+ private static Map<String, String> buildIncludedSetMap()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("javax.servlet.include.request_uri",
"/test-jsr286-tck-dispatcher/universalServletA/pathinfo2");
+ map.put("javax.servlet.include.context_path",
"/test-jsr286-tck-dispatcher");
+ map.put("javax.servlet.include.servlet_path",
"/universalServletA");
+ map.put("javax.servlet.include.path_info", "/pathinfo2");
+ map.put("javax.servlet.include.query_string", "foo2=bar2");
+// map.put("javax.servlet.forward.request_uri", null);
+// map.put("javax.servlet.forward.context_path", null);
+// map.put("javax.servlet.forward.servlet_path", null);
+// map.put("javax.servlet.forward.path_info", null);
+// map.put("javax.servlet.forward.query_string", null);
+ return Collections.unmodifiableMap(map);
+ }
+
+ public RFRIContainerAttributesTestCase(PortletTestCase seq)
+ {
+ super(seq, EXPECTED_ATTRIBUTES_SET);
+ }
+
+ protected boolean performTest(LifeCyclePhase phase)
+ {
+ return phase != LifeCyclePhase.ACTION && phase != LifeCyclePhase.EVENT;
+ }
+
+ protected void dispatch(PortletRequest request, PortletResponse response,
PortletContext portletContext) throws IOException, PortletException
+ {
+ PortletRequestDispatcher dispatcher =
portletContext.getRequestDispatcher("/requestIncludeHopServlet/pathinfo1?foo1=bar1");
+ dispatcher.forward(request, response);
+ }
+}
\ No newline at end of file
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RIRFContainerAttributesTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RIRFContainerAttributesTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RIRFContainerAttributesTestCase.java 2008-01-30
18:36:14 UTC (rev 9657)
@@ -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.tck.dispatcher;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.portlet.LifeCyclePhase;
+
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletContext;
+import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class RIRFContainerAttributesTestCase extends
DispatchedContainerAttributesTestCase
+{
+
+ /** . */
+ public static final Map<String, String> EXPECTED_ATTRIBUTES_SET =
buildIncludedSetMap();
+
+ private static Map<String, String> buildIncludedSetMap()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+// map.put("javax.servlet.include.request_uri", null);
+// map.put("javax.servlet.include.context_path", null);
+// map.put("javax.servlet.include.servlet_path", null);
+// map.put("javax.servlet.include.path_info", null);
+// map.put("javax.servlet.include.query_string", null);
+ map.put("javax.servlet.forward.request_uri",
"/test-jsr286-tck-dispatcher/requestForwardHopServlet/pathinfo1");
+ map.put("javax.servlet.forward.context_path",
"/test-jsr286-tck-dispatcher");
+ map.put("javax.servlet.forward.servlet_path",
"/requestForwardHopServlet");
+ map.put("javax.servlet.forward.path_info", "/pathinfo1");
+ map.put("javax.servlet.forward.query_string", "foo1=bar1");
+ return Collections.unmodifiableMap(map);
+ }
+
+ public RIRFContainerAttributesTestCase(PortletTestCase seq)
+ {
+ super(seq, EXPECTED_ATTRIBUTES_SET);
+ }
+
+ protected boolean performTest(LifeCyclePhase phase)
+ {
+ return phase != LifeCyclePhase.ACTION && phase != LifeCyclePhase.EVENT;
+ }
+
+ protected void dispatch(PortletRequest request, PortletResponse response,
PortletContext portletContext) throws IOException, PortletException
+ {
+ PortletRequestDispatcher dispatcher =
portletContext.getRequestDispatcher("/requestForwardHopServlet/pathinfo1?foo1=bar1");
+ dispatcher.include(request, response);
+ }
+}
\ No newline at end of file
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RIRIContainerAttributesTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RIRIContainerAttributesTestCase.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RIRIContainerAttributesTestCase.java 2008-01-30
18:36:14 UTC (rev 9657)
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.tck.dispatcher;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.annotations.TestCase;
+
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletContext;
+import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class RIRIContainerAttributesTestCase extends
DispatchedContainerAttributesTestCase
+{
+
+ /** . */
+ public static final Map<String, String> EXPECTED_ATTRIBUTES_SET =
buildIncludedSetMap();
+
+ private static Map<String, String> buildIncludedSetMap()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("javax.servlet.include.request_uri",
"/test-jsr286-tck-dispatcher/universalServletA/pathinfo2");
+ map.put("javax.servlet.include.context_path",
"/test-jsr286-tck-dispatcher");
+ map.put("javax.servlet.include.servlet_path",
"/universalServletA");
+ map.put("javax.servlet.include.path_info", "/pathinfo2");
+ map.put("javax.servlet.include.query_string", "foo2=bar2");
+ map.put("javax.servlet.forward.request_uri", null);
+ map.put("javax.servlet.forward.context_path", null);
+ map.put("javax.servlet.forward.servlet_path", null);
+ map.put("javax.servlet.forward.path_info", null);
+ map.put("javax.servlet.forward.query_string", null);
+ return Collections.unmodifiableMap(map);
+ }
+
+ public RIRIContainerAttributesTestCase(PortletTestCase seq)
+ {
+ super(seq, EXPECTED_ATTRIBUTES_SET);
+ }
+
+ protected void dispatch(PortletRequest request, PortletResponse response,
PortletContext portletContext) throws IOException, PortletException
+ {
+ PortletRequestDispatcher dispatcher =
portletContext.getRequestDispatcher("/requestIncludeHopServlet/pathinfo1?foo1=bar1");
+ dispatcher.include(request, response);
+ }
+}
\ No newline at end of file
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestForwardContainerAttributesTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestForwardContainerAttributesTestCase.java 2008-01-30
18:33:53 UTC (rev 9656)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestForwardContainerAttributesTestCase.java 2008-01-30
18:36:14 UTC (rev 9657)
@@ -23,7 +23,6 @@
package org.jboss.portal.test.portlet.jsr286.tck.dispatcher;
import org.jboss.portal.unit.PortletTestCase;
-import org.jboss.portal.unit.Assertion;
import org.jboss.portal.unit.annotations.TestCase;
import javax.portlet.PortletRequestDispatcher;
@@ -32,6 +31,9 @@
import javax.portlet.PortletException;
import javax.portlet.PortletContext;
import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -40,9 +42,24 @@
@TestCase
public class RequestForwardContainerAttributesTestCase extends
DispatchedContainerAttributesTestCase
{
+
+ /** . */
+ public static final Map<String, String> EXPECTED_ATTRIBUTES_SET =
buildForwardSetMap();
+
+ private static Map<String, String> buildForwardSetMap()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("javax.servlet.forward.request_uri",
"/test-jsr286-tck-dispatcher/universalServletA/pathinfo");
+ map.put("javax.servlet.forward.context_path",
"/test-jsr286-tck-dispatcher");
+ map.put("javax.servlet.forward.servlet_path",
"/universalServletA");
+ map.put("javax.servlet.forward.path_info", "/pathinfo");
+ map.put("javax.servlet.forward.query_string", "foo=bar");
+ return Collections.unmodifiableMap(map);
+ }
+
public RequestForwardContainerAttributesTestCase(PortletTestCase seq)
{
- super(seq, EXPECTED_FORWARD_ATTRIBUTES_SET);
+ super(seq, EXPECTED_ATTRIBUTES_SET);
}
protected void dispatch(PortletRequest request, PortletResponse response,
PortletContext portletContext) throws IOException, PortletException
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestForwardHopServlet.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestForwardHopServlet.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestForwardHopServlet.java 2008-01-30
18:36:14 UTC (rev 9657)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.tck.dispatcher;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import javax.servlet.RequestDispatcher;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class RequestForwardHopServlet extends HttpServlet
+{
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws
ServletException, IOException
+ {
+ RequestDispatcher dispatcher =
req.getRequestDispatcher("/universalServletA/pathinfo2?foo2=bar2");
+ dispatcher.forward(req, resp);
+ }
+}
\ No newline at end of file
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestIncludeContainerAttributesTestCase.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestIncludeContainerAttributesTestCase.java 2008-01-30
18:33:53 UTC (rev 9656)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestIncludeContainerAttributesTestCase.java 2008-01-30
18:36:14 UTC (rev 9657)
@@ -32,6 +32,9 @@
import javax.portlet.PortletException;
import javax.portlet.PortletContext;
import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -40,9 +43,24 @@
@TestCase({Assertion.JSR168_127})
public class RequestIncludeContainerAttributesTestCase extends
DispatchedContainerAttributesTestCase
{
+
+ /** . */
+ public static final Map<String, String> EXPECTED_ATTRIBUTES_SET =
buildIncludedSetMap();
+
+ private static Map<String, String> buildIncludedSetMap()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("javax.servlet.include.request_uri",
"/test-jsr286-tck-dispatcher/universalServletA/pathinfo");
+ map.put("javax.servlet.include.context_path",
"/test-jsr286-tck-dispatcher");
+ map.put("javax.servlet.include.servlet_path",
"/universalServletA");
+ map.put("javax.servlet.include.path_info", "/pathinfo");
+ map.put("javax.servlet.include.query_string", "foo=bar");
+ return Collections.unmodifiableMap(map);
+ }
+
public RequestIncludeContainerAttributesTestCase(PortletTestCase seq)
{
- super(seq, EXPECTED_INCLUDE_ATTRIBUTES_SET);
+ super(seq, EXPECTED_ATTRIBUTES_SET);
}
protected void dispatch(PortletRequest request, PortletResponse response,
PortletContext portletContext) throws IOException, PortletException
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestIncludeHopServlet.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestIncludeHopServlet.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestIncludeHopServlet.java 2008-01-30
18:36:14 UTC (rev 9657)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.jsr286.tck.dispatcher;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import javax.servlet.RequestDispatcher;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class RequestIncludeHopServlet extends HttpServlet
+{
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws
ServletException, IOException
+ {
+ RequestDispatcher dispatcher =
req.getRequestDispatcher("/universalServletA/pathinfo2?foo2=bar2");
+ dispatcher.include(req, resp);
+ }
+}
Modified:
modules/portlet/trunk/test/src/test/resources/jsr286/tck/dispatcher-war/WEB-INF/web.xml
===================================================================
---
modules/portlet/trunk/test/src/test/resources/jsr286/tck/dispatcher-war/WEB-INF/web.xml 2008-01-30
18:33:53 UTC (rev 9656)
+++
modules/portlet/trunk/test/src/test/resources/jsr286/tck/dispatcher-war/WEB-INF/web.xml 2008-01-30
18:36:14 UTC (rev 9657)
@@ -51,13 +51,16 @@
<servlet-class>org.jboss.portal.test.portlet.framework.UTS4</servlet-class>
</servlet>
-<!--
<servlet>
- <servlet-name>IncludeHopServlet</servlet-name>
-
<servlet-class>org.jboss.portal.test.portlet.jsr286.tck.dispatcher.IncludeHopServlet</servlet-class>
+ <servlet-name>RequestIncludeHopServlet</servlet-name>
+
<servlet-class>org.jboss.portal.test.portlet.jsr286.tck.dispatcher.RequestIncludeHopServlet</servlet-class>
</servlet>
--->
+ <servlet>
+ <servlet-name>RequestForwardHopServlet</servlet-name>
+
<servlet-class>org.jboss.portal.test.portlet.jsr286.tck.dispatcher.RequestForwardHopServlet</servlet-class>
+ </servlet>
+
<servlet-mapping>
<servlet-name>UniversalServletA</servlet-name>
<url-pattern>/universalServletA/*</url-pattern>
@@ -78,10 +81,13 @@
<url-pattern>/universalServletD/*</url-pattern>
</servlet-mapping>
-<!--
<servlet-mapping>
- <servlet-name>IncludeHopServlet</servlet-name>
- <url-pattern>/includeHopServlet/*</url-pattern>
+ <servlet-name>RequestIncludeHopServlet</servlet-name>
+ <url-pattern>/requestIncludeHopServlet/*</url-pattern>
</servlet-mapping>
--->
+
+ <servlet-mapping>
+ <servlet-name>RequestForwardHopServlet</servlet-name>
+ <url-pattern>/requestForwardHopServlet/*</url-pattern>
+ </servlet-mapping>
</web-app>