SWF-537 - FlowViewStateManager set repeatedly on application instance after application initialization.

This commit is contained in:
Jeremy Grelle
2008-03-17 14:51:19 +00:00
parent e12104689b
commit 78650d6167
3 changed files with 36 additions and 7 deletions

View File

@@ -14,6 +14,10 @@
<view-handler>org.springframework.faces.webflow.FlowViewHandler</view-handler>
</application>
<factory>
<application-factory>org.springframework.faces.webflow.FlowApplicationFactory</application-factory>
</factory>
<lifecycle>
<phase-listener>org.springframework.faces.support.RequestLoggingPhaseListener</phase-listener>
</lifecycle>

View File

@@ -0,0 +1,31 @@
package org.springframework.faces.webflow;
import javax.faces.application.Application;
import javax.faces.application.ApplicationFactory;
public class FlowApplicationFactory extends ApplicationFactory {
private ApplicationFactory delegate;
private boolean stateManagerConfigured = false;
public FlowApplicationFactory(ApplicationFactory delegate) {
this.delegate = delegate;
}
public Application getApplication() {
Application app = delegate.getApplication();
// Ensure that FlowViewStateManager is first in the chain
if (!stateManagerConfigured && app.getStateManager() != null) {
FlowViewStateManager sm = new FlowViewStateManager(app.getStateManager());
app.setStateManager(sm);
stateManagerConfigured = true;
}
return app;
}
public void setApplication(Application application) {
delegate.setApplication(application);
}
}

View File

@@ -73,13 +73,7 @@ public class FlowFacesContext extends FacesContext {
FacesContext defaultFacesContext = facesContextFactory.getFacesContext(context.getExternalContext()
.getNativeContext(), context.getExternalContext().getNativeRequest(), context.getExternalContext()
.getNativeResponse(), lifecycle);
FlowFacesContext instance = new FlowFacesContext(context, defaultFacesContext);
// Ensure that FlowViewStateManager is first in the chain
FlowViewStateManager sm = new FlowViewStateManager(instance.getApplication().getStateManager());
instance.getApplication().setStateManager(sm);
return instance;
return new FlowFacesContext(context, defaultFacesContext);
}
public FlowFacesContext(RequestContext context, FacesContext delegate) {