myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfreed...@apache.org
Subject svn commit: r1133055 - /myfaces/portlet-bridge/core/branches/trunk_1.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java
Date Tue, 07 Jun 2011 15:54:54 GMT
Author: mfreedman
Date: Tue Jun  7 15:54:53 2011
New Revision: 1133055

URL: http://svn.apache.org/viewvc?rev=1133055&view=rev
Log:
PORTLETBRIDGE-99: RequestScopeListener not Serializable

Modified:
    myfaces/portlet-bridge/core/branches/trunk_1.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java

Modified: myfaces/portlet-bridge/core/branches/trunk_1.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/trunk_1.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java?rev=1133055&r1=1133054&r2=1133055&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/branches/trunk_1.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java
(original)
+++ myfaces/portlet-bridge/core/branches/trunk_1.0.x/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java
Tue Jun  7 15:54:53 2011
@@ -1484,7 +1484,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)));
       }
     }
@@ -1878,13 +1878,15 @@ public class BridgeImpl
     }
   }
 
-  private final class RequestScopeListener
+  private final static class RequestScopeListener
     implements HttpSessionBindingListener, HttpSessionActivationListener, Serializable
   {
-    String mScopePrefix = null;
+    private transient BridgeImpl mBridgeImpl = null;
+    String mScopePrefix = null; 
 
-    public RequestScopeListener(String scopePrefix)
+    public RequestScopeListener(BridgeImpl bridgeImpl, String scopePrefix)
     {
+      mBridgeImpl = bridgeImpl;
       mScopePrefix = scopePrefix;
     }
 
@@ -1895,18 +1897,24 @@ public class BridgeImpl
 
     public void valueUnbound(HttpSessionBindingEvent event)
     {
-      // Call is in the BridgeImpl class
-      removeRequestScopes(mScopePrefix);
+      // Call is in the BridgeImpl class -- note check for null 
+      // If we have passivated/reactivated
+      if (mBridgeImpl != null && mScopePrefix != null)
+      {
+        mBridgeImpl.removeRequestScopes(mScopePrefix);
+      }
     }
-
+    
     public void sessionWillPassivate(HttpSessionEvent se)
     {  
       // TODO: is passivate only called when the session is migrated or just saved?
       //     -- 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))
       {
@@ -1922,7 +1930,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))



Mime
View raw message