You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mf...@apache.org on 2010/06/04 19:30:11 UTC
svn commit: r951500 -
/myfaces/portlet-bridge/tck/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java
Author: mfreedman
Date: Fri Jun 4 17:30:11 2010
New Revision: 951500
URL: http://svn.apache.org/viewvc?rev=951500&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/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java
Modified: myfaces/portlet-bridge/tck/trunk/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/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java?rev=951500&r1=951499&r2=951500&view=diff
==============================================================================
--- myfaces/portlet-bridge/tck/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java (original)
+++ myfaces/portlet-bridge/tck/trunk/src/main/java/org/apache/myfaces/portlet/faces/testsuite/tests/chapter_6/section_6_1_3_1/Tests.java Fri Jun 4 17:30:11 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);