diff --git a/spring-webflow-reference/src/actions.xml b/spring-webflow-reference/src/actions.xml
index 046de63e..4a9fa26f 100644
--- a/spring-webflow-reference/src/actions.xml
+++ b/spring-webflow-reference/src/actions.xml
@@ -39,7 +39,7 @@
-
+
diff --git a/spring-webflow-samples/booking-faces/src/main/webapp/WEB-INF/flows/main/main.xml b/spring-webflow-samples/booking-faces/src/main/webapp/WEB-INF/flows/main/main.xml
index a6037f29..f7806ebc 100755
--- a/spring-webflow-samples/booking-faces/src/main/webapp/WEB-INF/flows/main/main.xml
+++ b/spring-webflow-samples/booking-faces/src/main/webapp/WEB-INF/flows/main/main.xml
@@ -9,16 +9,21 @@
-
-
-
+
-
-
+
+
+
+
+
+
+
+
+
diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/RequestControlContext.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/RequestControlContext.java
index dd17b8a9..24712df7 100644
--- a/spring-webflow/src/main/java/org/springframework/webflow/engine/RequestControlContext.java
+++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/RequestControlContext.java
@@ -139,9 +139,9 @@ public interface RequestControlContext extends RequestContext {
public void endActiveFlowSession(String outcome, MutableAttributeMap output) throws IllegalStateException;
/**
- * Returns true if the 'always redirect pause' flow execution attribute is set to true, false otherwise.
+ * Returns true if the 'redirect on pause' flow execution attribute is set to true, false otherwise.
* @return true or false
*/
- public boolean getAlwaysRedirectOnPause();
+ public boolean getRedirectOnPause();
}
\ No newline at end of file
diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/ViewState.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/ViewState.java
index f4f514aa..ec25c367 100644
--- a/spring-webflow/src/main/java/org/springframework/webflow/engine/ViewState.java
+++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/ViewState.java
@@ -167,16 +167,28 @@ public class ViewState extends TransitionableState {
}
protected void doEnter(RequestControlContext context) throws FlowExecutionException {
- context.assignFlowExecutionKey();
- if (context.getExternalContext().isResponseAllowed()) {
- if (shouldRedirect(context)) {
- context.getExternalContext().requestFlowExecutionRedirect();
- if (popup) {
- context.getExternalContext().requestRedirectInPopup();
+ ViewState originatingViewState = (ViewState) context.getRequestScope().get("webflow.originatingViewState");
+ if (this == originatingViewState) {
+ if (context.getExternalContext().isResponseAllowed()) {
+ if (context.getExternalContext().isAjaxRequest()) {
+ View view = viewFactory.getView(context);
+ render(context, view);
+ } else {
+ context.getExternalContext().requestFlowExecutionRedirect();
+ }
+ }
+ } else {
+ context.assignFlowExecutionKey();
+ if (context.getExternalContext().isResponseAllowed()) {
+ if (shouldRedirect(context)) {
+ context.getExternalContext().requestFlowExecutionRedirect();
+ if (popup) {
+ context.getExternalContext().requestRedirectInPopup();
+ }
+ } else {
+ View view = viewFactory.getView(context);
+ render(context, view);
}
- } else {
- View view = viewFactory.getView(context);
- render(context, view);
}
}
}
@@ -190,9 +202,14 @@ public class ViewState extends TransitionableState {
if (logger.isDebugEnabled()) {
logger.debug("Event '" + event.getId() + "' returned from view " + view);
}
+ context.getRequestScope().put("webflow.originatingViewState", this);
boolean stateExited = context.handleEvent(event);
if (!stateExited && context.getExternalContext().isResponseAllowed()) {
- render(context, view);
+ if (context.getExternalContext().isAjaxRequest()) {
+ render(context, view);
+ } else {
+ context.getExternalContext().requestFlowExecutionRedirect();
+ }
}
} else {
if (context.getExternalContext().isResponseAllowed()) {
@@ -224,7 +241,7 @@ public class ViewState extends TransitionableState {
if (redirect != null) {
return redirect.booleanValue();
} else {
- return context.getAlwaysRedirectOnPause();
+ return context.getRedirectOnPause();
}
}
diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/RequestControlContextImpl.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/RequestControlContextImpl.java
index 6d5605d9..a29726cf 100644
--- a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/RequestControlContextImpl.java
+++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/RequestControlContextImpl.java
@@ -225,7 +225,7 @@ class RequestControlContextImpl implements RequestControlContext {
flowExecution.endActiveFlowSession(outcome, output, this);
}
- public boolean getAlwaysRedirectOnPause() {
+ public boolean getRedirectOnPause() {
Boolean redirectOnPause = flowExecution.getAttributes().getBoolean("alwaysRedirectOnPause");
return redirectOnPause != null ? redirectOnPause.booleanValue() : false;
}
diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/builder/xml/spring-webflow-2.0.xsd b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/builder/xml/spring-webflow-2.0.xsd
index a0358b68..3de66edf 100644
--- a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/builder/xml/spring-webflow-2.0.xsd
+++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/builder/xml/spring-webflow-2.0.xsd
@@ -500,7 +500,7 @@ The default convention is to treat the id of this view state as the view identif
diff --git a/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestControlContext.java b/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestControlContext.java
index 02bf84b9..cb1c49e0 100644
--- a/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestControlContext.java
+++ b/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestControlContext.java
@@ -121,7 +121,7 @@ public class MockRequestControlContext extends MockRequestContext implements Req
}
}
- public boolean getAlwaysRedirectOnPause() {
+ public boolean getRedirectOnPause() {
return alwaysRedirectOnPause;
}
diff --git a/spring-webflow/src/test/java/org/springframework/webflow/test/SearchFlowExecutionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/test/SearchFlowExecutionTests.java
index fbd935c6..5f150dd3 100644
--- a/spring-webflow/src/test/java/org/springframework/webflow/test/SearchFlowExecutionTests.java
+++ b/spring-webflow/src/test/java/org/springframework/webflow/test/SearchFlowExecutionTests.java
@@ -82,7 +82,6 @@ public class SearchFlowExecutionTests extends AbstractXmlFlowExecutionTests {
context.putRequestParameter("id", "1");
resumeFlow(context);
assertCurrentStateEquals("displayResults");
- assertResponseWrittenEquals("searchResults", context);
}
protected void configureFlowBuilderContext(MockFlowBuilderContext builderContext) {