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 2011/05/05 23:02:04 UTC

svn commit: r1099967 - /myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java

Author: mfreedman
Date: Thu May  5 21:02:03 2011
New Revision: 1099967

URL: http://svn.apache.org/viewvc?rev=1099967&view=rev
Log:
PORTLETBRIDGE-99:  Fixes (hopefully) the last issue related to serializing REQUEST_SCOPE_LISTENER

Modified:
    myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java

Modified: myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java?rev=1099967&r1=1099966&r2=1099967&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java (original)
+++ myfaces/portlet-bridge/core/branches/2.0.0-branch/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java Thu May  5 21:02:03 2011
@@ -2281,7 +2281,7 @@ public class BridgeImpl
         // remove
         // every scope that starts with this prefix.
         session.setAttribute(REQUEST_SCOPE_LISTENER,
-                             new RequestScopeListener(qualifyScopeId(mPortletConfig.getPortletName(), 
+                             new RequestScopeListener(this, qualifyScopeId(mPortletConfig.getPortletName(), 
                                                                      session.getId(), null, null)));
       }
     }
@@ -2852,13 +2852,15 @@ public class BridgeImpl
     }
   }
 
-  private final class RequestScopeListener 
+  private final static class RequestScopeListener 
     implements HttpSessionBindingListener, HttpSessionActivationListener, Serializable
   {
+    private transient BridgeImpl mBridgeImpl = null;
     String mScopePrefix = null; 
 
-    public RequestScopeListener(String scopePrefix)
+    public RequestScopeListener(BridgeImpl bridgeImpl, String scopePrefix)
     {
+      mBridgeImpl = bridgeImpl;
       mScopePrefix = scopePrefix;
     }
 
@@ -2871,11 +2873,11 @@ public class BridgeImpl
     {
       // Call is in the BridgeImpl class -- note check for null 
       // If we have passivated/reactivated
-      if (mScopePrefix != null)
+      if (mBridgeImpl != null && mScopePrefix != null)
       {
-      removeRequestScopes(mScopePrefix);
+        mBridgeImpl.removeRequestScopes(mScopePrefix);
+      }
     }
-  }
     
     public void sessionWillPassivate(HttpSessionEvent se)
     {  
@@ -2883,8 +2885,10 @@ public class BridgeImpl
       //     -- i.e. is this a safe time to remove the scopes from the AppContext in the "old" context?
       //     Until we get confirmation that it is -- do not remove
       /*
-      removeRequestScopes(mScopePrefix);
-      
+      if (mBridgeImpl != null)
+      {
+        mBridgeImpl.removeRequestScopes(mScopePrefix);
+      } 
       RequestScopeListener rl = (RequestScopeListener) se.getSession().getAttribute(REQUEST_SCOPE_LISTENER);
       if (rl != null && rl.equals(this))
       {
@@ -2900,7 +2904,7 @@ public class BridgeImpl
     {
       // If we migrsated to a new Context or otherwise can't reach these scopes anymore then 
       // drop the listener.
-      if (!hasRequestScopes(mScopePrefix))
+      if (mBridgeImpl == null || !mBridgeImpl.hasRequestScopes(mScopePrefix))
       {
         RequestScopeListener rl = (RequestScopeListener) se.getSession().getAttribute(REQUEST_SCOPE_LISTENER);
         if (rl != null && rl.equals(this))