SWF-537 - FlowViewStateManager set repeatedly on application instance after application initialization.
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user