myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfreed...@apache.org
Subject svn commit: r951503 - /myfaces/portlet-bridge/tck/tags/jsr301-1.0.0/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java
Date Fri, 04 Jun 2010 17:46:49 GMT
Author: mfreedman
Date: Fri Jun  4 17:46:48 2010
New Revision: 951503

URL: http://svn.apache.org/viewvc?rev=951503&view=rev
Log:
PORTLETBRIDGE-147: getRequestHeadermapActionTest fails if content-length excluded by bridge
but in request

Also modified the setRequestCharacterEncodingActionTest slightly to first get the Reader and
if that fails to call getParameterMap hoping to overcome those containers that set the committed
bit on the parameter read -- alas -- didn't fix either Apache or WLP -- but keeping in case
it fixes somethign else.

Modified:
    myfaces/portlet-bridge/tck/tags/jsr301-1.0.0/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java

Modified: myfaces/portlet-bridge/tck/tags/jsr301-1.0.0/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/tck/tags/jsr301-1.0.0/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java?rev=951503&r1=951502&r2=951503&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/tags/jsr301-1.0.0/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java
(original)
+++ myfaces/portlet-bridge/tck/tags/jsr301-1.0.0/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java
Fri Jun  4 17:46:48 2010
@@ -20,6 +20,7 @@
 package org.apache.myfaces.portlet.faces.testsuite.tests.chapter_6.section_6_1_3_1;
 
 
+import java.io.BufferedReader;
 import java.io.Reader;
 import java.io.UnsupportedEncodingException;
 
@@ -1565,8 +1566,22 @@ public class Tests
     {
       String s = extCtx.getRequestCharacterEncoding();
       String testEncoding = null;
-      // read the parameters to ensure setting the encoding is invalid.
-      Map m = ((PortletRequest) extCtx.getRequest()).getParameterMap();
+      // A number of container have trouble with this test --
+      // All one should have to do is get the parameters to cause the test state to be set
+      // but some containers require the reader be called -- issue is -- the spec also
+      // says you can't get a reader if its a form postback. 
+      // Anyway -- first try to get a reader -- then to read the parameters to
+      // be most accomodative
+      try
+      {
+        BufferedReader b = ((ActionRequest) extCtx.getRequest()).getReader();
+        int i = 0;
+      }
+      catch (Exception e)
+      { 
+        // container likely did the right thing -- but make sure by reading the parameters
+        Map m = ((PortletRequest) extCtx.getRequest()).getParameterMap();
+      }
       
       if (s == null || (s != null && !s.equalsIgnoreCase(utf8)))
       {
@@ -1890,6 +1905,14 @@ public class Tests
         String prop = (String) propertyNames.nextElement();
         if (!headerMap.containsKey(prop))
         {
+          // Note: By spec Content-Length is only included if getContentLength() isn't -1
+          if (prop.equalsIgnoreCase("content-length"))
+          {
+            if (((ActionRequest)extCtx.getRequest()).getContentLength() == -1)
+            {
+              continue;
+            }
+          }
           testRunner.setTestResult(false,
                                    "Failed: The Map returned from getRequestHeaderMap didn't
contain all the key/values from request.getProperties. Its missing: " +
                                    prop);



Mime
View raw message