JBoss Portal SVN: r9660 - in modules/portlet/trunk/portlet/src: test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-30 21:17:41 -0500 (Wed, 30 Jan 2008)
New Revision: 9660
Removed:
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
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.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/tck/dispatcher/DispatchedContainerAttributesTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NFContainerAttributesTestCase.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/NIContainerAttributesTestCase.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/RFContainerAttributesTestCase.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/RIContainerAttributesTestCase.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
Log:
- test double dispatch properly
- correct implementation of container attributes for double dispatching (it was a long way)
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 22:35:00 UTC (rev 9659)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java 2008-01-31 02:17:41 UTC (rev 9660)
@@ -44,9 +44,11 @@
import java.util.Locale;
import java.util.Map;
import java.util.HashMap;
-import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Collections;
import java.io.UnsupportedEncodingException;
import java.io.IOException;
import java.io.BufferedReader;
@@ -92,6 +94,15 @@
"javax.servlet.forward.context_path"
};
+ /** . */
+ private static final Set<String> ALL_CONTAINER_ATTRIBUTES = new HashSet<String>();
+
+ static
+ {
+ ALL_CONTAINER_ATTRIBUTES.addAll(Tools.toSet(INCLUDE_KEYS));
+ ALL_CONTAINER_ATTRIBUTES.addAll(Tools.toSet(FORWARD_KEYS));
+ }
+
/** The initial dispatch. */
final DispatchType dispatchType;
@@ -105,16 +116,13 @@
private final Map<String, String[]> parameters;
/** . */
- private final String[] containerKeys;
-
- /** . */
private final int sessionScope = PortletSession.APPLICATION_SCOPE;
/** . */
- private final LinkedList<Map<String, String>> containerAttributeStack;
+ private final LinkedList<Map<String, String>> containerAttributesStack;
/** . */
- private final LinkedList<Dispatch> dispatchStack;
+ private final String[] infos;
public DispatchedHttpServletRequest(
Dispatch dispatch,
@@ -127,15 +135,14 @@
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>();
+ this.containerAttributesStack = new LinkedList<Map<String, String>>();
// Push dispatch
- pushDispatch(dispatch);
+ this.infos = pushDispatch(dispatch);
//
- String queryString = containerAttributeStack.getLast().get(containerKeys[QUERY_STRING]);
+ String[] containerKeys = dispatchType == DispatchType.INCLUDE ? INCLUDE_KEYS : FORWARD_KEYS;
+ String queryString = containerAttributesStack.getLast().get(containerKeys[QUERY_STRING]);
Map<String, String[]> parameters;
if (queryString != null && queryString.length() > 0)
{
@@ -201,7 +208,7 @@
public final String getPathInfo()
{
- return (String)getAttribute(containerKeys[PATH_INFO]);
+ return infos[PATH_INFO];
}
public final String getPathTranslated()
@@ -211,17 +218,17 @@
public final String getQueryString()
{
- return (String)getAttribute(containerKeys[QUERY_STRING]);
+ return infos[QUERY_STRING];
}
public final String getRequestURI()
{
- return (String)getAttribute(containerKeys[REQUEST_URI]);
+ return infos[REQUEST_URI];
}
public final String getServletPath()
{
- return (String)getAttribute(containerKeys[SERVLET_PATH]);
+ return infos[SERVLET_PATH];
}
// Must be equivalent to the method of the PortletRequest
@@ -243,21 +250,25 @@
public final Object getAttribute(String s)
{
- Map<String, String> containerAttributes = getCurrentContainerAttributes();
-
- //
+ Map<String, String> containerAttributes = containerAttributesStack.getLast();
if (containerAttributes.containsKey(s))
{
return containerAttributes.get(s);
}
//
+ if (ALL_CONTAINER_ATTRIBUTES.contains(s))
+ {
+ return null;
+ }
+
+ //
return preq.getAttributes().getAttribute(s, (HttpServletRequest)getRequest());
}
public final Enumeration getAttributeNames()
{
- final Map<String, String> containerAttributes = getCurrentContainerAttributes();
+ final Map<String, String> containerAttributes = containerAttributesStack.getLast();
final Iterator<String> i = preq.getAttributes().getAttributeNames((HttpServletRequest)getRequest());
//
@@ -307,24 +318,18 @@
public final void setAttribute(String s, Object o)
{
- Map<String, String> containerAttributes = getCurrentContainerAttributes();
+ if (s != null && ALL_CONTAINER_ATTRIBUTES.contains(s))
+ {
+ return;
+ }
//
- if (s != null && !containerAttributes.containsKey(s))
- {
- preq.getAttributes().setAttribute(s, o);
- }
+ preq.getAttributes().setAttribute(s, o);
}
public final void removeAttribute(String s)
{
- Map<String, String> containerAttributes = getCurrentContainerAttributes();
-
- //
- if (s != null && !containerAttributes.containsKey(s))
- {
- preq.getAttributes().removeAttribute(s);
- }
+ setAttribute(s, null);
}
public final Locale getLocale()
@@ -512,88 +517,144 @@
return "HTTP/1.1";
}
- void pushDispatch(Dispatch dispatch)
+ String[] pushDispatch(Dispatch dispatch)
{
String path = dispatch.getPath();
- Map<String, String> attrs;
+
+ //
+ String[] infos;
if (path != null)
{
- String servletPath;
- String pathInfo;
- String queryString;
- int endOfServletPath = path.indexOf('/', 1);
- if (endOfServletPath == -1)
+ infos = build(path);
+
+ //
+ if (dispatch.getType() == DispatchType.INCLUDE)
{
- endOfServletPath = path.indexOf('?', 1);
- if (endOfServletPath == -1)
+ Map<String, String> containerAttributes = new HashMap<String, String>();
+ for (int i = 0;i < infos.length;i++)
{
- servletPath = path;
- pathInfo = "";
- queryString = "";
+ String value = infos[i];
+ if (value != null)
+ {
+ containerAttributes.put(INCLUDE_KEYS[i], value);
+ }
}
- else
- {
- servletPath = path.substring(0, endOfServletPath);
- pathInfo = null;
- queryString = path.substring(endOfServletPath + 1);
- }
+ containerAttributesStack.addLast(containerAttributes);
}
else
{
- servletPath = path.substring(0, endOfServletPath);
- int endOfPathInfo = path.indexOf('?', endOfServletPath + 1);
- if (endOfPathInfo == -1)
+ if (containerAttributesStack.size() == 0)
{
- pathInfo = path.substring(endOfServletPath);
- queryString = "";
+ Map<String, String> containerAttributes = new HashMap<String, String>();
+ for (int i = 0;i < infos.length;i++)
+ {
+ String value = infos[i];
+ if (value != null)
+ {
+ containerAttributes.put(FORWARD_KEYS[i], value);
+ }
+ }
+ containerAttributesStack.addLast(containerAttributes);
}
else
{
- pathInfo = path.substring(endOfServletPath, endOfPathInfo);
- queryString = path.substring(endOfPathInfo + 1);
+ Map<String, String> containerAttributes = new HashMap<String, String>();
+ for (int i = 0;i < this.infos.length;i++)
+ {
+ String value = this.infos[i];
+ if (value != null)
+ {
+ containerAttributes.put(FORWARD_KEYS[i], value);
+ }
+ }
+ containerAttributesStack.addLast(containerAttributes);
}
}
- 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();
+ infos = new String[5];
+
+ //
+ Map<String, String> containerAttributes = Collections.emptyMap();
+ containerAttributesStack.addLast(containerAttributes);
}
//
- containerAttributeStack.addLast(attrs);
- dispatchStack.addLast(dispatch);
+ return infos;
}
- void popDispatch()
+ private String[] build(String path)
{
- containerAttributeStack.removeLast();
- dispatchStack.removeLast();
- }
+ if (path == null)
+ {
+ throw new IllegalArgumentException();
+ }
- private Map<String, String> getCurrentContainerAttributes()
- {
- Dispatch dispatch = dispatchStack.getLast();
-
//
- if (dispatch.getType() == DispatchType.INCLUDE)
+ String servletPath;
+ String pathInfo;
+ String queryString;
+ int endOfServletPath = path.indexOf('/', 1);
+ if (endOfServletPath == -1)
{
- return containerAttributeStack.getLast();
+ endOfServletPath = path.indexOf('?', 1);
+ if (endOfServletPath == -1)
+ {
+ servletPath = path;
+ pathInfo = "";
+ queryString = "";
+ }
+ else
+ {
+ servletPath = path.substring(0, endOfServletPath);
+ pathInfo = null;
+ queryString = path.substring(endOfServletPath + 1);
+ }
}
else
{
- return containerAttributeStack.getFirst();
+ 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[] infos = new String[5];
+
+ //
+ StringBuffer requestURI = new StringBuffer(preq.getContextPath());
+ requestURI.append(servletPath);
+ if (pathInfo != null)
+ {
+ requestURI.append(pathInfo);
+ infos[PATH_INFO] = pathInfo;
+ }
+
+ //
+ infos[SERVLET_PATH] = servletPath;
+ infos[QUERY_STRING] = queryString;
+ infos[REQUEST_URI] = requestURI.toString();
+ infos[CONTEXT_PATH] = preq.getContextPath();
+
+ //
+ return infos;
}
+ void popDispatch()
+ {
+ containerAttributesStack.removeLast();
+ }
+
// Subclasses
public static abstract class ClientData extends DispatchedHttpServletRequest
Modified: 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 2008-01-30 22:35:00 UTC (rev 9659)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/DispatchingFilter.java 2008-01-31 02:17:41 UTC (rev 9660)
@@ -55,7 +55,7 @@
System.out.println("In the CHAIN " + cfg.getFilterName());
System.out.println("In the CHAIN " + cfg.getFilterName());
- RequestDispatcher rd = cfg.getServletContext().getRequestDispatcher("/dispatchedFromFilter.jsp");
+ RequestDispatcher rd = req.getRequestDispatcher("/dispatchedFromFilter.jsp");
rd.include(req, resp);
}
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 22:35:00 UTC (rev 9659)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/DispatchedContainerAttributesTestCase.java 2008-01-31 02:17:41 UTC (rev 9660)
@@ -70,12 +70,30 @@
private final Map<String, String> expectedAttributes;
/** . */
+ private final Map<String, String> expectedInfos;
+
+ /** . */
private final Map<String, Object> collectedAttributes;
- public DispatchedContainerAttributesTestCase(PortletTestCase seq, Map<String, String> expectedAttributes)
+ /** . */
+ private final Map<String, Object> collectedInfos;
+
+ public DispatchedContainerAttributesTestCase(
+ PortletTestCase seq,
+ Map<String, String> expectedAttributes)
{
+ this(seq, expectedAttributes, new HashMap<String, String>());
+ }
+
+ public DispatchedContainerAttributesTestCase(
+ PortletTestCase seq,
+ Map<String, String> expectedAttributes,
+ Map<String, String> expectedInfos)
+ {
this.expectedAttributes = expectedAttributes;
+ this.expectedInfos = expectedInfos;
this.collectedAttributes = new HashMap<String, Object>();
+ this.collectedInfos = new HashMap<String, Object>();
seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
{
@@ -149,26 +167,21 @@
PortletRequest request,
PortletResponse response) throws PortletException, IOException
{
- //assert that servlet HAS access to specific request attributes
- try
- {
- PortletContext portletContext = ((AbstractUniversalTestPortlet)portlet).getPortletContext();
+ PortletContext portletContext = ((AbstractUniversalTestPortlet)portlet).getPortletContext();
+ dispatch(request, response, portletContext);
+ assertMap(expectedAttributes, collectedAttributes);
+ assertMap(expectedInfos, collectedInfos);
+ }
- dispatch(request, response, portletContext);
-
- //
- assertEquals(expectedAttributes.keySet(), collectedAttributes.keySet());
- for (Map.Entry<String, String> entry : expectedAttributes.entrySet())
- {
- String key = entry.getKey();
- String expectedValue = entry.getValue();
- Object collectedValue = collectedAttributes.get(key);
- assertEquals("Was expecting a value " + expectedValue + " for key " + key + " but had instead " + collectedValue, expectedValue, collectedValue);
- }
- }
- finally
+ private void assertMap(Map<String, String> expectedMap, Map<String, Object> actualMap)
+ {
+ assertEquals(expectedMap.keySet(), actualMap.keySet());
+ for (Map.Entry<String, String> entry : expectedMap.entrySet())
{
- collectedAttributes.clear();
+ String key = entry.getKey();
+ String expectedValue = entry.getValue();
+ Object collectedValue = actualMap.get(key);
+ assertEquals("Was expecting a value " + expectedValue + " for key " + key + " but had instead " + collectedValue, expectedValue, collectedValue);
}
}
@@ -176,6 +189,7 @@
{
protected DriverResponse run(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException
{
+ collectedAttributes.clear();
for (String key : expectedAttributes.keySet())
{
Object value = request.getAttribute(key);
@@ -183,6 +197,14 @@
}
//
+ collectedInfos.clear();
+ collectedInfos.put("path_info", request.getPathInfo());
+ collectedInfos.put("context_path", request.getContextPath());
+ collectedInfos.put("query_string", request.getQueryString());
+ collectedInfos.put("servlet_path", request.getServletPath());
+ collectedInfos.put("request_uri", request.getRequestURI());
+
+ //
return null;
}
};
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NFContainerAttributesTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NFContainerAttributesTestCase.java 2008-01-30 22:35:00 UTC (rev 9659)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NFContainerAttributesTestCase.java 2008-01-31 02:17:41 UTC (rev 9660)
@@ -43,10 +43,7 @@
public class NFContainerAttributesTestCase extends DispatchedContainerAttributesTestCase
{
- /** . */
- public static final Map<String, String> EXPECTED_ATTRIBUTES_SET = buildForwardNotSetMap();
-
- private static Map<String, String> buildForwardNotSetMap()
+ private static Map<String, String> buildAttributes()
{
Map<String, String> map = new HashMap<String, String>();
map.put("javax.servlet.forward.request_uri", null);
@@ -54,12 +51,28 @@
map.put("javax.servlet.forward.servlet_path", null);
map.put("javax.servlet.forward.path_info", null);
map.put("javax.servlet.forward.query_string", null);
+ 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> buildInfo()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("request_uri", null);
+ map.put("context_path", "/test-jsr286-tck-dispatcher");
+ map.put("servlet_path", null);
+ map.put("path_info", null);
+ map.put("query_string", null);
+ return Collections.unmodifiableMap(map);
+ }
+
public NFContainerAttributesTestCase(PortletTestCase seq)
{
- super(seq, EXPECTED_ATTRIBUTES_SET);
+ super(seq, buildAttributes(), buildInfo());
}
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/NFRFContainerAttributesTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NFRFContainerAttributesTestCase.java 2008-01-30 22:35:00 UTC (rev 9659)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NFRFContainerAttributesTestCase.java 2008-01-31 02:17:41 UTC (rev 9660)
@@ -44,10 +44,7 @@
public class NFRFContainerAttributesTestCase extends DispatchedContainerAttributesTestCase
{
- /** . */
- public static final Map<String, String> EXPECTED_ATTRIBUTES_SET = buildIncludedSetMap();
-
- private static Map<String, String> buildIncludedSetMap()
+ private static Map<String, String> buildAttributes()
{
Map<String, String> map = new HashMap<String, String>();
map.put("javax.servlet.include.request_uri", null);
@@ -56,16 +53,27 @@
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.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 static Map<String, String> buildInfo()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("request_uri", null);
+ map.put("context_path", "/test-jsr286-tck-dispatcher");
+ map.put("servlet_path", null);
+ map.put("path_info", null);
+ map.put("query_string", null);
+ return Collections.unmodifiableMap(map);
+ }
+
public NFRFContainerAttributesTestCase(PortletTestCase seq)
{
- super(seq, EXPECTED_ATTRIBUTES_SET);
+ super(seq, buildAttributes(), buildInfo());
}
protected boolean performTest(LifeCyclePhase phase)
Modified: 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 2008-01-30 22:35:00 UTC (rev 9659)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NFRIContainerAttributesTestCase.java 2008-01-31 02:17:41 UTC (rev 9660)
@@ -44,10 +44,7 @@
public class NFRIContainerAttributesTestCase extends DispatchedContainerAttributesTestCase
{
- /** . */
- public static final Map<String, String> EXPECTED_ATTRIBUTES_SET = buildIncludedSetMap();
-
- private static Map<String, String> buildIncludedSetMap()
+ private static Map<String, String> buildAttributes()
{
Map<String, String> map = new HashMap<String, String>();
map.put("javax.servlet.include.request_uri", "/test-jsr286-tck-dispatcher/universalServletA/pathinfo2");
@@ -55,17 +52,28 @@
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);
+ 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 static Map<String, String> buildInfo()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("request_uri", null);
+ map.put("context_path", "/test-jsr286-tck-dispatcher");
+ map.put("servlet_path", null);
+ map.put("path_info", null);
+ map.put("query_string", null);
+ return Collections.unmodifiableMap(map);
+ }
+
public NFRIContainerAttributesTestCase(PortletTestCase seq)
{
- super(seq, EXPECTED_ATTRIBUTES_SET);
+ super(seq, buildAttributes(), buildInfo());
}
protected boolean performTest(LifeCyclePhase phase)
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NIContainerAttributesTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NIContainerAttributesTestCase.java 2008-01-30 22:35:00 UTC (rev 9659)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NIContainerAttributesTestCase.java 2008-01-31 02:17:41 UTC (rev 9660)
@@ -44,10 +44,7 @@
public class NIContainerAttributesTestCase extends DispatchedContainerAttributesTestCase
{
- /** . */
- public static final Map<String, String> EXPECTED_ATTRIBUTES_SET = buildIncludedNotSetMap();
-
- private static Map<String, String> buildIncludedNotSetMap()
+ private static Map<String, String> buildAttributes()
{
Map<String, String> map = new HashMap<String, String>();
map.put("javax.servlet.include.request_uri", null);
@@ -55,12 +52,28 @@
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", 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 static Map<String, String> buildInfo()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("request_uri", null);
+ map.put("context_path", "/test-jsr286-tck-dispatcher");
+ map.put("servlet_path", null);
+ map.put("path_info", null);
+ map.put("query_string", null);
+ return Collections.unmodifiableMap(map);
+ }
+
public NIContainerAttributesTestCase(PortletTestCase seq)
{
- super(seq, EXPECTED_ATTRIBUTES_SET);
+ super(seq, buildAttributes(), buildInfo());
}
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/NIRFContainerAttributesTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NIRFContainerAttributesTestCase.java 2008-01-30 22:35:00 UTC (rev 9659)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NIRFContainerAttributesTestCase.java 2008-01-31 02:17:41 UTC (rev 9660)
@@ -44,10 +44,7 @@
public class NIRFContainerAttributesTestCase extends DispatchedContainerAttributesTestCase
{
- /** . */
- public static final Map<String, String> EXPECTED_ATTRIBUTES_SET = buildIncludedSetMap();
-
- private static Map<String, String> buildIncludedSetMap()
+ private static Map<String, String> buildAttributes()
{
Map<String, String> map = new HashMap<String, String>();
map.put("javax.servlet.include.request_uri", null);
@@ -56,16 +53,27 @@
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.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 static Map<String, String> buildInfo()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("request_uri", null);
+ map.put("context_path", "/test-jsr286-tck-dispatcher");
+ map.put("servlet_path", null);
+ map.put("path_info", null);
+ map.put("query_string", null);
+ return Collections.unmodifiableMap(map);
+ }
+
public NIRFContainerAttributesTestCase(PortletTestCase seq)
{
- super(seq, EXPECTED_ATTRIBUTES_SET);
+ super(seq, buildAttributes(), buildInfo());
}
protected boolean performTest(LifeCyclePhase phase)
Modified: 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 2008-01-30 22:35:00 UTC (rev 9659)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NIRIContainerAttributesTestCase.java 2008-01-31 02:17:41 UTC (rev 9660)
@@ -43,10 +43,7 @@
public class NIRIContainerAttributesTestCase extends DispatchedContainerAttributesTestCase
{
- /** . */
- public static final Map<String, String> EXPECTED_ATTRIBUTES_SET = buildIncludedSetMap();
-
- private static Map<String, String> buildIncludedSetMap()
+ private static Map<String, String> buildAttributes()
{
Map<String, String> map = new HashMap<String, String>();
map.put("javax.servlet.include.request_uri", "/test-jsr286-tck-dispatcher/universalServletA/pathinfo2");
@@ -62,9 +59,20 @@
return Collections.unmodifiableMap(map);
}
+ private static Map<String, String> buildInfo()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("request_uri", null);
+ map.put("context_path", "/test-jsr286-tck-dispatcher");
+ map.put("servlet_path", null);
+ map.put("path_info", null);
+ map.put("query_string", null);
+ return Collections.unmodifiableMap(map);
+ }
+
public NIRIContainerAttributesTestCase(PortletTestCase seq)
{
- super(seq, EXPECTED_ATTRIBUTES_SET);
+ super(seq, buildAttributes(), buildInfo());
}
protected void dispatch(PortletRequest request, PortletResponse response, PortletContext portletContext) throws IOException, PortletException
Deleted: 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 22:35:00 UTC (rev 9659)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NamedForwardContainerAttributesTestCase.java 2008-01-31 02:17:41 UTC (rev 9660)
@@ -1,70 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.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 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_ATTRIBUTES_SET);
- }
-
- protected void dispatch(PortletRequest request, PortletResponse response, PortletContext portletContext) throws IOException, PortletException
- {
- PortletRequestDispatcher dispatcher = portletContext.getNamedDispatcher("UniversalServletA");
- dispatcher.forward(request, response);
- }
-}
\ No newline at end of file
Deleted: 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 22:35:00 UTC (rev 9659)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NamedIncludeContainerAttributesTestCase.java 2008-01-31 02:17:41 UTC (rev 9660)
@@ -1,71 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.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;
-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 $
- */
-(a)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_ATTRIBUTES_SET);
- }
-
- protected void dispatch(PortletRequest request, PortletResponse response, PortletContext portletContext) throws IOException, PortletException
- {
- PortletRequestDispatcher dispatcher = portletContext.getNamedDispatcher("UniversalServletA");
- 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/RFContainerAttributesTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RFContainerAttributesTestCase.java 2008-01-30 22:35:00 UTC (rev 9659)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RFContainerAttributesTestCase.java 2008-01-31 02:17:41 UTC (rev 9660)
@@ -43,10 +43,7 @@
public class RFContainerAttributesTestCase extends DispatchedContainerAttributesTestCase
{
- /** . */
- public static final Map<String, String> EXPECTED_ATTRIBUTES_SET = buildForwardSetMap();
-
- private static Map<String, String> buildForwardSetMap()
+ private static Map<String, String> buildAttributes()
{
Map<String, String> map = new HashMap<String, String>();
map.put("javax.servlet.forward.request_uri", "/test-jsr286-tck-dispatcher/universalServletA/pathinfo");
@@ -54,12 +51,28 @@
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");
+ 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> buildInfo()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("request_uri", "/test-jsr286-tck-dispatcher/universalServletA/pathinfo");
+ map.put("context_path", "/test-jsr286-tck-dispatcher");
+ map.put("servlet_path", "/universalServletA");
+ map.put("path_info", "/pathinfo");
+ map.put("query_string", "foo=bar");
+ return Collections.unmodifiableMap(map);
+ }
+
public RFContainerAttributesTestCase(PortletTestCase seq)
{
- super(seq, EXPECTED_ATTRIBUTES_SET);
+ super(seq, buildAttributes(), buildInfo());
}
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/RFRFContainerAttributesTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RFRFContainerAttributesTestCase.java 2008-01-30 22:35:00 UTC (rev 9659)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RFRFContainerAttributesTestCase.java 2008-01-31 02:17:41 UTC (rev 9660)
@@ -45,9 +45,9 @@
{
/** . */
- public static final Map<String, String> EXPECTED_ATTRIBUTES_SET = buildIncludedSetMap();
+ public static final Map<String, String> EXPECTED_ATTRIBUTES_SET = buildAttributes();
- private static Map<String, String> buildIncludedSetMap()
+ private static Map<String, String> buildAttributes()
{
Map<String, String> map = new HashMap<String, String>();
map.put("javax.servlet.include.request_uri", null);
@@ -63,9 +63,20 @@
return Collections.unmodifiableMap(map);
}
+ private static Map<String, String> buildInfos()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("request_uri", "/test-jsr286-tck-dispatcher/requestForwardHopServlet/pathinfo1");
+ map.put("context_path", "/test-jsr286-tck-dispatcher");
+ map.put("servlet_path", "/requestForwardHopServlet");
+ map.put("path_info", "/pathinfo1");
+ map.put("query_string", "foo1=bar1");
+ return Collections.unmodifiableMap(map);
+ }
+
public RFRFContainerAttributesTestCase(PortletTestCase seq)
{
- super(seq, EXPECTED_ATTRIBUTES_SET);
+ super(seq, buildAttributes(), buildInfos());
}
protected boolean performTest(LifeCyclePhase phase)
Modified: 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 2008-01-30 22:35:00 UTC (rev 9659)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RFRIContainerAttributesTestCase.java 2008-01-31 02:17:41 UTC (rev 9660)
@@ -45,9 +45,9 @@
{
/** . */
- public static final Map<String, String> EXPECTED_ATTRIBUTES_SET = buildIncludedSetMap();
+ public static final Map<String, String> EXPECTED_ATTRIBUTES_SET = buildAttributes();
- private static Map<String, String> buildIncludedSetMap()
+ private static Map<String, String> buildAttributes()
{
Map<String, String> map = new HashMap<String, String>();
map.put("javax.servlet.include.request_uri", "/test-jsr286-tck-dispatcher/universalServletA/pathinfo2");
@@ -55,17 +55,28 @@
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);
+ 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 static Map<String, String> buildInfos()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("request_uri", "/test-jsr286-tck-dispatcher/requestIncludeHopServlet/pathinfo1");
+ map.put("context_path", "/test-jsr286-tck-dispatcher");
+ map.put("servlet_path", "/requestIncludeHopServlet");
+ map.put("path_info", "/pathinfo1");
+ map.put("query_string", "foo1=bar1");
+ return Collections.unmodifiableMap(map);
+ }
+
public RFRIContainerAttributesTestCase(PortletTestCase seq)
{
- super(seq, EXPECTED_ATTRIBUTES_SET);
+ super(seq, buildAttributes(), buildInfos());
}
protected boolean performTest(LifeCyclePhase phase)
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RIContainerAttributesTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RIContainerAttributesTestCase.java 2008-01-30 22:35:00 UTC (rev 9659)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RIContainerAttributesTestCase.java 2008-01-31 02:17:41 UTC (rev 9660)
@@ -44,10 +44,7 @@
public class RIContainerAttributesTestCase extends DispatchedContainerAttributesTestCase
{
- /** . */
- public static final Map<String, String> EXPECTED_ATTRIBUTES_SET = buildIncludedSetMap();
-
- private static Map<String, String> buildIncludedSetMap()
+ private static Map<String, String> buildAttributes()
{
Map<String, String> map = new HashMap<String, String>();
map.put("javax.servlet.include.request_uri", "/test-jsr286-tck-dispatcher/universalServletA/pathinfo");
@@ -55,12 +52,28 @@
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");
+ 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 static Map<String, String> buildInfo()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("request_uri", "/test-jsr286-tck-dispatcher/universalServletA/pathinfo");
+ map.put("context_path", "/test-jsr286-tck-dispatcher");
+ map.put("servlet_path", "/universalServletA");
+ map.put("path_info", "/pathinfo");
+ map.put("query_string", "foo=bar");
+ return Collections.unmodifiableMap(map);
+ }
+
public RIContainerAttributesTestCase(PortletTestCase seq)
{
- super(seq, EXPECTED_ATTRIBUTES_SET);
+ super(seq, buildAttributes(), buildInfo());
}
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/RIRFContainerAttributesTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RIRFContainerAttributesTestCase.java 2008-01-30 22:35:00 UTC (rev 9659)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RIRFContainerAttributesTestCase.java 2008-01-31 02:17:41 UTC (rev 9660)
@@ -45,16 +45,16 @@
{
/** . */
- public static final Map<String, String> EXPECTED_ATTRIBUTES_SET = buildIncludedSetMap();
+ public static final Map<String, String> EXPECTED_ATTRIBUTES_SET = buildAttributes();
- private static Map<String, String> buildIncludedSetMap()
+ private static Map<String, String> buildAttributes()
{
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.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");
@@ -63,9 +63,20 @@
return Collections.unmodifiableMap(map);
}
+ private static Map<String, String> buildInfo()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("request_uri", "/test-jsr286-tck-dispatcher/requestForwardHopServlet/pathinfo1");
+ map.put("context_path", "/test-jsr286-tck-dispatcher");
+ map.put("servlet_path", "/requestForwardHopServlet");
+ map.put("path_info", "/pathinfo1");
+ map.put("query_string", "foo1=bar1");
+ return Collections.unmodifiableMap(map);
+ }
+
public RIRFContainerAttributesTestCase(PortletTestCase seq)
{
- super(seq, EXPECTED_ATTRIBUTES_SET);
+ super(seq, buildAttributes(), buildInfo());
}
protected boolean performTest(LifeCyclePhase phase)
Modified: 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 2008-01-30 22:35:00 UTC (rev 9659)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RIRIContainerAttributesTestCase.java 2008-01-31 02:17:41 UTC (rev 9660)
@@ -44,9 +44,9 @@
{
/** . */
- public static final Map<String, String> EXPECTED_ATTRIBUTES_SET = buildIncludedSetMap();
+ public static final Map<String, String> EXPECTED_ATTRIBUTES_SET = buildAttributes();
- private static Map<String, String> buildIncludedSetMap()
+ private static Map<String, String> buildAttributes()
{
Map<String, String> map = new HashMap<String, String>();
map.put("javax.servlet.include.request_uri", "/test-jsr286-tck-dispatcher/universalServletA/pathinfo2");
@@ -62,9 +62,20 @@
return Collections.unmodifiableMap(map);
}
+ private static Map<String, String> buildInfo()
+ {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("request_uri", "/test-jsr286-tck-dispatcher/requestIncludeHopServlet/pathinfo1");
+ map.put("context_path", "/test-jsr286-tck-dispatcher");
+ map.put("servlet_path", "/requestIncludeHopServlet");
+ map.put("path_info", "/pathinfo1");
+ map.put("query_string", "foo1=bar1");
+ return Collections.unmodifiableMap(map);
+ }
+
public RIRIContainerAttributesTestCase(PortletTestCase seq)
{
- super(seq, EXPECTED_ATTRIBUTES_SET);
+ super(seq, buildAttributes(), buildInfo());
}
protected void dispatch(PortletRequest request, PortletResponse response, PortletContext portletContext) throws IOException, PortletException
Deleted: 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 22:35:00 UTC (rev 9659)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestForwardContainerAttributesTestCase.java 2008-01-31 02:17:41 UTC (rev 9660)
@@ -1,70 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.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 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_ATTRIBUTES_SET);
- }
-
- protected void dispatch(PortletRequest request, PortletResponse response, PortletContext portletContext) throws IOException, PortletException
- {
- PortletRequestDispatcher dispatcher = portletContext.getRequestDispatcher("/universalServletA/pathinfo?foo=bar");
- dispatcher.forward(request, response);
- }
-}
\ No newline at end of file
Deleted: 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 22:35:00 UTC (rev 9659)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RequestIncludeContainerAttributesTestCase.java 2008-01-31 02:17:41 UTC (rev 9660)
@@ -1,71 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.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;
-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 $
- */
-(a)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_ATTRIBUTES_SET);
- }
-
- protected void dispatch(PortletRequest request, PortletResponse response, PortletContext portletContext) throws IOException, PortletException
- {
- PortletRequestDispatcher dispatcher = portletContext.getRequestDispatcher("/universalServletA/pathinfo?foo=bar");
- dispatcher.include(request, response);
- }
-}
16 years, 3 months
JBoss Portal SVN: r9659 - modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-30 17:35:00 -0500 (Wed, 30 Jan 2008)
New Revision: 9659
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NFContainerAttributesTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NIContainerAttributesTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RFContainerAttributesTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RIContainerAttributesTestCase.java
Log:
- renamed test case to be more homogenous with other similar test cases
Copied: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NFContainerAttributesTestCase.java (from rev 9657, 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/NFContainerAttributesTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NFContainerAttributesTestCase.java 2008-01-30 22:35:00 UTC (rev 9659)
@@ -0,0 +1,70 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.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 NFContainerAttributesTestCase 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 NFContainerAttributesTestCase(PortletTestCase seq)
+ {
+ super(seq, EXPECTED_ATTRIBUTES_SET);
+ }
+
+ protected void dispatch(PortletRequest request, PortletResponse response, PortletContext portletContext) throws IOException, PortletException
+ {
+ PortletRequestDispatcher dispatcher = portletContext.getNamedDispatcher("UniversalServletA");
+ dispatcher.forward(request, response);
+ }
+}
\ No newline at end of file
Copied: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NIContainerAttributesTestCase.java (from rev 9657, 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/NIContainerAttributesTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/NIContainerAttributesTestCase.java 2008-01-30 22:35:00 UTC (rev 9659)
@@ -0,0 +1,71 @@
+/******************************************************************************
+ * 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.Assertion;
+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 $
+ */
+(a)TestCase({Assertion.JSR168_127})
+public class NIContainerAttributesTestCase 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 NIContainerAttributesTestCase(PortletTestCase seq)
+ {
+ super(seq, EXPECTED_ATTRIBUTES_SET);
+ }
+
+ protected void dispatch(PortletRequest request, PortletResponse response, PortletContext portletContext) throws IOException, PortletException
+ {
+ PortletRequestDispatcher dispatcher = portletContext.getNamedDispatcher("UniversalServletA");
+ dispatcher.include(request, response);
+ }
+}
\ No newline at end of file
Copied: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RFContainerAttributesTestCase.java (from rev 9657, 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/RFContainerAttributesTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RFContainerAttributesTestCase.java 2008-01-30 22:35:00 UTC (rev 9659)
@@ -0,0 +1,70 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.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 RFContainerAttributesTestCase 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 RFContainerAttributesTestCase(PortletTestCase seq)
+ {
+ super(seq, EXPECTED_ATTRIBUTES_SET);
+ }
+
+ protected void dispatch(PortletRequest request, PortletResponse response, PortletContext portletContext) throws IOException, PortletException
+ {
+ PortletRequestDispatcher dispatcher = portletContext.getRequestDispatcher("/universalServletA/pathinfo?foo=bar");
+ dispatcher.forward(request, response);
+ }
+}
\ No newline at end of file
Copied: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RIContainerAttributesTestCase.java (from rev 9657, 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/RIContainerAttributesTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/RIContainerAttributesTestCase.java 2008-01-30 22:35:00 UTC (rev 9659)
@@ -0,0 +1,71 @@
+/******************************************************************************
+ * 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.Assertion;
+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 $
+ */
+(a)TestCase({Assertion.JSR168_127})
+public class RIContainerAttributesTestCase 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 RIContainerAttributesTestCase(PortletTestCase seq)
+ {
+ super(seq, EXPECTED_ATTRIBUTES_SET);
+ }
+
+ protected void dispatch(PortletRequest request, PortletResponse response, PortletContext portletContext) throws IOException, PortletException
+ {
+ PortletRequestDispatcher dispatcher = portletContext.getRequestDispatcher("/universalServletA/pathinfo?foo=bar");
+ dispatcher.include(request, response);
+ }
+}
16 years, 3 months
JBoss Portal SVN: r9658 - modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-30 17:20:18 -0500 (Wed, 30 Jan 2008)
New Revision: 9658
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java
Log:
- fixed wrong merge
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:36:14 UTC (rev 9657)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java 2008-01-30 22:20:18 UTC (rev 9658)
@@ -528,13 +528,13 @@
if (endOfServletPath == -1)
{
servletPath = path;
- pathInfo = null;
+ pathInfo = "";
queryString = "";
}
else
{
servletPath = path.substring(0, endOfServletPath);
- pathInfo = "";
+ pathInfo = null;
queryString = path.substring(endOfServletPath + 1);
}
}
16 years, 3 months
JBoss Portal SVN: r9657 - in modules/portlet/trunk: portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api and 2 other directories.
by portal-commits@lists.jboss.org
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>
16 years, 3 months
JBoss Portal SVN: r9656 - modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-01-30 13:33:53 -0500 (Wed, 30 Jan 2008)
New Revision: 9656
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java
Log:
- Removed unreachable statement.
- Started re-organizing.
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-30 17:50:44 UTC (rev 9655)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletController.java 2008-01-30 18:33:53 UTC (rev 9656)
@@ -57,6 +57,7 @@
import org.jboss.portal.portlet.invocation.response.ResponseProperties;
import org.jboss.portal.portlet.invocation.response.StateResponse;
import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
+import org.jboss.portal.portlet.spi.PortalContext;
import org.jboss.portal.portlet.spi.ResourceInvocationContext;
import org.jboss.portal.web.IllegalRequestException;
import org.w3c.dom.Element;
@@ -95,17 +96,254 @@
private final Logger log;
/** . */
- private final AbstractPortalContext portalContext;
+ private final PortalContext portalContext;
public PortletController() throws IllegalRequestException, UnsupportedEncodingException
{
+ //
+ this.log = Logger.getLogger(PortletController.class);
+
Map<String, String> portalProperties = new HashMap<String, String>();
portalProperties.put("javax.portlet.markup.head.element.support", "true");
- AbstractPortalContext portalContext = new AbstractPortalContext(portalProperties);
+ this.portalContext = new AbstractPortalContext(portalProperties);
+ }
+
+ public void process(ControllerRequest controllerRequest) throws PortletInvokerException, IOException
+ {
+ if (controllerRequest instanceof ViewRequest)
+ {
+ render(controllerRequest.controllerContext, new ResponseProperties(), new PageNavigationalState());
+ }
+ else if (controllerRequest instanceof ContainerRequest)
+ {
+ process((ContainerRequest)controllerRequest);
+ }
+ }
+
+ public void process(ContainerRequest containerRequest) throws PortletInvokerException, IOException
+ {
+ PortletControllerContext context = containerRequest.controllerContext;
+ HttpServletResponse resp = context.getClientResponse();
+
//
- this.log = Logger.getLogger(PortletController.class);
- this.portalContext = portalContext;
+ if (containerRequest instanceof PortletRequest)
+ {
+ PortletRequest portletRequest = (PortletRequest)containerRequest;
+
+ //
+ PortletInvocationResponse response = invoke(containerRequest);
+
+ //
+ ResponseProperties requestProperties = new ResponseProperties();
+
+ //
+ if (response instanceof ErrorResponse)
+ {
+ ErrorResponse error = (ErrorResponse)response;
+
+ //
+ if (error.getCause() != null)
+ {
+ log.error("Portlet action threw an error: " + error.getMessage(), error.getCause());
+ }
+ else
+ {
+ log.error("Portlet action threw an error: " + error.getMessage());
+ }
+
+ //
+ resp.sendError(404, error.getMessage());
+ }
+ else if (response instanceof StateResponse)
+ {
+ StateResponse stateResponse = (StateResponse)response;
+
+ // Update portlet NS
+ if (response instanceof UpdateNavigationalStateResponse)
+ {
+ UpdateNavigationalStateResponse updateResponse = (UpdateNavigationalStateResponse)response;
+ updateNavigationalState(
+ context,
+ containerRequest.portletId,
+ updateResponse,
+ portletRequest.pageState);
+
+ //
+ ResponseProperties update = updateResponse.getProperties();
+ if (update != null)
+ {
+ requestProperties.append(updateResponse.getProperties());
+ }
+ }
+
+ // Create event list and feed it with the events that may have been produced
+ LinkedList<StateResponse.Event> queue = new LinkedList<StateResponse.Event>();
+ queue.addAll(stateResponse.getEvents());
+
+ //
+ while (queue.size() > 0)
+ {
+ StateResponse.Event event = queue.removeFirst();
+
+ //
+ List<Portlet> consumers = new ArrayList<Portlet>();
+ for (Portlet portlet : context.getPortlets())
+ {
+ PortletInfo portletInfo = portlet.getInfo();
+
+ //
+ for (EventInfo eventInfo : portletInfo.getEventing().getConsumedEvents())
+ {
+ if (event.getName().equals(eventInfo.getName()))
+ {
+ consumers.add(portlet);
+ }
+ }
+ }
+
+ //
+ for (Portlet consumer : consumers)
+ {
+ PortletInvocationResponse eventResponse = deliverEvent(
+ context,
+ consumer,
+ event,
+ portletRequest.pageState,
+ requestProperties.getCookies());
+
+ //
+ if (eventResponse instanceof UpdateNavigationalStateResponse)
+ {
+ UpdateNavigationalStateResponse update = (UpdateNavigationalStateResponse)eventResponse;
+
+ // Update ns
+ updateNavigationalState(context, consumer.getContext().getId(), update, portletRequest.pageState);
+
+ // Add events if any
+ queue.addAll(update.getEvents());
+
+ //
+ ResponseProperties updateProperties = update.getProperties();
+ if (updateProperties != null)
+ {
+ requestProperties.append(update.getProperties());
+ }
+ }
+ else if (eventResponse instanceof ErrorResponse)
+ {
+ // Do something here !!!!
+ }
+ else
+ {
+ // Do something here !!!!
+ }
+ }
+ }
+
+ if (response instanceof HTTPRedirectionResponse)
+ {
+ HTTPRedirectionResponse redirection = (HTTPRedirectionResponse)response;
+ resp.sendRedirect(redirection.getLocation());
+ return;
+ }
+ }
+ else
+ {
+ System.out.println("Not yet handled " + response);
+ }
+
+/*
+ if (response instanceof RenderResponse && redirectAfterAction)
+ {
+ PortletURLRenderer renderer = new PortletURLRenderer(navState, portlet, req, resp);
+ final RenderResponse render = (RenderResponse)response;
+ String location = renderer.renderURL(new RenderURL()
+ {
+ public StateString getNavigationalState()
+ {
+ return render.getNavigationalState();
+ }
+ public Mode getMode()
+ {
+ return render.getMode();
+ }
+ public WindowState getWindowState()
+ {
+ return render.getWindowState();
+ }
+ }, null, null, true);
+ response = new HTTPRedirectionResponse(location);
+ }
+*/
+
+ //
+ render(context, requestProperties, portletRequest.pageState);
+ }
+ else if (containerRequest instanceof PortletResourceRequest)
+ {
+ PortletInvocationResponse response = invoke(containerRequest);
+
+ //
+ if (response instanceof FragmentResponse)
+ {
+ FragmentResponse fragment = (FragmentResponse)response;
+ ResponseProperties props = fragment.getProperties();
+
+ //
+ if (props != null)
+ {
+ renderTransportHeaders(props, resp);
+ renderCookies(props, resp);
+ }
+
+ //
+ if (fragment.getType() == FragmentResponse.TYPE_EMPTY)
+ {
+ resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
+ }
+ else
+ {
+ String contentType = fragment.getContentType();
+ if (contentType != null)
+ {
+ resp.setContentType(contentType);
+ }
+
+ //
+ if (fragment.getType() == FragmentResponse.TYPE_BYTES)
+ {
+ ServletOutputStream out = null;
+ try
+ {
+ out = resp.getOutputStream();
+ out.write(fragment.getBytes().toByteArray());
+ }
+ finally
+ {
+ IOTools.safeClose(out);
+ }
+ }
+ else
+ {
+ Writer writer = null;
+ try
+ {
+ writer = resp.getWriter();
+ writer.write(fragment.getChars().toString());
+ }
+ finally
+ {
+ writer.close();
+ }
+ }
+ }
+ }
+ else
+ {
+ // todo
+ }
+ }
}
private PortletInvocationResponse invoke(ContainerRequest containerRequest) throws PortletInvokerException, IOException
@@ -346,255 +584,6 @@
}
}
- public void process(ControllerRequest controllerRequest) throws PortletInvokerException, IOException
- {
- if (controllerRequest instanceof ViewRequest)
- {
- render(controllerRequest.controllerContext, new ResponseProperties(), new PageNavigationalState());
- }
- else if (controllerRequest instanceof ContainerRequest)
- {
- process((ContainerRequest)controllerRequest);
- }
- }
-
- public void process(ContainerRequest containerRequest) throws PortletInvokerException, IOException
- {
- PortletControllerContext context = containerRequest.controllerContext;
- HttpServletResponse resp = context.getClientResponse();
-
- //
- if (containerRequest instanceof PortletRequest)
- {
- PortletRequest portletRequest = (PortletRequest)containerRequest;
-
- //
- PortletInvocationResponse response = invoke(containerRequest);
-
- //
- ResponseProperties requestProperties = new ResponseProperties();
-
- //
- if (response instanceof ErrorResponse)
- {
- ErrorResponse error = (ErrorResponse)response;
-
- //
- if (error.getCause() != null)
- {
- log.error("Portlet action threw an error: " + error.getMessage(), error.getCause());
- }
- else
- {
- log.error("Portlet action threw an error: " + error.getMessage());
- }
-
- //
- resp.sendError(404, error.getMessage());
- }
- else if (response instanceof StateResponse)
- {
- StateResponse stateResponse = (StateResponse)response;
-
- // Update portlet NS
- if (response instanceof UpdateNavigationalStateResponse)
- {
- UpdateNavigationalStateResponse updateResponse = (UpdateNavigationalStateResponse)response;
- updateNavigationalState(
- context,
- containerRequest.portletId,
- updateResponse,
- portletRequest.pageState);
-
- //
- ResponseProperties update = updateResponse.getProperties();
- if (update != null)
- {
- requestProperties.append(updateResponse.getProperties());
- }
- }
-
- // Create event list and feed it with the events that may have been produced
- LinkedList<StateResponse.Event> queue = new LinkedList<StateResponse.Event>();
- queue.addAll(stateResponse.getEvents());
-
- //
- while (queue.size() > 0)
- {
- StateResponse.Event event = queue.removeFirst();
-
- //
- List<Portlet> consumers = new ArrayList<Portlet>();
- for (Portlet portlet : context.getPortlets())
- {
- PortletInfo portletInfo = portlet.getInfo();
-
- //
- for (EventInfo eventInfo : portletInfo.getEventing().getConsumedEvents())
- {
- if (event.getName().equals(eventInfo.getName()))
- {
- consumers.add(portlet);
- }
- }
- }
-
- //
- for (Portlet consumer : consumers)
- {
- PortletInvocationResponse eventResponse = deliverEvent(
- context,
- consumer,
- event,
- portletRequest.pageState,
- requestProperties.getCookies());
-
- //
- if (eventResponse instanceof UpdateNavigationalStateResponse)
- {
- UpdateNavigationalStateResponse update = (UpdateNavigationalStateResponse)eventResponse;
-
- // Update ns
- updateNavigationalState(context, consumer.getContext().getId(), update, portletRequest.pageState);
-
- // Add events if any
- queue.addAll(update.getEvents());
-
- //
- ResponseProperties updateProperties = update.getProperties();
- if (updateProperties != null)
- {
- requestProperties.append(update.getProperties());
- }
- }
- else if (eventResponse instanceof ErrorResponse)
- {
- // Do something here !!!!
- }
- else
- {
- // Do something here !!!!
- }
- }
- }
-
- //
- if (response instanceof HTTPRedirectionResponse)
- {
- HTTPRedirectionResponse redirection = (HTTPRedirectionResponse)response;
- resp.sendRedirect(redirection.getLocation());
- return;
- }
- else if (response instanceof ErrorResponse)
- {
- ErrorResponse error = (ErrorResponse)response;
- System.out.println("Error " + error.getMessage());
- if (error.getCause() != null)
- {
- error.getCause().printStackTrace();
- }
- resp.sendError(404, error.getMessage());
- return;
- }
- }
- else
- {
- System.out.println("Not yet handled " + response);
- }
-
-/*
- if (response instanceof RenderResponse && redirectAfterAction)
- {
- PortletURLRenderer renderer = new PortletURLRenderer(navState, portlet, req, resp);
- final RenderResponse render = (RenderResponse)response;
- String location = renderer.renderURL(new RenderURL()
- {
- public StateString getNavigationalState()
- {
- return render.getNavigationalState();
- }
- public Mode getMode()
- {
- return render.getMode();
- }
- public WindowState getWindowState()
- {
- return render.getWindowState();
- }
- }, null, null, true);
- response = new HTTPRedirectionResponse(location);
- }
-*/
-
- //
- render(context, requestProperties, portletRequest.pageState);
- }
- else if (containerRequest instanceof PortletResourceRequest)
- {
- PortletInvocationResponse response = invoke(containerRequest);
-
- //
- if (response instanceof FragmentResponse)
- {
- FragmentResponse fragment = (FragmentResponse)response;
- ResponseProperties props = fragment.getProperties();
-
- //
- if (props != null)
- {
- renderTransportHeaders(props, resp);
- renderCookies(props, resp);
- }
-
- //
- if (fragment.getType() == FragmentResponse.TYPE_EMPTY)
- {
- resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
- }
- else
- {
- String contentType = fragment.getContentType();
- if (contentType != null)
- {
- resp.setContentType(contentType);
- }
-
- //
- if (fragment.getType() == FragmentResponse.TYPE_BYTES)
- {
- ServletOutputStream out = null;
- try
- {
- out = resp.getOutputStream();
- out.write(fragment.getBytes().toByteArray());
- }
- finally
- {
- IOTools.safeClose(out);
- }
- }
- else
- {
- Writer writer = null;
- try
- {
- writer = resp.getWriter();
- writer.write(fragment.getChars().toString());
- }
- finally
- {
- writer.close();
- }
- }
- }
- }
- else
- {
- // todo
- }
- }
- }
-
/**
* @param context
* @param pageProperties properties that needs to be rendered on this page
@@ -861,7 +850,6 @@
static class ControllerRequest
{
-
/** . */
final PortletControllerContext controllerContext;
@@ -895,7 +883,6 @@
static class PortletRequest extends ContainerRequest
{
-
/** . */
final PageNavigationalState pageState;
@@ -918,7 +905,6 @@
static abstract class PortletResourceRequest extends ContainerRequest
{
-
/** . */
private static final Map<Class, CacheLevel> cacheability = new HashMap<Class, CacheLevel>();
@@ -975,7 +961,6 @@
static class PortletScopedPortletResourceRequest extends FullScopedCacheablePortletResourceRequest
{
-
/** . */
final WindowNavigationalState windowNavigationalState;
@@ -996,7 +981,6 @@
static class PageScopedFullPortletResourceRequest extends PortletScopedPortletResourceRequest
{
-
/** . */
private final PageNavigationalState pageState;
@@ -1018,7 +1002,6 @@
static class PortletActionRequest extends PortletRequest
{
-
/** . */
final StateString interactionState;
@@ -1043,7 +1026,6 @@
static class PortletRenderRequest extends PortletRequest
{
-
/** . */
final Map<String, String[]> publicNavigationalStateChanges;
16 years, 3 months
JBoss Portal SVN: r9655 - modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-01-30 12:50:44 -0500 (Wed, 30 Jan 2008)
New Revision: 9655
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/ForwardFromActionEventObjectsTestCase.java
Log:
forward Action/Event
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/ForwardFromActionEventObjectsTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/ForwardFromActionEventObjectsTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/ForwardFromActionEventObjectsTestCase.java 2008-01-30 17:50:44 UTC (rev 9655)
@@ -0,0 +1,385 @@
+/*
+* 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.PortletTestContext;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.unit.actions.PortletActionTestAction;
+import org.jboss.portal.unit.actions.PortletEventTestAction;
+import org.jboss.portal.unit.actions.ServletServiceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTS1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertNotNull;
+import static org.jboss.unit.api.Assert.assertNull;
+import static org.jboss.unit.api.Assert.assertEquals;
+import static org.jboss.unit.api.Assert.assertTrue;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.Cookie;
+import java.io.IOException;
+import java.io.Writer;
+import java.io.OutputStream;
+import java.util.Locale;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Enumeration;
+import java.util.Map;
+import java.util.Collections;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@TestCase
+public class ForwardFromActionEventObjectsTestCase
+{
+ private int actionCount = 0;
+
+ private int eventCount = 0;
+
+ public ForwardFromActionEventObjectsTestCase(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
+ {
+ // Invoke render with header
+ InvokeGetResponse action = new InvokeGetResponse(response.createActionURL().toString());
+ action.addHeader("myheader").addElement("render-value");
+ return action;
+
+
+ }
+ });
+
+ seq.bindAction(1, UTP1.ACTION_JOIN_POINT, new PortletActionTestAction()
+ {
+ protected void run(Portlet portlet, ActionRequest request, ActionResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ actionCount++;
+
+
+ //we dispatch to servlet and assertions will be done there
+ String queryString = "?key1=k1value1&key2=k2value1";
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/universalServletA" + queryString);
+ response.setEvent("Event",null);
+ dispatcher.forward(request, response);
+
+ }
+ });
+
+ seq.bindAction(1, UTP1.EVENT_JOIN_POINT, new PortletEventTestAction()
+ {
+ protected void run(Portlet portlet, EventRequest request, EventResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ eventCount++;
+
+ //we dispatch to servlet and assertions will be done there
+ String queryString = "?key1=k1value1&key2=k2value1";
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/universalServletA" + queryString);
+ dispatcher.forward(request, response);
+
+ }
+ });
+
+
+ seq.bindAction(1, UTS1.SERVICE_JOIN_POINT, new ServletServiceTestAction()
+ {
+ protected DriverResponse run(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException
+ {
+ check(request, response);
+
+ //Only if both action and even was invoked
+ if (actionCount == 1 && eventCount == 1)
+ {
+ return new EndTestResponse();
+ }
+ else
+ {
+ return null;
+ }
+ }
+ });
+ }
+
+ public void check(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
+ {
+ //we get this object to assert some of it's method compare wieth http request methods
+ PortletRequest portletRequest = (PortletRequest)request.getAttribute("javax.portlet.request");
+ PortletResponse portletResponse = (PortletResponse)request.getAttribute("javax.portlet.response");
+
+ assertNotNull(portletRequest);
+ assertNotNull(portletResponse);
+
+ //SPEC:258
+ //Those should do nothing - some of the getters will be checked later
+ response.setContentType("lolo");
+ response.setCharacterEncoding("toto");
+ response.setContentLength(22);
+ response.setLocale(Locale.TRADITIONAL_CHINESE);
+ response.sendError(404,"bobo");
+ response.setDateHeader("bobo",11);
+ response.addDateHeader("bobo",21);
+ response.setHeader("bobo", "toto");
+ response.addHeader("bobo", "bubu");
+ response.setIntHeader("toto",13);
+ response.addIntHeader("lala",25);
+ response.setStatus(505);
+ response.setBufferSize(12);
+ response.resetBuffer();
+ response.reset();
+ response.flushBuffer();
+
+
+ //SPEC:243
+ assertNull(request.getRemoteAddr());
+ assertNull(request.getRemoteHost());
+ assertNull(request.getRealPath("toto"));
+ assertNull(request.getLocalAddr());
+ assertNull(request.getLocalName());
+ assertNull(request.getRequestURL());
+
+ //SPEC:244
+ assertEquals(0, request.getRemotePort());
+ assertEquals(0, request.getLocalPort());
+
+ //SPEC:245
+
+ assertEquals(null, request.getPathInfo());
+ //TODO:NYI
+ //assertEquals("",request.getPathTranslated());
+ assertEquals("key1=k1value1&key2=k2value1", request.getQueryString());
+
+ assertEquals("/test-jsr286-tck-dispatcher/universalServletA",request.getRequestURI());
+ assertEquals("/universalServletA", request.getServletPath());
+
+ //SPEC:246
+ assertEquals(portletRequest.getScheme(), request.getScheme());
+ assertEquals(portletRequest.getServerName(), request.getServerName());
+ assertEquals(portletRequest.getServerPort(), request.getServerPort());
+
+ // getAttributeNames, setAttribute, getAttribute, removeAttribute
+ request.setAttribute("key1", "k1atrr1");
+ request.setAttribute("key2", "k2attr2");
+ List attrNames = new LinkedList();
+ Enumeration attrEnum = request.getAttributeNames();
+ while (attrEnum.hasMoreElements())
+ {
+ attrNames.add(attrEnum.nextElement());
+ }
+ assertNotNull(request.getAttribute("key1"));
+ assertNotNull(request.getAttribute("key2"));
+
+ assertTrue(attrNames.contains("key1"));
+ assertTrue(attrNames.contains("key2"));
+
+ request.removeAttribute("key1");
+ assertNull(request.getAttribute("key1"));
+ assertNotNull(request.getAttribute("key2"));
+
+ //getLocale, getLocales
+ assertEquals(portletRequest.getLocale(), request.getLocale());
+
+ List portletLocales = new LinkedList();
+ List servletLocales = new LinkedList();
+ Enumeration pl = portletRequest.getLocales();
+ while (pl.hasMoreElements())
+ {
+ portletLocales.add(pl.nextElement());
+ }
+ Enumeration sl = request.getLocales();
+ while (sl.hasMoreElements())
+ {
+ servletLocales.add(sl.nextElement());
+ }
+
+ assertTrue(portletLocales.equals(servletLocales));
+
+ assertEquals(portletRequest.isSecure(), request.isSecure());
+ assertEquals(portletRequest.getAuthType(), request.getAuthType());
+ assertEquals(portletRequest.getContextPath(), request.getContextPath());
+ assertEquals(portletRequest.getRemoteUser(), request.getRemoteUser());
+ assertEquals(portletRequest.getUserPrincipal(), request.getUserPrincipal());
+ assertEquals(portletRequest.getRequestedSessionId(), request.getRequestedSessionId());
+ assertEquals(portletRequest.isRequestedSessionIdValid(), request.isRequestedSessionIdValid());
+ assertEquals(portletRequest.getCookies(), request.getCookies());
+
+ //SPEC:247
+ //in this assertions we use parameters passed in query string of dispatcher
+ List paramNames = new LinkedList();
+ Enumeration paramEnum = request.getParameterNames();
+ while (paramEnum.hasMoreElements())
+ {
+ paramNames.add(paramEnum.nextElement());
+ }
+ assertTrue(paramNames.contains("key1"));
+ assertTrue(paramNames.contains("key2"));
+
+ assertEquals("k1value1", request.getParameter("key1"));
+ assertEquals(new String[]{"k1value1"}, request.getParameterValues("key1"));
+
+ Map paramNamesMap = request.getParameterMap();
+ assertTrue(paramNamesMap.containsKey("key1"));
+ assertTrue(paramNamesMap.containsKey("key2"));
+
+
+
+ //Action only
+ if (actionCount == 1 && eventCount == 0)
+ {
+ ActionRequest actionRequest = (ActionRequest)portletRequest;
+
+ //SPEC:248
+ try
+ {
+ // request was already read
+ request.setCharacterEncoding("utf8");
+ assertTrue(false);
+ }
+ catch (IllegalStateException e)
+ {
+ //expected
+ }
+ assertEquals(actionRequest.getCharacterEncoding(), request.getCharacterEncoding());
+ assertEquals(actionRequest.getContentType(), request.getContentType());
+ //TODO: How to check if its the same behaviour as in PR? Its not the same object.
+ assertNotNull(request.getInputStream());
+ assertEquals(actionRequest.getContentLength(), request.getContentLength());
+ assertEquals(actionRequest.getMethod(), request.getMethod());
+ // Underlaying impl invoke getImputStream so cannot test in single request
+ //assertEquals(actionRequest.getReader(), request.getReader());
+ }
+
+ //Event only
+ if (actionCount == 1 && eventCount == 1)
+ {
+ EventRequest eventRequest = (EventRequest)portletRequest;
+
+ //SPEC:249
+ request.setCharacterEncoding("utf8");
+ assertNull(request.getCharacterEncoding());
+ assertNull(request.getContentType());
+ assertNull(request.getInputStream());
+ assertNull(request.getReader());
+
+ //SPEC:250
+ assertEquals(0, request.getContentLength());
+
+ //SPEC:251
+ assertEquals(eventRequest.getMethod(), request.getMethod());
+ }
+
+ //SPEC:252
+ assertEquals(portletRequest.getProperty("myheader"), request.getHeader("myheader"));
+ List rheaders = Collections.list(request.getHeaders("myheader"));
+ List pheaders = Collections.list(portletRequest.getProperties("myheader"));
+
+ for (Iterator iterator = pheaders.iterator(); iterator.hasNext();)
+ {
+ Object o = iterator.next();
+ assertTrue(rheaders.contains(o));
+ }
+
+ List headerNames = Collections.list(request.getHeaderNames());
+ Enumeration propertyNamesE = portletRequest.getPropertyNames();
+ while (propertyNamesE.hasMoreElements())
+ {
+ Object o = propertyNamesE.nextElement();
+ assertTrue(headerNames.contains(o));
+ }
+ assertTrue(headerNames.contains("myheader"));
+
+ //TODO: seems to not be implemented
+ //assertEquals("What?", request.getDateHeader("What?"));
+ //assertEquals("What?", request.getIntHeader("What?"));
+
+ //SPEC:253
+ //TODO:
+ //TODO: The following methods of the HttpServletRequest must provide the
+ //TODO: functionality defined by the Servlet Specification: getRequestDispatcher, isUserInRole, getSession,
+ //TODO: isRequestedSessionIdFromCookie, isRequestedSessionIdFromURL and isRequestedSessionIdFromUrl.
+
+
+ //SPEC:254
+ assertEquals("HTTP/1.1", request.getProtocol());
+
+ //SPEC:255
+ assertNull(response.encodeRedirectURL("lolo"));
+ assertNull(response.encodeRedirectUrl("bobo"));
+ assertNull(response.getCharacterEncoding());
+ assertNull(response.getContentType());
+ assertNull(response.getLocale());
+ //TODO:fail
+ //assertNull(response.getBufferSize());
+
+
+ //SPEC:256
+ //If it work it will break the result no?
+ Writer writer = response.getWriter();
+ writer.write("lolo a toto a bobo");
+ writer.flush();
+
+ OutputStream os = response.getOutputStream();
+ os.write(24);
+ os.write(new byte[]{25, 29, 25});
+ os.flush();
+
+
+ //SPEC:257
+ assertEquals(portletResponse.encodeURL("http://www.jboss.com/"), response.encodeURL("http://www.jboss.com/"));
+ assertEquals(portletResponse.encodeURL("http://www.jboss.com/"), response.encodeUrl("http://www.jboss.com/"));
+
+ //SPEC:259
+ //TODO: addCookie
+
+
+
+ //SPEC:260
+ assertEquals(false, response.containsHeader("toto"));
+
+ //SPEC:261
+ assertEquals(false, response.isCommitted());
+ }
+}
16 years, 3 months
JBoss Portal SVN: r9654 - modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-01-30 12:06:11 -0500 (Wed, 30 Jan 2008)
New Revision: 9654
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromActionEventObjectsTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromRenderObjectsTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromResourceObjectsTestCase.java
Log:
Include tests update
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromActionEventObjectsTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromActionEventObjectsTestCase.java 2008-01-30 15:13:12 UTC (rev 9653)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromActionEventObjectsTestCase.java 2008-01-30 17:06:11 UTC (rev 9654)
@@ -33,6 +33,7 @@
import org.jboss.portal.unit.actions.PortletEventTestAction;
import org.jboss.portal.test.portlet.framework.UTP1;
import org.jboss.portal.test.portlet.framework.UTS1;
+import org.jboss.portal.test.portlet.framework.UTP6;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.response.EndTestResponse;
import static org.jboss.unit.api.Assert.assertNotNull;
@@ -67,6 +68,8 @@
import java.util.Enumeration;
import java.util.Map;
import java.util.Locale;
+import java.util.Collections;
+import java.util.Iterator;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
@@ -103,12 +106,15 @@
public IncludeFromActionEventObjectsTestCase(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
{
- PortletURL actionURL = response.createActionURL();
- return new InvokeGetResponse(actionURL.toString());
+ // Invoke render with header
+ InvokeGetResponse action = new InvokeGetResponse(response.createActionURL().toString());
+ action.addHeader("myheader").addElement("render-value");
+ return action;
}
@@ -332,25 +338,24 @@
}
//SPEC:194
+ assertEquals(portletRequest.getProperty("myheader"), request.getHeader("myheader"));
+ List rheaders = Collections.list(request.getHeaders("myheader"));
+ List pheaders = Collections.list(portletRequest.getProperties("myheader"));
- //TODO:which values to use?
- //assertEquals(portletRequest.getProperty("What?"), request.getHeader("What?"));
- //assertEquals(portletRequest.getProperties("What?"), request.getHeaders("What?"));
- Enumeration headerNamesE = request.getHeaderNames();
-
- List headerNames = new LinkedList();
- while (headerNamesE.hasMoreElements())
+ for (Iterator iterator = pheaders.iterator(); iterator.hasNext();)
{
- Object o = headerNamesE.nextElement();
- headerNames.add(o);
+ Object o = iterator.next();
+ assertTrue(rheaders.contains(o));
}
+ List headerNames = Collections.list(request.getHeaderNames());
Enumeration propertyNamesE = portletRequest.getPropertyNames();
while (propertyNamesE.hasMoreElements())
{
Object o = propertyNamesE.nextElement();
assertTrue(headerNames.contains(o));
}
+ assertTrue(headerNames.contains("myheader"));
//TODO: seems to not be implemented
//assertEquals("What?", request.getDateHeader("What?"));
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromRenderObjectsTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromRenderObjectsTestCase.java 2008-01-30 15:13:12 UTC (rev 9653)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromRenderObjectsTestCase.java 2008-01-30 17:06:11 UTC (rev 9654)
@@ -31,13 +31,17 @@
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.test.portlet.framework.UTP6;
+import org.jboss.portal.common.util.Tools;
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.assertNull;
import static org.jboss.unit.api.Assert.assertEquals;
import static org.jboss.unit.api.Assert.assertTrue;
+import static org.jboss.unit.api.Assert.assertFalse;
import org.jboss.unit.api.pojo.annotations.Test;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
import javax.portlet.Portlet;
import javax.portlet.RenderRequest;
@@ -49,11 +53,17 @@
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.Cookie;
import java.io.IOException;
import java.util.List;
import java.util.LinkedList;
import java.util.Enumeration;
import java.util.Map;
+import java.util.Locale;
+import java.util.Set;
+import java.util.Collections;
+import java.util.Arrays;
+import java.util.Iterator;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
@@ -84,6 +94,18 @@
{
seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
{
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context)
+ {
+ // 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
{
//we dispatch to servlet and assertions will be done there
@@ -96,7 +118,7 @@
});
- seq.bindAction(0, UTS1.SERVICE_JOIN_POINT, new ServletServiceTestAction()
+ seq.bindAction(1, UTS1.SERVICE_JOIN_POINT, new ServletServiceTestAction()
{
protected DriverResponse run(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException
{
@@ -107,6 +129,23 @@
assertNotNull(portletRequest);
assertNotNull(portletResponse);
+ //SPEC:117
+ //Those should do nothing - some of the getters will be checked later
+ response.setContentType("lolo");
+ response.setContentLength(22);
+ response.setLocale(Locale.TRADITIONAL_CHINESE);
+ response.addCookie(new Cookie("lolo", "bobo"));
+ response.sendError(404,"bobo");
+ response.sendRedirect("http://www.jboss.org");
+ response.setDateHeader("bobo",11);
+ response.addDateHeader("bobo",21);
+ response.setHeader("bobo", "toto");
+ response.addHeader("bobo", "bubu");
+ response.setIntHeader("toto",13);
+ response.addIntHeader("lala",25);
+ response.setStatus(505);
+
+
//SPEC:104
assertNull(request.getRemoteAddr());
assertNull(request.getRemoteHost());
@@ -120,13 +159,12 @@
assertEquals(0, request.getLocalPort());
//SPEC:106
- //TODO:getPathInfo
- //assertEquals(null, request.getPathInfo());
- //TODO:getPathTranslated
+ assertEquals(null, request.getPathInfo());
+ //TODO:NYI
//assertEquals("",request.getPathTranslated());
assertEquals("key1=k1value1&key2=k2value1", request.getQueryString());
- //TODO:getRequestURI
- //assertEquals("/requestObjectServlet",request.getRequestURI());
+
+ assertEquals("/test-jsr286-tck-dispatcher/universalServletA",request.getRequestURI());
assertEquals("/universalServletA", request.getServletPath());
@@ -134,8 +172,6 @@
assertEquals(portletRequest.getScheme(), request.getScheme());
assertEquals(portletRequest.getServerName(), request.getServerName());
assertEquals(portletRequest.getServerPort(), request.getServerPort());
- //TODO:fail
- //assertEquals(portletRequest.getAttributeNames(), request.getAttributeNames());
// getAttributeNames, setAttribute, getAttribute, removeAttribute
request.setAttribute("key1", "k1atrr1");
request.setAttribute("key2", "k2attr2");
@@ -180,9 +216,9 @@
assertEquals(portletRequest.getUserPrincipal(), request.getUserPrincipal());
assertEquals(portletRequest.getRequestedSessionId(), request.getRequestedSessionId());
assertEquals(portletRequest.isRequestedSessionIdValid(), request.isRequestedSessionIdValid());
- //TODO:fail
- //assertEquals(portletRequest.getCookies(), request.getCookies());
+ assertEquals(portletRequest.getCookies(), request.getCookies());
+
//SPEC:108
//in this assertions we use parameters passed in query string of dispatcher
List paramNames = new LinkedList();
@@ -212,17 +248,40 @@
assertEquals(0, request.getContentLength());
//SPEC:111
- //TODO:
+ assertEquals(portletRequest.getProperty("myheader"), request.getHeader("myheader"));
+ List rheaders = Collections.list(request.getHeaders("myheader"));
+ List pheaders = Collections.list(portletRequest.getProperties("myheader"));
+ for (Iterator iterator = pheaders.iterator(); iterator.hasNext();)
+ {
+ Object o = iterator.next();
+ assertTrue(rheaders.contains(o));
+ }
+
+ List headerNames = Collections.list(request.getHeaderNames());
+ Enumeration propertyNamesE = portletRequest.getPropertyNames();
+ while (propertyNamesE.hasMoreElements())
+ {
+ Object o = propertyNamesE.nextElement();
+ assertTrue(headerNames.contains(o));
+ }
+ assertTrue(headerNames.contains("myheader"));
+
+ //TODO: seems to not be implemented
+ //assertEquals("?", request.getDateHeader("myheader"));
+ //assertEquals("?", request.getIntHeader("myheader"));
+
//SPEC:112
//TODO:
+ //TODO: The following methods of the HttpServletRequest must provide the
+ //TODO: functionality defined by the Servlet Specification: getRequestDispatcher, isUserInRole, getSession,
+ //TODO: isRequestedSessionIdFromCookie, isRequestedSessionIdFromURL and isRequestedSessionIdFromUrl.
//SPEC:113
assertEquals("GET", request.getMethod());
//SPEC:114
- //TODO:fail
- //assertEquals("HTTP/1.1", request.getProtocol());
+ assertEquals("HTTP/1.1", request.getProtocol());
//SPEC:115
assertNull(response.encodeRedirectURL("lolo"));
@@ -233,13 +292,13 @@
//TODO: setBufferSize, flushBuffer, resetBuffer, reset
assertEquals(portletResponse.getBufferSize(), response.getBufferSize());
assertEquals(portletResponse.isCommitted(), response.isCommitted());
- //TODO:fail
- //assertEquals(portletResponse.getPortletOutputStream(), response.getOutputStream());
- assertEquals(portletResponse.getWriter(), response.getWriter());
- //TODO: encodeURL, encodeUrl
+ //TODO: How to check if its the same behaviour as in PR? Its not the same object.
+ assertNotNull(response.getOutputStream());
+ //Cannot invoke both writer and outputstream in single request
+ //assertEquals(portletResponse.getWriter(), response.getWriter());
+ assertEquals(portletResponse.encodeURL("http://www.jboss.com/"), response.encodeURL("http://www.jboss.com/"));
+ assertEquals(portletResponse.encodeURL("http://www.jboss.com/"), response.encodeUrl("http://www.jboss.com/"));
- //SPEC:117
- //TODO:
//SPEC:118
assertEquals(false, response.containsHeader("blah"));
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromResourceObjectsTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromResourceObjectsTestCase.java 2008-01-30 15:13:12 UTC (rev 9653)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromResourceObjectsTestCase.java 2008-01-30 17:06:11 UTC (rev 9654)
@@ -53,11 +53,15 @@
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.Cookie;
import java.io.IOException;
import java.util.List;
import java.util.LinkedList;
import java.util.Enumeration;
import java.util.Map;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Locale;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
@@ -80,7 +84,6 @@
})
public class IncludeFromResourceObjectsTestCase
{
- private String blah;
public IncludeFromResourceObjectsTestCase(PortletTestCase seq)
{
@@ -88,9 +91,9 @@
{
protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
{
- blah = response.createRenderURL().toString();
- ResourceURL resourceURL = response.createResourceURL();
- return new InvokeGetResponse(resourceURL.toString());
+ InvokeGetResponse resource = new InvokeGetResponse(response.createResourceURL().toString());
+ resource.addHeader("myheader").addElement("render-value");
+ return resource;
}
});
@@ -103,11 +106,10 @@
PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/universalServletA" + queryString);
response.setContentType("text/html");
dispatcher.include(request, response);
- return new InvokeGetResponse(blah);
+ return null;
}
});
-
seq.bindAction(1, UTS1.SERVICE_JOIN_POINT, new ServletServiceTestAction()
{
protected DriverResponse run(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException
@@ -119,6 +121,23 @@
assertNotNull(portletRequest);
assertNotNull(portletResponse);
+ //SPEC:231
+ //Those should do nothing - some of the getters will be checked later
+ response.setCharacterEncoding("lolo");
+ response.setContentType("lolo");
+ response.setContentLength(22);
+ response.setLocale(Locale.TRADITIONAL_CHINESE);
+ response.addCookie(new Cookie("lolo", "bobo"));
+ response.sendError(404,"bobo");
+ response.sendRedirect("http://www.jboss.org");
+ response.setDateHeader("bobo",11);
+ response.addDateHeader("bobo",21);
+ response.setHeader("bobo", "toto");
+ response.addHeader("bobo", "bubu");
+ response.setIntHeader("toto",13);
+ response.addIntHeader("lala",25);
+ response.setStatus(505);
+
//SPEC:220
assertNull(request.getRemoteAddr());
assertNull(request.getRemoteHost());
@@ -132,13 +151,11 @@
assertEquals(0, request.getLocalPort());
//SPEC:222
- //TODO:getPathInfo
- //assertEquals(null, request.getPathInfo());
- //TODO:getPathTranslated
+ assertEquals(null, request.getPathInfo());
+ //TODO:NYI
//assertEquals("",request.getPathTranslated());
assertEquals("key1=k1value1&key2=k2value1", request.getQueryString());
- //TODO:getRequestURI
- //assertEquals("/requestObjectServlet",request.getRequestURI());
+ assertEquals("/test-jsr286-tck-dispatcher/universalServletA",request.getRequestURI());
assertEquals("/universalServletA", request.getServletPath());
@@ -146,8 +163,7 @@
assertEquals(portletRequest.getScheme(), request.getScheme());
assertEquals(portletRequest.getServerName(), request.getServerName());
assertEquals(portletRequest.getServerPort(), request.getServerPort());
- //TODO:fail
- //assertEquals(portletRequest.getAttributeNames(), request.getAttributeNames());
+
// getAttributeNames, setAttribute, getAttribute, removeAttribute
request.setAttribute("key1", "k1atrr1");
request.setAttribute("key2", "k2attr2");
@@ -195,8 +211,24 @@
assertEquals(portletRequest.getCookies(), request.getCookies());
//SPEC:224
- //TODO:
+ try
+ {
+ // request was already read
+ request.setCharacterEncoding("utf8");
+ assertTrue(false);
+ }
+ catch (IllegalStateException e)
+ {
+ //expected
+ }
+ assertEquals(portletRequest.getCharacterEncoding(), request.getCharacterEncoding());
+ //
+ assertEquals(portletRequest.getContentType(), request.getContentType());
+ assertEquals(portletRequest.getMethod(), request.getMethod());
+ assertEquals(portletRequest.getContentLength(), request.getContentLength());
+ assertEquals(portletRequest.getReader(), request.getReader());
+
//SPEC:225
//in this assertions we use parameters passed in query string of dispatcher
List paramNames = new LinkedList();
@@ -216,10 +248,34 @@
assertTrue(paramNamesMap.containsKey("key2"));
//SPEC:226
- //TODO:
+ assertEquals(portletRequest.getProperty("myheader"), request.getHeader("myheader"));
+ List rheaders = Collections.list(request.getHeaders("myheader"));
+ List pheaders = Collections.list(portletRequest.getProperties("myheader"));
+ for (Iterator iterator = pheaders.iterator(); iterator.hasNext();)
+ {
+ Object o = iterator.next();
+ assertTrue(rheaders.contains(o));
+ }
+
+ List headerNames = Collections.list(request.getHeaderNames());
+ Enumeration propertyNamesE = portletRequest.getPropertyNames();
+ while (propertyNamesE.hasMoreElements())
+ {
+ Object o = propertyNamesE.nextElement();
+ assertTrue(headerNames.contains(o));
+ }
+ assertTrue(headerNames.contains("myheader"));
+
+ //TODO: seems to not be implemented
+ //assertEquals("?", request.getDateHeader("myheader"));
+ //assertEquals("?", request.getIntHeader("myheader"));
+
//SPEC:227
//TODO:
+ //TODO: The following methods of the HttpServletRequest must provide the
+ //TODO: functionality defined by the Servlet Specification: getRequestDispatcher, isUserInRole, getSession,
+ //TODO: isRequestedSessionIdFromCookie, isRequestedSessionIdFromURL and isRequestedSessionIdFromUrl.
//SPEC:228
assertEquals("HTTP/1.1", request.getProtocol());
@@ -234,29 +290,24 @@
//TODO: setBufferSize, flushBuffer, resetBuffer, reset
assertEquals(portletResponse.getBufferSize(), response.getBufferSize());
assertEquals(portletResponse.isCommitted(), response.isCommitted());
- //TODO:fail
- //assertEquals(portletResponse.getPortletOutputStream(), response.getOutputStream());
- assertEquals(portletResponse.getWriter(), response.getWriter());
+ //TODO: How to check if its the same behaviour as in PR? Its not the same object.
+ assertNotNull(response.getOutputStream());
+ //Cannot invoke both writer and outputstream in single request
+ //assertEquals(portletResponse.getWriter(), response.getWriter());
assertEquals(portletResponse.getLocale(), response.getLocale());
- //TODO: encodeURL, encodeUrl
+ assertEquals(portletResponse.encodeURL("http://www.jboss.com/"), response.encodeURL("http://www.jboss.com/"));
+ assertEquals(portletResponse.encodeURL("http://www.jboss.com/"), response.encodeUrl("http://www.jboss.com/"));
- //SPEC:231
- //TODO:
+
//SPEC:232
assertEquals(false, response.containsHeader("blah"));
- return null;
+ return new EndTestResponse();
}
});
- seq.bindAction(2, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
- {
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
- {
- return new EndTestResponse();
- }
- });
+
}
}
16 years, 3 months
JBoss Portal SVN: r9653 - in modules/portlet/trunk/portlet/src: test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher and 1 other directory.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-01-30 10:13:12 -0500 (Wed, 30 Jan 2008)
New Revision: 9653
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromActionEventObjectsTestCase.java
Log:
- updated Action/Event include tests
- pathInfo fix
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 14:33:07 UTC (rev 9652)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java 2008-01-30 15:13:12 UTC (rev 9653)
@@ -139,13 +139,13 @@
if (endOfServletPath == -1)
{
servletPath = path;
- pathInfo = "";
+ pathInfo = null;
queryString = "";
}
else
{
servletPath = path.substring(0, endOfServletPath);
- pathInfo = "";
+ pathInfo = null;
queryString = path.substring(endOfServletPath + 1);
}
}
@@ -164,7 +164,7 @@
queryString = path.substring(endOfPathInfo + 1);
}
}
- String requestURI = preq.getContextPath() + servletPath + pathInfo;
+ String requestURI = preq.getContextPath() + servletPath + (pathInfo != null ? pathInfo : "");
//
Map<String, String> attrs = new HashMap<String, String>();
@@ -540,7 +540,7 @@
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()
{
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromActionEventObjectsTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromActionEventObjectsTestCase.java 2008-01-30 14:33:07 UTC (rev 9652)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/dispatcher/IncludeFromActionEventObjectsTestCase.java 2008-01-30 15:13:12 UTC (rev 9653)
@@ -57,11 +57,16 @@
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.Cookie;
import java.io.IOException;
+import java.io.Writer;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.LinkedList;
import java.util.Enumeration;
import java.util.Map;
+import java.util.Locale;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
@@ -86,7 +91,8 @@
Assertion.JSR286_199,
Assertion.JSR286_200,
Assertion.JSR286_201,
- Assertion.JSR286_202
+ Assertion.JSR286_202,
+ Assertion.JSR286_203
})
public class IncludeFromActionEventObjectsTestCase
@@ -167,6 +173,26 @@
assertNotNull(portletRequest);
assertNotNull(portletResponse);
+ //SPEC:201
+ //Those should do nothing - some of the getters will be checked later
+ response.setContentType("lolo");
+ response.setCharacterEncoding("toto");
+ response.setContentLength(22);
+ response.setLocale(Locale.TRADITIONAL_CHINESE);
+ response.addCookie(new Cookie("lolo", "bobo"));
+ response.sendError(404,"bobo");
+ response.sendRedirect("http://www.jboss.org");
+ response.setDateHeader("bobo",11);
+ response.addDateHeader("bobo",21);
+ response.setHeader("bobo", "toto");
+ response.addHeader("bobo", "bubu");
+ response.setIntHeader("toto",13);
+ response.addIntHeader("lala",25);
+ response.setStatus(505);
+ response.setBufferSize(12);
+ response.flushBuffer();
+
+
//SPEC:185
assertNull(request.getRemoteAddr());
assertNull(request.getRemoteHost());
@@ -181,21 +207,18 @@
//SPEC:187
- //TODO:getPathInfo
- //assertEquals(null, request.getPathInfo());
- //TODO:getPathTranslated
+ assertEquals(null, request.getPathInfo());
+ //TODO:NYI
//assertEquals("",request.getPathTranslated());
assertEquals("key1=k1value1&key2=k2value1", request.getQueryString());
- //TODO:getRequestURI
- //assertEquals("/requestObjectServlet",request.getRequestURI());
+
+ assertEquals("/test-jsr286-tck-dispatcher/universalServletA",request.getRequestURI());
assertEquals("/universalServletA", request.getServletPath());
//SPEC:188
assertEquals(portletRequest.getScheme(), request.getScheme());
assertEquals(portletRequest.getServerName(), request.getServerName());
assertEquals(portletRequest.getServerPort(), request.getServerPort());
- //TODO:fail
- //assertEquals(portletRequest.getAttributeNames(), request.getAttributeNames());
// getAttributeNames, setAttribute, getAttribute, removeAttribute
request.setAttribute("key1", "k1atrr1");
@@ -269,15 +292,24 @@
ActionRequest actionRequest = (ActionRequest)portletRequest;
//SPEC:190
- //TODO:fail
- //request.setCharacterEncoding("utf8");
+ try
+ {
+ // request was already read
+ request.setCharacterEncoding("utf8");
+ assertTrue(false);
+ }
+ catch (IllegalStateException e)
+ {
+ //expected
+ }
assertEquals(actionRequest.getCharacterEncoding(), request.getCharacterEncoding());
assertEquals(actionRequest.getContentType(), request.getContentType());
- //TODO:fail
- //assertEquals(actionRequest.getPortletInputStream(), request.getInputStream());
+ //TODO: How to check if its the same behaviour as in PR? Its not the same object.
+ assertNotNull(request.getInputStream());
assertEquals(actionRequest.getContentLength(), request.getContentLength());
assertEquals(actionRequest.getMethod(), request.getMethod());
- assertEquals(actionRequest.getReader(), request.getReader());
+ // Underlaying impl invoke getImputStream so cannot test in single request
+ //assertEquals(actionRequest.getReader(), request.getReader());
}
//Event only
@@ -300,11 +332,37 @@
}
//SPEC:194
- //TODO:
+ //TODO:which values to use?
+ //assertEquals(portletRequest.getProperty("What?"), request.getHeader("What?"));
+ //assertEquals(portletRequest.getProperties("What?"), request.getHeaders("What?"));
+ Enumeration headerNamesE = request.getHeaderNames();
+
+ List headerNames = new LinkedList();
+ while (headerNamesE.hasMoreElements())
+ {
+ Object o = headerNamesE.nextElement();
+ headerNames.add(o);
+ }
+
+ Enumeration propertyNamesE = portletRequest.getPropertyNames();
+ while (propertyNamesE.hasMoreElements())
+ {
+ Object o = propertyNamesE.nextElement();
+ assertTrue(headerNames.contains(o));
+ }
+
+ //TODO: seems to not be implemented
+ //assertEquals("What?", request.getDateHeader("What?"));
+ //assertEquals("What?", request.getIntHeader("What?"));
+
//SPEC:195
//TODO:
+ //TODO: The following methods of the HttpServletRequest must provide the
+ //TODO: functionality defined by the Servlet Specification: getRequestDispatcher, isUserInRole, getSession,
+ //TODO: isRequestedSessionIdFromCookie, isRequestedSessionIdFromURL and isRequestedSessionIdFromUrl.
+
//SPEC:196
assertEquals("HTTP/1.1", request.getProtocol());
@@ -314,22 +372,34 @@
assertNull(response.getCharacterEncoding());
assertNull(response.getContentType());
assertNull(response.getLocale());
- //TODO:
+
+ //TODO: those are in the spec but are void so hard to test... :)
//resetBuffer, reset
//SPEC:198
assertEquals(0, response.getBufferSize());
//SPEC:199
- //TODO:
+ //If it work it will break the result no?
+ Writer writer = response.getWriter();
+ writer.write("lolo a toto a bobo");
+ writer.flush();
+ OutputStream os = response.getOutputStream();
+ os.write(24);
+ os.write(new byte[]{25, 29, 25});
+ os.flush();
+
+
//SPEC:200
- //TODO:
+ assertEquals(portletResponse.encodeURL("http://www.jboss.com/"), response.encodeURL("http://www.jboss.com/"));
+ assertEquals(portletResponse.encodeURL("http://www.jboss.com/"), response.encodeUrl("http://www.jboss.com/"));
- //SPEC:201
+
+ //SPEC:202
assertEquals(false, response.containsHeader("toto"));
- //SPEC:202
+ //SPEC:203
assertEquals(true, response.isCommitted());
}
16 years, 3 months
JBoss Portal SVN: r9652 - modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-01-30 09:33:07 -0500 (Wed, 30 Jan 2008)
New Revision: 9652
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java
Log:
update
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-30 14:26:18 UTC (rev 9651)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java 2008-01-30 14:33:07 UTC (rev 9652)
@@ -151,6 +151,8 @@
public final void setCharacterEncoding(String s)
{
+ //TODO: must perform nothing for include but in forward must delegate to portlet response
+
}
// Must return false
16 years, 3 months
JBoss Portal SVN: r9651 - modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-01-30 09:26:18 -0500 (Wed, 30 Jan 2008)
New Revision: 9651
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java
Log:
must perform no operations
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-30 11:54:53 UTC (rev 9650)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletResponse.java 2008-01-30 14:26:18 UTC (rev 9651)
@@ -151,7 +151,6 @@
public final void setCharacterEncoding(String s)
{
- throw new NotYetImplemented();
}
// Must return false
16 years, 3 months