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:
Phillip Webb
2013-01-28 18:26:40 -08:00
committed by Rossen Stoyanchev
parent 2d47d6cbb2
commit 787fb7dc89
2 changed files with 11 additions and 8 deletions

View File

@@ -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");
* 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.
*
*
* @author Jeremy Grelle
* @author Phillip Webb
*/
@@ -47,7 +47,7 @@ public class JsfView implements View {
private final RequestContext requestContext;
private String viewId;
/**
* Creates a new JSF view.
* @param viewRoot the view root
@@ -97,7 +97,12 @@ public class JsfView implements View {
}
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;
}
/**

View File

@@ -194,11 +194,9 @@ public class JsfViewTests extends TestCase {
public final void testUserEventQueued_FormSubmitted() {
MockParameterMap requestParameterMap = new MockParameterMap();
requestParameterMap.put("execution", "e1s1");
requestParameterMap.put("javax.faces.ViewState", "e1s1");
this.jsfMock.request().addParameter("execution", "e1s1");
this.jsfMock.request().addParameter("javax.faces.ViewState", "e1s1");
EasyMock.expect(this.context.getRequestParameters()).andStubReturn(requestParameterMap);
EasyMock.replay(new Object[] { this.context, this.flowExecutionContext, this.flowMap, this.flashScope });
JsfView createdView = new JsfView(new UIViewRoot(), this.jsfMock.lifecycle(), this.context);