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:37 UTC

svn commit: r932070 - /myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletExternalContextImpl.java

Author: mfreedman
Date: Thu Apr  8 19:26:37 2010
New Revision: 932070

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

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

Modified: myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletExternalContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletExternalContextImpl.java?rev=932070&r1=932069&r2=932070&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletExternalContextImpl.java (original)
+++ myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/context/PortletExternalContextImpl.java Thu Apr  8 19:26:37 2010
@@ -106,7 +106,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;
   private PortletRequest mPortletRequest;
@@ -955,7 +957,16 @@ public class PortletExternalContextImpl
     }
     else
     {
-      return ((RenderResponse) mPortletResponse).getNamespace() + s;
+      // Supposedly if this attribute is present we are running in Liferay
+      if (getRequestMap().get("THEME_DISPLAY") == null)
+      {
+        return ((RenderResponse) mPortletResponse).getNamespace() + s;
+      }
+      else
+      {
+        // For liferay -- prefix with extra chars so they don't strip
+        return LIFERAY_NAMESPACE_PREFIX_HACK + ((RenderResponse) mPortletResponse).getNamespace() + s;
+      }
     }
   }