Return-Path: Delivered-To: apmail-myfaces-commits-archive@www.apache.org Received: (qmail 95438 invoked from network); 6 Nov 2008 08:50:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Nov 2008 08:50:17 -0000 Received: (qmail 75411 invoked by uid 500); 6 Nov 2008 08:50:24 -0000 Delivered-To: apmail-myfaces-commits-archive@myfaces.apache.org Received: (qmail 75343 invoked by uid 500); 6 Nov 2008 08:50:23 -0000 Mailing-List: contact commits-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Development" Delivered-To: mailing list commits@myfaces.apache.org Received: (qmail 75334 invoked by uid 99); 6 Nov 2008 08:50:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Nov 2008 00:50:23 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Nov 2008 08:49:14 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 8014A238893B; Thu, 6 Nov 2008 00:49:56 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r711799 - /myfaces/trinidad/branches/1.2.8.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java Date: Thu, 06 Nov 2008 08:49:56 -0000 To: commits@myfaces.apache.org From: matzew@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081106084956.8014A238893B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: matzew Date: Thu Nov 6 00:49:55 2008 New Revision: 711799 URL: http://svn.apache.org/viewvc?rev=711799&view=rev Log: TRINIDAD-1289 - _activePageState in StatemManagerImpl should be on the session level thx to Blake Sullivan for the patch Modified: myfaces/trinidad/branches/1.2.8.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java Modified: myfaces/trinidad/branches/1.2.8.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.8.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java?rev=711799&r1=711798&r2=711799&view=diff ============================================================================== --- myfaces/trinidad/branches/1.2.8.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java (original) +++ myfaces/trinidad/branches/1.2.8.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java Thu Nov 6 00:49:55 2008 @@ -294,16 +294,20 @@ if (_saveAsToken(context)) { String token; + ExternalContext extContext = context.getExternalContext(); + if (applicationViewCache == null) { assert(!dontSave); TokenCache cache = _getViewCache(context); assert(cache != null); + Map sessionMap = extContext.getSessionMap(); + // Store bits of the session as subkeys off of the session - Map stateMap = new SubKeyMap( - context.getExternalContext().getSessionMap(), - _VIEW_CACHE_KEY + "."); + Map stateMap = new SubKeyMap(sessionMap, + _VIEW_CACHE_KEY + "."); + // Sadly, we can't save just a SerializedView, because we should // save a serialized object, and SerializedView is a *non*-static // inner class of StateManager @@ -318,12 +322,14 @@ // clear out all of the previous PageStates' UIViewRoots and add this page // state as an active page state. This is necessary to avoid UIViewRoots // laying around if the user navigates off of a page using a GET - synchronized(this) + synchronized(extContext.getSession(true)) { - if (_activePageState != null) - _activePageState.clearViewRootState(); + PageState activePageState = (PageState)sessionMap.get(_ACTIVE_PAGE_STATE_SESSION_KEY); + + if (activePageState != null) + activePageState.clearViewRootState(); - _activePageState = pageState; + sessionMap.put(_ACTIVE_PAGE_STATE_SESSION_KEY, pageState); } String requestToken = _getRequestTokenForResponse(context); @@ -347,8 +353,7 @@ else { // See if we should pin this new state to any old state - String pinnedToken = (String) - context.getExternalContext().getRequestMap().get(_PINNED_STATE_TOKEN_KEY); + String pinnedToken = (String)extContext.getRequestMap().get(_PINNED_STATE_TOKEN_KEY); token = cache.addNewEntry(pageState, stateMap, pinnedToken); @@ -382,8 +387,7 @@ view = new SerializedView(token, null); // And store the token for this request - context.getExternalContext().getRequestMap().put(_REQUEST_STATE_TOKEN_KEY, - token); + extContext.getRequestMap().put(_REQUEST_STATE_TOKEN_KEY, token); } else { @@ -1117,7 +1121,6 @@ private Boolean _useViewRootCache; private Boolean _useApplicationViewCache; private Boolean _structureGeneratedByTemplate; - private PageState _activePageState; private static final int _DEFAULT_CACHE_SIZE = 15; @@ -1140,6 +1143,9 @@ private static final String _REUSE_REQUEST_TOKEN_FOR_RESPONSE_KEY = "org.apache.myfaces.trinidadinternal.application.REUSE_REQUEST_TOKEN_FOR_RESPONSE"; + // key for saving the PageState for the last accessed view in this Session + private static final String _ACTIVE_PAGE_STATE_SESSION_KEY = + "org.apache.myfaces.trinidadinternal.application.StateManagerImp.ACTIVE_PAGE_STATE"; private static final String _APPLICATION_CACHE_TOKEN = "_a_";