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
15bda17902
commit
9f17ee57cc
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2011 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.
|
||||
@@ -101,11 +101,15 @@ public class JsfView implements View {
|
||||
}
|
||||
|
||||
public boolean userEventQueued() {
|
||||
if (isAtLeastJsf12()) {
|
||||
return requestContext.getRequestParameters().contains("javax.faces.ViewState");
|
||||
} else {
|
||||
return requestContext.getRequestParameters().size() > 1;
|
||||
FacesContext facesContext = FlowFacesContext.getCurrentInstance();
|
||||
if (facesContext != null) {
|
||||
if (isAtLeastJsf12()) {
|
||||
return facesContext.getExternalContext().getRequestParameterMap().containsKey("javax.faces.ViewState");
|
||||
} else {
|
||||
return facesContext.getExternalContext().getRequestParameterMap().size() > 1;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,4 +161,4 @@ public class JsfView implements View {
|
||||
private String getEventId() {
|
||||
return (String) requestContext.getExternalContext().getRequestMap().get(EVENT_KEY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,12 +225,10 @@ 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.externalContext().addRequestParameterMap("execution", "e1s1");
|
||||
this.jsfMock.externalContext().addRequestParameterMap("javax.faces.ViewState", "e1s1");
|
||||
|
||||
EasyMock.expect(context.getRequestParameters()).andStubReturn(requestParameterMap);
|
||||
EasyMock.replay(new Object[] { context, flowExecutionContext, flowMap, flashScope });
|
||||
EasyMock.replay(new Object[] { this.context, this.flowExecutionContext, this.flowMap, this.flashScope });
|
||||
|
||||
JsfView createdView = new JsfView(new UIViewRoot(), jsfMock.lifecycle(), context);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user