Fix issue with RichFaces file upload
Change JsfView.userEventQueued() to check for 'javax.faces.ViewState' via the FacesContext rather than the RequestContext. This allows potential multi-part request submissions to be processed by JSF rather than Spring. Issue: SWF-1482
This commit is contained in:
committed by
Rossen Stoyanchev
parent
2d47d6cbb2
commit
787fb7dc89
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2004-2012 the original author or authors.
|
* Copyright 2004-2013 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -30,7 +30,7 @@ import org.springframework.webflow.execution.View;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* JSF-specific {@link View} implementation.
|
* JSF-specific {@link View} implementation.
|
||||||
*
|
*
|
||||||
* @author Jeremy Grelle
|
* @author Jeremy Grelle
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
@@ -47,7 +47,7 @@ public class JsfView implements View {
|
|||||||
private final RequestContext requestContext;
|
private final RequestContext requestContext;
|
||||||
|
|
||||||
private String viewId;
|
private String viewId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new JSF view.
|
* Creates a new JSF view.
|
||||||
* @param viewRoot the view root
|
* @param viewRoot the view root
|
||||||
@@ -97,7 +97,12 @@ public class JsfView implements View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean userEventQueued() {
|
public boolean userEventQueued() {
|
||||||
return this.requestContext.getRequestParameters().contains("javax.faces.ViewState");
|
FacesContext facesContext = FlowFacesContext.getCurrentInstance();
|
||||||
|
if (facesContext != null) {
|
||||||
|
// Use ExternalContext for multipart request parsing by component libraries
|
||||||
|
return facesContext.getExternalContext().getRequestParameterMap().containsKey("javax.faces.ViewState");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -194,11 +194,9 @@ public class JsfViewTests extends TestCase {
|
|||||||
|
|
||||||
public final void testUserEventQueued_FormSubmitted() {
|
public final void testUserEventQueued_FormSubmitted() {
|
||||||
|
|
||||||
MockParameterMap requestParameterMap = new MockParameterMap();
|
this.jsfMock.request().addParameter("execution", "e1s1");
|
||||||
requestParameterMap.put("execution", "e1s1");
|
this.jsfMock.request().addParameter("javax.faces.ViewState", "e1s1");
|
||||||
requestParameterMap.put("javax.faces.ViewState", "e1s1");
|
|
||||||
|
|
||||||
EasyMock.expect(this.context.getRequestParameters()).andStubReturn(requestParameterMap);
|
|
||||||
EasyMock.replay(new Object[] { this.context, this.flowExecutionContext, this.flowMap, this.flashScope });
|
EasyMock.replay(new Object[] { this.context, this.flowExecutionContext, this.flowMap, this.flashScope });
|
||||||
|
|
||||||
JsfView createdView = new JsfView(new UIViewRoot(), this.jsfMock.lifecycle(), this.context);
|
JsfView createdView = new JsfView(new UIViewRoot(), this.jsfMock.lifecycle(), this.context);
|
||||||
|
|||||||
Reference in New Issue
Block a user