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/05/20 23:12:13 UTC

svn commit: r946789 - in /myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util: QueryString.java map/PortletRequestHeaders.java

Author: mfreedman
Date: Thu May 20 21:12:13 2010
New Revision: 946789

URL: http://svn.apache.org/viewvc?rev=946789&view=rev
Log:
PORTLETBRIDGE-141: External context implementation returns content-type header 

Modified:
    myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util/QueryString.java
    myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletRequestHeaders.java

Modified: myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util/QueryString.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util/QueryString.java?rev=946789&r1=946788&r2=946789&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util/QueryString.java (original)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util/QueryString.java Thu May 20 21:12:13 2010
@@ -45,7 +45,7 @@ public final class QueryString
   public QueryString(String queryString, String characterEncoding)
   {
     // We only work on regular QueryStrings not strictXhtml QueryStrings
-    mQueryString = queryString.replaceAll("\\&amp\\;", "&");
+    mQueryString = queryString.replace("&", "&");
     mCharacterEncoding = characterEncoding;
   }
 

Modified: myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletRequestHeaders.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletRequestHeaders.java?rev=946789&r1=946788&r2=946789&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletRequestHeaders.java (original)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/util/map/PortletRequestHeaders.java Thu May 20 21:12:13 2010
@@ -104,24 +104,25 @@ public class PortletRequestHeaders
      // can't assume portlet container overrides these headers to reflect portlet constraints -- so do so
      ensurePortletAcceptHeader();
      ensurePortletAcceptLanguage();
-
-
-     if ((Bridge.PortletPhase) mPortletRequest.getAttribute(Bridge.PORTLET_LIFECYCLE_PHASE) ==
-         Bridge.PortletPhase.ACTION_PHASE)
-     {
-       ensurePortletContentType();
-       ensurePortletContentLength();
-     }
-     // Technically don't need this test here but I will forget to change this code when
-     // JSR 286 is supported and there are more phases.
-     else if ((Bridge.PortletPhase) mPortletRequest.getAttribute(Bridge.PORTLET_LIFECYCLE_PHASE) ==
-              Bridge.PortletPhase.RENDER_PHASE)
+     
+     switch ((Bridge.PortletPhase) mPortletRequest.getAttribute(Bridge.PORTLET_LIFECYCLE_PHASE))
      {
-       // its the RENDER_PHASE -- spec says we must remove the CONTENT_TYPE if
+     case ACTION_PHASE:
+     case RESOURCE_PHASE:
+        ensurePortletContentType();
+        ensurePortletContentLength();
+        break;
+     case RENDER_PHASE:
+     case EVENT_PHASE:
+       // its the RENDER_PHASE -- spec says we must remove the CONTENT_TYPE and CONTENT-LENGTH if
        // came in the request -- so it matches null return from
        // EC.getRequestContentType/CharacterSetEncoding
        mHeaders.remove("CONTENT-TYPE");
        mHeaderNames.remove("CONTENT-TYPE");
+       mHeaders.remove("CONTENT-LENGTH");
+       mHeaderNames.remove("CONTENT-LENGTH");
+     default:
+       // shouldn't get here
      }
 
      return true;
@@ -275,7 +276,7 @@ public class PortletRequestHeaders
     {
       propertyList = new ArrayList<String>(4);
       mHeaders.put(upperName, propertyList);
-      mHeaderNames.add(name);
+      mHeaderNames.add(upperName);
     }
     propertyList.add(value);
   }