You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2008/08/29 09:57:01 UTC
svn commit: r690140 -
/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/jsf/AccessScopePhaseListener.java
Author: skitching
Date: Fri Aug 29 00:57:01 2008
New Revision: 690140
URL: http://svn.apache.org/viewvc?rev=690140&view=rev
Log:
Fix for ORCHESTRA-29 - access-scoped conversations always get discarded during ajax requests from the NetAdvantage ajax library.
Modified:
myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/jsf/AccessScopePhaseListener.java
Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/jsf/AccessScopePhaseListener.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/jsf/AccessScopePhaseListener.java?rev=690140&r1=690139&r2=690140&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/jsf/AccessScopePhaseListener.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/jsf/AccessScopePhaseListener.java Fri Aug 29 00:57:01 2008
@@ -89,7 +89,34 @@
public void beforePhase(PhaseEvent event)
{
AccessScopeManager accessManager = AccessScopeManager.getInstance();
- accessManager.beginRecording();
+
+ if (event.getFacesContext().getResponseComplete())
+ {
+ // Unusual case. If something set responseComplete before the rendering phase started, then
+ // the rendering phase would simply be skipped and we would not be here. So presumably some
+ // PhaseListener that ran in this phase but before this PhaseListener has decided to implement
+ // its own form of "rendering" itself and then set responseComplete to bypass the normal
+ // rendering phase.
+ //
+ // When this occurs, any accesses to conversation-scoped beans will already have happened.
+ // If we were to call "beginRecording" here as normal then then at afterPhase all conversations
+ // would appear to be unaccessed which is not true - they may have been accessed, but before
+ // this method ran. So instead, just disable checking for this particular request. This
+ // solution isn't 100% correct, but should be close enough, and no other alternative is
+ // simple. The correct solution would possibly be to use a custom Lifecycle class to do the
+ // access-checking rather than a PhaseListener; that would then avoid any dependency on the
+ // order in which PhaseListener classes are registered. Note, however, that some ajax
+ // libraries use a custom Lifecycle class themselves, so again there are potential
+ // registration ordering issues there.
+ //
+ // This situation happens with the NetAdvantage ajax library at least, and perhaps others.
+ accessManager.setIgnoreRequest();
+ }
+ else
+ {
+ // normal case
+ accessManager.beginRecording();
+ }
}
public void afterPhase(PhaseEvent event)