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/04/08 21:26:57 UTC

svn commit: r932071 - /myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletExternalContextImpl.java

Author: mfreedman
Date: Thu Apr  8 19:26:56 2010
New Revision: 932071

URL: http://svn.apache.org/viewvc?rev=932071&view=rev
Log:
PORTLETBRIDGE-112: Improve compatibility with Liferay

Modified:
    myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletExternalContextImpl.java

Modified: myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletExternalContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletExternalContextImpl.java?rev=932071&r1=932070&r2=932071&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletExternalContextImpl.java (original)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletExternalContextImpl.java Thu Apr  8 19:26:56 2010
@@ -110,6 +110,9 @@ public class PortletExternalContextImpl
   
   public static final String SERVLET_INCLUDED_PATHINFO_ATTRIBUTE = "javax.servlet.include.path_info";
   public static final String SERVLET_INCLUDED_SERVLETPATH_ATTRIBUTE = "javax.servlet.include.servlet_path";
+  
+  // Hack to work (best) with existing releases of Liferay
+  private static final String LIFERAY_NAMESPACE_PREFIX_HACK = "lfr_"; 
 
 
   private PortletContext mPortletContext;
@@ -1156,7 +1159,16 @@ public class PortletExternalContextImpl
 
   public String encodeNamespace(String s)
   {
-    return ((PortletResponse) mPortletResponse).getNamespace() + s;
+    // Supposedly if this attribute is present we are running in Liferay
+    if (getRequestMap().get("THEME_DISPLAY") == null)
+    {
+      return ((PortletResponse) mPortletResponse).getNamespace() + s;
+    }
+    else
+    {
+      // For liferay -- prefix with extra chars so they don't strip
+      return LIFERAY_NAMESPACE_PREFIX_HACK + ((PortletResponse) mPortletResponse).getNamespace() + s;
+    }
   }
 
   @Override