incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwald...@apache.org
Subject svn commit: r483255 - in /incubator/adffaces/branches/jwaldman-portal/trinidad: trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/ trinidad-impl/src/main/java/org/apache...
Date Wed, 06 Dec 2006 22:07:02 GMT
Author: jwaldman
Date: Wed Dec  6 14:07:01 2006
New Revision: 483255

URL: http://svn.apache.org/viewvc?view=rev&rev=483255
Log:
ADFFACES-232 Disabling PPR when running from a portlet. This patch will change the output
mode on the RequestContext to portlet when running in a portlet environment. This output mode
is used for determining renderkit capabilities which successfully disables multi-window support
and ppr capabilities. In the future this could be modified as the capabilities of the Portlet
container increase.

Took out the isPortlet from CoreRenderKit.java, since similar code is there in this patch.

Modified:
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java
    incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java

Modified: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java?view=diff&rev=483255&r1=483254&r2=483255
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java
(original)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java
Wed Dec  6 14:07:01 2006
@@ -68,7 +68,7 @@
     }
     catch (ClassNotFoundException e)
     {
-      _LOG.warning("A non-servlet request was aubmitted and the portlet JARs are not on the
classpath.  Returning false.");
+      _LOG.warning("A non-ServletRequest was submitted and the portlet JARs are not on the
classpath.  Returning false.");
     }
     return false;    
   }

Modified: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java?view=diff&rev=483255&r1=483254&r2=483255
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java
(original)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java
Wed Dec  6 14:07:01 2006
@@ -63,6 +63,8 @@
 import org.apache.myfaces.trinidad.context.PartialPageContext;
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlConstants;
 import org.apache.myfaces.trinidad.context.RenderingContext;
+import org.apache.myfaces.trinidad.util.ExternalContextUtils;
+import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit;
 import org.apache.myfaces.trinidadinternal.share.config.UIXCookie;
 
 import org.apache.myfaces.trinidadinternal.ui.expl.ColorPaletteUtils;
@@ -221,6 +223,17 @@
   @Override
   public String getOutputMode()
   {
+    //=-= Scott O'Bryan =-=
+    // FIXME: Not real happy with this.  We should find a way to get this into
+    // the bean.  The bean is cached by the RequestContextFactory, and the 
+    // Portlet mode needs to be assigned per request since it's possible to run
+    // a trinidad application from a servlet container and a portlet container
+    // at the same time.  For now?  Hey, it works.
+    
+    if(ExternalContextUtils.isPortlet(__getFacesContext().getExternalContext()))
+    {
+      return CoreRenderKit.OUTPUT_MODE_PORTLET;
+    }
     return (String) _bean.getProperty(RequestContextBean.OUTPUT_MODE_KEY);
   }
 

Modified: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java?view=diff&rev=483255&r1=483254&r2=483255
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java
(original)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java
Wed Dec  6 14:07:01 2006
@@ -140,15 +140,6 @@
     }
     return "org.apache.myfaces.trinidad.core.desktop";
   }
-  
-  static public boolean isPortlet(FacesContext context)
-  {
-    RequestContext afc = RequestContext.getCurrentInstance();
-    if (afc != null)
-      return (OUTPUT_MODE_PORTLET.equals(afc.getOutputMode()));
-    else
-      return false;
-  }
 
   public CoreRenderKit()
   {

Modified: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java?view=diff&rev=483255&r1=483254&r2=483255
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java
(original)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java
Wed Dec  6 14:07:01 2006
@@ -423,6 +423,10 @@
     {
       return AgentUtil.mergeCapabilities(agent, _EMAIL_CAPABILITIES);
     }
+    else if (CoreRenderKit.OUTPUT_MODE_PORTLET.equals(outputMode))
+    {
+      return AgentUtil.mergeCapabilities(agent, _PORTLET_CAPABILITIES); 
+    }
     else
     {
       return agent;
@@ -552,6 +556,9 @@
   static private final Map<Object, Object> _EMAIL_CAPABILITIES = 
     new HashMap<Object, Object>();
   
+  static private final Map<Object, Object> _PORTLET_CAPABILITIES = 
+    new HashMap<Object, Object>();
+  
   static
   {
     _PRINTABLE_CAPABILITIES.put(TrinidadAgent.CAP_INTRINSIC_EVENTS,
@@ -577,6 +584,11 @@
     _EMAIL_CAPABILITIES.put(TrinidadAgent.CAP_STYLE_ATTRIBUTES,
                             TrinidadAgent.STYLES_INTERNAL);
     _EMAIL_CAPABILITIES.put(TrinidadAgent.CAP_PARTIAL_RENDERING,
+                            Boolean.FALSE);
+    
+    _PORTLET_CAPABILITIES.put(TrinidadAgent.CAP_PARTIAL_RENDERING,
+                            Boolean.FALSE);
+    _PORTLET_CAPABILITIES.put(TrinidadAgent.CAP_MULTIPLE_WINDOWS,
                             Boolean.FALSE);
   }
 

Modified: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java?view=diff&rev=483255&r1=483254&r2=483255
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java
(original)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java
Wed Dec  6 14:07:01 2006
@@ -19,6 +19,7 @@
 import java.util.TimeZone;
 
 import javax.faces.component.UIComponent;
+import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
 
@@ -33,7 +34,6 @@
 
 import org.apache.myfaces.trinidad.context.RenderingContext;
 import org.apache.myfaces.trinidad.render.CoreRenderer;
-import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit;
 
 /**
  * Renderer for meta data section of the document--a.k.a <head>.
@@ -147,17 +147,20 @@
     FacesContext context,
     RenderingContext arc)
   {
+    ExternalContext externalContext = context.getExternalContext();
+    
     // Disable the Cookie script for portlets
     // =-=AEW Right or wrong?
-    if (CoreRenderKit.isPortlet(context))
+    String outputMode = arc.getOutputMode();
+    if (XhtmlConstants.OUTPUT_MODE_PORTLET.equals(outputMode))
       return false;
 
     // Do not need the cookie script when we have a PartialPageContext
     if (arc.getPartialPageContext() != null)
       return false;
     
-    Object request = context.getExternalContext().getRequest();
-    Object response = context.getExternalContext().getResponse();
+    Object request = externalContext.getRequest();
+    Object response = externalContext.getResponse();
     if ((request instanceof HttpServletRequest) &&
         (response instanceof HttpServletResponse))
     {

Modified: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java?view=diff&rev=483255&r1=483254&r2=483255
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java
(original)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/StyleSheetRenderer.java
Wed Dec  6 14:07:01 2006
@@ -20,6 +20,7 @@
 import java.util.Map;
 
 import javax.faces.component.UIComponent;
+import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
 
@@ -27,7 +28,6 @@
 import org.apache.myfaces.trinidad.component.core.CoreStyleSheet;
 
 import org.apache.myfaces.trinidad.context.RenderingContext;
-import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit;
 import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderingContext;
 
 import org.apache.myfaces.trinidadinternal.style.StyleContext;
@@ -88,12 +88,13 @@
       String href = provider.getStyleSheetURI(sContext);
       if (href != null)
       {
-        String contextUri = context.getExternalContext().getRequestContextPath();
+        ExternalContext externalContext = context.getExternalContext();
+        String contextUri = externalContext.getRequestContextPath();
         String baseURL = contextUri + XhtmlConstants.STYLES_CACHE_DIRECTORY;
         
         String outputMode = arc.getOutputMode();
         // =-=AEW Don't like hardcoding facet names...
-        if (CoreRenderKit.isPortlet(context) &&
+        if (XhtmlConstants.OUTPUT_MODE_PORTLET.equals(outputMode) &&
             supportsScripting(arc))
         {
           writer.startElement("script", null);

Modified: incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java?view=diff&rev=483255&r1=483254&r2=483255
==============================================================================
--- incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java
(original)
+++ incubator/adffaces/branches/jwaldman-portal/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java
Wed Dec  6 14:07:01 2006
@@ -21,6 +21,7 @@
 
 import javax.faces.context.FacesContext;
 
+import org.apache.myfaces.trinidad.context.RequestContext;
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 import org.apache.myfaces.trinidad.skin.Skin;
 import org.apache.myfaces.trinidad.skin.SkinFactory;
@@ -117,7 +118,8 @@
      throw new NullPointerException("Null skin family");
 
     // default render-kit-id, if needed.
-    if (CoreRenderKit.isPortlet(context))
+     RequestContext rContext = RequestContext.getCurrentInstance();   
+     if (CoreRenderKit.OUTPUT_MODE_PORTLET.equals(rContext.getOutputMode()))
       renderKitId = _RENDER_KIT_ID_PORTLET;
     else if (renderKitId == null) 
       renderKitId = _RENDER_KIT_ID_CORE;



Mime
View raw message