diff --git a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/booking/booking-flow.xml b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/booking/booking-flow.xml index 82841d80..782efffb 100644 --- a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/booking/booking-flow.xml +++ b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/booking/booking-flow.xml @@ -5,8 +5,6 @@ - - diff --git a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/show.jsp b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/show.jsp index f11287c1..82e2e708 100644 --- a/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/show.jsp +++ b/spring-webflow-samples/booking-mvc/src/main/webapp/WEB-INF/hotels/show.jsp @@ -10,7 +10,7 @@
${hotel.country} -
+

Nightly Rate: ${status.value} 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 2382f4dd..dfeadc4a 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 @@ -157,4 +157,10 @@ public interface RequestControlContext extends RequestContext { */ public boolean getRedirectInSameState(); + /** + * Returns true if the flow current flow execution was launched in embedded page mode. When a flow is embedded on a + * page it can make different assumptions with regards to whether redirect after post is necessary. + */ + public boolean getEmbeddedMode(); + } \ 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 ca2bd931..d5b7b812 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 @@ -41,11 +41,6 @@ import org.springframework.webflow.execution.ViewFactory; */ public class ViewState extends TransitionableState { - /** - * The name of the attribute indicating an Ajax-driven Flow Definition. - */ - private static final String AJAX_DRIVEN_ATTRIBUTE_NAME = "ajaxDriven"; - /** * The list of actions to be executed before the view is rendered. */ @@ -273,10 +268,8 @@ public class ViewState extends TransitionableState { if (redirect != null) { return redirect.booleanValue(); } - if (getAjaxDriven(context) != null) { - if (context.getExternalContext().isAjaxRequest()) { - return false; - } + if (context.getExternalContext().isAjaxRequest() && context.getEmbeddedMode()) { + return false; } return context.getRedirectOnPause(); } @@ -285,18 +278,12 @@ public class ViewState extends TransitionableState { if (redirect != null) { return redirect.booleanValue(); } - if (getAjaxDriven(context) != null) { - if (context.getExternalContext().isAjaxRequest()) { - return false; - } + if (context.getExternalContext().isAjaxRequest() && context.getEmbeddedMode()) { + return false; } return context.getRedirectInSameState(); } - private Boolean getAjaxDriven(RequestControlContext context) { - return context.getActiveFlow().getAttributes().getBoolean(AJAX_DRIVEN_ATTRIBUTE_NAME); - } - private void render(RequestControlContext context, View view) throws ViewRenderingException { if (logger.isDebugEnabled()) { logger.debug("Rendering + " + view); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilder.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilder.java index 8eb6d253..db544f21 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilder.java @@ -76,7 +76,6 @@ import org.springframework.webflow.engine.model.AbstractActionModel; import org.springframework.webflow.engine.model.AbstractMappingModel; import org.springframework.webflow.engine.model.AbstractStateModel; import org.springframework.webflow.engine.model.ActionStateModel; -import org.springframework.webflow.engine.model.AjaxDrivenModel; import org.springframework.webflow.engine.model.AttributeModel; import org.springframework.webflow.engine.model.BeanImportModel; import org.springframework.webflow.engine.model.BinderModel; @@ -383,7 +382,6 @@ public class FlowModelFlowBuilder extends AbstractFlowBuilder { MutableAttributeMap flowAttributes = parseMetaAttributes(flow.getAttributes()); parseAndPutPersistenceContext(flow.getPersistenceContext(), flowAttributes); parseAndPutSecured(flow.getSecured(), flowAttributes); - parseAndPutAjaxDriven(flow.getAjaxDriven(), flowAttributes); return flowAttributes; } @@ -929,12 +927,6 @@ public class FlowModelFlowBuilder extends AbstractFlowBuilder { } } - private void parseAndPutAjaxDriven(AjaxDrivenModel ajaxDrivenModel, MutableAttributeMap attributes) { - if (ajaxDrivenModel != null) { - attributes.put("ajaxDriven", Boolean.TRUE); - } - } - private void parseAndPutSecured(SecuredModel secured, MutableAttributeMap attributes) { if (secured != null) { SecurityRule rule = new SecurityRule(); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImpl.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImpl.java index e2ccca50..524a4185 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImpl.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImpl.java @@ -214,6 +214,9 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { if (logger.isDebugEnabled()) { logger.debug("Starting in " + externalContext + " with input " + input); } + if (hasEmbeddedModeAttribute(input)) { + attributes.asMap().put("embeddedMode", Boolean.TRUE); + } MessageContext messageContext = createMessageContext(null); RequestControlContext requestContext = createRequestContext(externalContext, messageContext); RequestContextHolder.setRequestContext(requestContext); @@ -243,9 +246,8 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { } public void resume(ExternalContext externalContext) throws FlowExecutionException, IllegalStateException { - Assert - .state(status == FlowExecutionStatus.ACTIVE, - "This FlowExecution cannot be resumed because it is not active; it has either not been started or has ended"); + Assert.state(status == FlowExecutionStatus.ACTIVE, + "This FlowExecution cannot be resumed because it is not active; it has either not been started or has ended"); if (logger.isDebugEnabled()) { logger.debug("Resuming in " + externalContext); } @@ -643,4 +645,14 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { return getActiveSessionInternal().getFlow().handleException(exception, context); } + private boolean hasEmbeddedModeAttribute(AttributeMap input) { + if (input != null) { + String mode = (String) input.get("mode"); + if (mode != null && mode.trim().toLowerCase().equals("embedded")) { + return true; + } + } + return false; + } + } \ No newline at end of file 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 0db51f2a..17f93595 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 @@ -251,11 +251,12 @@ class RequestControlContextImpl implements RequestControlContext { return true; } Boolean redirectInSameState = flowExecution.getAttributes().getBoolean("redirectInSameState"); - if (redirectInSameState != null) { - return redirectInSameState.booleanValue(); - } else { - return getRedirectOnPause(); - } + return (redirectInSameState != null) ? redirectInSameState.booleanValue() : getRedirectOnPause(); + } + + public boolean getEmbeddedMode() { + Boolean embedded = flowExecution.getAttributes().getBoolean("embeddedMode"); + return (embedded != null) ? embedded.booleanValue() : false; } public String toString() { @@ -264,4 +265,5 @@ class RequestControlContextImpl implements RequestControlContext { .append("attributes", attributes).append("messageContext", messageContext) .append("flowExecution", flowExecution).toString(); } + } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/AjaxDrivenModel.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/AjaxDrivenModel.java deleted file mode 100644 index dea32826..00000000 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/AjaxDrivenModel.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2004-2011 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.webflow.engine.model; - -/** - * Model support for the ajax-driven element. - * - * @author Rossen Stoyanchev - * @since 2.3 - */ -public class AjaxDrivenModel extends AbstractModel { - - public AjaxDrivenModel() { - } - - public boolean isMergeableWith(Model model) { - return false; - } - - public void merge(Model model) { - - } - - public Model createCopy() { - return new AjaxDrivenModel(); - } - -} diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/FlowModel.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/FlowModel.java index e7ff0e3b..2a98c122 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/FlowModel.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/FlowModel.java @@ -58,8 +58,6 @@ public class FlowModel extends AbstractModel { private PersistenceContextModel persistenceContext; - private AjaxDrivenModel ajaxDriven; - private LinkedList vars; private LinkedList inputs; @@ -226,20 +224,6 @@ public class FlowModel extends AbstractModel { this.persistenceContext = persistenceContext; } - /** - * @return the ajaxDriven model - */ - public AjaxDrivenModel getAjaxDriven() { - return ajaxDriven; - } - - /** - * @param ajaxDriven the ajaxDriven model to set - */ - public void setAjaxDriven(AjaxDrivenModel ajaxDriven) { - this.ajaxDriven = ajaxDriven; - } - /** * @return the vars */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/builder/xml/WebFlowEntityResolver.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/builder/xml/WebFlowEntityResolver.java index 8eb89788..136f6fad 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/builder/xml/WebFlowEntityResolver.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/builder/xml/WebFlowEntityResolver.java @@ -41,7 +41,7 @@ import org.xml.sax.SAXException; */ class WebFlowEntityResolver implements EntityResolver { - private static final String[] WEBFLOW_VERSIONS = new String[] { "spring-webflow-2.3", "spring-webflow-2.0" }; + private static final String[] WEBFLOW_VERSIONS = new String[] { "spring-webflow-2.0" }; public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { if (systemId != null && systemId.indexOf("spring-webflow.xsd") > -1) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/builder/xml/XmlFlowModelBuilder.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/builder/xml/XmlFlowModelBuilder.java index acedabfb..a9842463 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/builder/xml/XmlFlowModelBuilder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/builder/xml/XmlFlowModelBuilder.java @@ -31,7 +31,6 @@ import org.springframework.util.xml.DomUtils; import org.springframework.webflow.engine.model.AbstractActionModel; import org.springframework.webflow.engine.model.AbstractStateModel; import org.springframework.webflow.engine.model.ActionStateModel; -import org.springframework.webflow.engine.model.AjaxDrivenModel; import org.springframework.webflow.engine.model.AttributeModel; import org.springframework.webflow.engine.model.BeanImportModel; import org.springframework.webflow.engine.model.BinderModel; @@ -202,7 +201,6 @@ public class XmlFlowModelBuilder implements FlowModelBuilder { flow.setAttributes(parseAttributes(element)); flow.setSecured(parseSecured(element)); flow.setPersistenceContext(parsePersistenceContext(element)); - flow.setAjaxDriven(parseAjaxDriven(element)); flow.setVars(parseVars(element)); flow.setInputs(parseInputs(element)); flow.setOnStartActions(parseOnStartActions(element)); @@ -412,15 +410,6 @@ public class XmlFlowModelBuilder implements FlowModelBuilder { } } - private AjaxDrivenModel parseAjaxDriven(Element element) { - element = DomUtils.getChildElementByTagName(element, "ajax-driven"); - if (element == null) { - return null; - } else { - return new AjaxDrivenModel(); - } - } - private VarModel parseVar(Element element) { return new VarModel(element.getAttribute("name"), element.getAttribute("class")); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/builder/xml/spring-webflow-2.3.xsd b/spring-webflow/src/main/java/org/springframework/webflow/engine/model/builder/xml/spring-webflow-2.3.xsd deleted file mode 100644 index ed1894dc..00000000 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/model/builder/xml/spring-webflow-2.3.xsd +++ /dev/null @@ -1,1596 +0,0 @@ - - - - - - -This schema defines Spring Web Flow's XML-based flow definition language. -
-The root "flow" element in this document defines exactly one flow definition. -A flow definition is a blueprint for a carrying out a conversation with a single user. -
-A flow is composed of one or more states that form the steps of the flow. -Each state executes a behavior when entered. What behavior is executed is a -function of the state's type. Core state types include view states, -action states, subflow states, decision states, and end states. -
-A flow definition has exactly one start state. -Events that occur within states drive state transitions. -]]> -
-
- - - - - - - - -A flow may also exhibit the following characteristics: -

    -
  • Be annotated with attributes that define descriptive properties that may affect flow execution. -(See the <attribute/> element) - -
  • Be secured -(See the <secured/> element) - -
  • Be a persistence context for managing persistent objects during the course of flow execution. -(See the <persistence-context/> element) - -
  • Instantiate a set of instance variables when started. -(See the <var/> element) - -
  • Map input provided by callers that start it -(See the <input/> element) - -
  • Return output to callers that end it. -(See the <output/> element) - -
  • Execute actions at start time and end time. -(See the <on-start/> and <on-end/> elements) - -
  • Define transitions shared by all states. -(See the <global-transitions/> element) - -
  • Handle exceptions thrown by during flow execution. -(See the <exception-handler/> element) - -
  • Import one or more local bean definition files defining custom flow artifacts -(such as actions, exception handlers, view factories, transition criteria, etc). -(See the <bean-import/> element) -
-]]> - - - - - - - - - - - - - - - - - - - - - - -The persistence context can be referenced from within this flow by the "entityManager" variable. -]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - . -If inheriting from a state defined in another flow, the flowId prefix is required. -If inheriting from a state defined in this flow, the flowId should not be specified. -For example,
<action-state id="state" parent="myParentFlow#myParentState">
or
<action-state id="state" parent="#myLocalParentState">
-]]> -
-
-
-
-
- - - - -Once paused, a view-state may be 'refreshed' by the user. -A refresh causes the response to be reissued and then returns control back to the user. -
-A view state may be configured with one or more render-actions using the 'on-render' element. -Render actions are executed immediately before the view is rendered. -
-A view state is a transitionable state. -A view state transition is triggered by a user event. -]]> -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - . -If inheriting from a state defined in another flow, the flowId prefix is required. -If inheriting from a state defined in this flow, the flowId should not be specified. -For example,
<view-state id="state" parent="myParentFlow#myParentState">
or
<view-state id="state" parent="#myLocalParentState">
-]]> -
-
-
- - - - - priceForm.jsp - -Can also be an evaluatable expression: -
-	${flowScope.myViewExpression}
-
-The externalRedirect: prefix may be used to redirect to an external location, typically to interface with an external system or controller. -External redirect query parameters may be specified using ${expressions} that evaluate against the request context. -The supported formats for an encoded externalRedirect expression are: -
-	externalRedirect:
-	externalRedirect:contextRelative:
-	externalRedirect:serverRelative:
-	externalRedirect:
-
-For example: -
-	externalRedirect:/hotels/index
-	externalRedirect:http://someOtherSystem?orderId=${order.id}&callbackUrl=${flowExecutionUrl}
-
-The flowRedirect: prefix may be used to redirect to another flow: -
-	flowRedirect:myOtherFlow?someData=${flowScope.data}
-
-For exotic usages, you may plug in a custom ViewFactory bean you define: -
-	${myCustomViewFactory}
-
-When this attribute is not specified, the view to render will be determined by convention. -The default convention is to treat the id of this view state as the view identifier. -]]> -
-
-
- - - - - - - - - - - - - - - - - - - - - -
-
- - - - -A decision state is a transitionable state. -A decision state transition can be triggered by evaluating a boolean expression against the flow execution request context. -To define transition expressions, use the 'if' element. -
-Examples: -
-A simple boolean expression test, using the convenient 'if' element: -
-    <decision-state id="requiresShipping">
-	    <if test="sale.requiresShipping" then="enterShippingDetails" else="processSale"/>
-    </decision-state>
-
-]]> -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -The form is: -
-	<if test="criteriaExpression" then="trueStateId" else="falseStateId"/>
-
-]]> -
-
- - - - - - <if test="sale.requiresShipping" then="enterShippingDetails"/> - -]]> - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - . -If inheriting from a state defined in another flow, the flowId prefix is required. -If inheriting from a state defined in this flow, the flowId should not be specified. -For example,
<decision-state id="state" parent="myParentFlow#myParentState">
or
<decision-state id="state" parent="#myLocalParentState">
-]]> -
-
-
-
-
- - - - -A subflow state is a transitionable state. -A transition is triggered by the subflow outcome that was reached. -]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - . -If inheriting from a state defined in another flow, the flowId prefix is required. -If inheriting from a state defined in this flow, the flowId should not be specified. -For example,
<subflow-state id="state" parent="myParentFlow#myParentState">
or
<subflow-state id="state" parent="#myLocalParentState">
-]]> -
-
-
- - - - - - - - - - - - - - -
-
- - - - -An end state is not transitionable; there are never transitions out of an end state. -When an end-state is entered, an instance of this flow is terminated. -
-When this flow terminates, if it was the "root" flow the entire execution is terminated. -If this flow was a subflow, its parent flow resumes. -]]> -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - . -If inheriting from a state defined in another flow, the flowId prefix is required. -If inheriting from a state defined in this flow, the flowId should not be specified. -For example,
<end-state id="state" parent="myParentFlow#myParentState">
or
<end-state id="state" parent="#myLocalParentState">
-]]> -
-
-
- - - - - priceForm.jsp - -It can also be an evaluatable expression: -
-	${flowScope.myViewExpression}
-
-The externalRedirect: prefix may be used to request a redirect to an external location, typically to interface with an external system or controller. -External redirect query parameters may be specified using ${expressions} that evaluate against the request context. -The supported formats for an encoded externalRedirect expression are: -
-	externalRedirect:
-	externalRedirect:contextRelative:
-	externalRedirect:serverRelative:
-	externalRedirect:
-
-For example: -
-	externalRedirect:/hotels/index
-	externalRedirect:http://someOtherSystem?orderId=${order.id}
-
-The flowRedirect: prefix may be used to redirect to another flow: -
-	flowRedirect:myOtherFlow?someData=${flowScope.data}
-
-For exotic usages, you may plug in a custom ViewFactory bean you define: -
-	${myCustomViewFactory}
-
-
-When this attribute is not specified, no final response will be issued. -In this case, the caller is expected to handle this flow outcome. -]]> -
-
-
- - - - - - - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -For example: -
-    <bean-import resource="orderitem-flow-beans.xml"/>
-
-... would look for 'orderitem-flow-beans.xml' in the same directory as this document. -]]> -
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Note: Cannot be used in conjunction with an exception based transition. -]]> - - - - - - - - - - <transition on="submit" to="state"/> - -... which reads "on the occurrence of the 'submit' event, transition to 'state'" -
-Sophisticated transitional expressions are also supported when enclosed in a delimited expression: -
-	<transition on="${currentEvent.id == 'submit' &;amp;& flowScope.attribute == 'foo'}" to="state"/>
-
-]]> -
-
-
- - - - -The value of this attribute must be a fully-qualified java.lang.Exception class name (e.g. example.booking.ItineraryExpiredException). -Superclasses of the configured exception class match by default. Use this attribute or the 'on' attribute, not both. -
-Note: Cannot be used in conjunction with a secured element. -]]> -
-
-
- - - - -The value of this attribute may be a static state identifier (e.g. to="displayForm") or a dynamic expression (e.g. to="${flowScope.previousViewState}"). -If no value is specified, this transition acts as a simple event handler and will not change the state of the flow. -]]> - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Note: This element configures a meta-attribute. -For the attribute to be enforced, the flow execution must be observed by a SecurityFlowExecutionListener. -]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 9ccfe3e7..ec0b959b 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 @@ -137,6 +137,14 @@ public class MockRequestControlContext extends MockRequestContext implements Req } } + public boolean getEmbeddedMode() { + Boolean embedded = getMockFlowExecutionContext().getAttributes().getBoolean("embeddedMode"); + if (embedded != null) { + return embedded; + } + return false; + } + // implementation specific accessors for testing public void setAlwaysRedirectOnPause(boolean alwaysRedirectOnPause) { @@ -149,4 +157,8 @@ public class MockRequestControlContext extends MockRequestContext implements Req .put("redirectInSameState", Boolean.valueOf(redirectInSameState)); } + public void setEmbeddedMode(boolean embedded) { + getMockFlowExecutionContext().getAttributeMap().put("embeddedMode", Boolean.valueOf(embedded)); + } + } \ No newline at end of file diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/ViewStateTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/ViewStateTests.java index bd78fbd1..8e937b7c 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/ViewStateTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/ViewStateTests.java @@ -443,28 +443,23 @@ public class ViewStateTests extends TestCase { assertTrue(context.getMockExternalContext().getFlowExecutionRedirectRequested()); } - public void testAjaxDrivenAttributeOverridesRedirectInSameState() { + public void testEmbeddedModeOverridesRedirectInSameState() { Flow flow = new Flow("myFlow"); - flow.getAttributes().put("ajaxDriven", Boolean.TRUE); StubViewFactory viewFactory = new StubViewFactory(); ViewState state = new ViewState(flow, "viewState", viewFactory); Transition t = new Transition(on("submit"), null); state.getTransitionSet().add(t); MockRequestControlContext context = new MockRequestControlContext(flow); - state.enter(context); - context = new MockRequestControlContext(context.getFlowExecutionContext()); context.getMockExternalContext().setAjaxRequest(true); + context.setEmbeddedMode(true); context.setAlwaysRedirectOnPause(true); context.setRedirectInSameState(true); - context.getFlowScope().remove("renderCalled"); - context.putRequestParameter("_eventId", "submit"); - state.resume(context); + state.enter(context); assertFalse(context.getMockExternalContext().getFlowExecutionRedirectRequested()); } - public void testViewStateRedirectOverridesAjaxDrivenAttribute() { + public void testViewStateRedirectOverridesEmbeddedMode() { Flow flow = new Flow("myFlow"); - flow.getAttributes().put("ajaxDriven", Boolean.TRUE); StubViewFactory viewFactory = new StubViewFactory(); ViewState state = new ViewState(flow, "viewState", viewFactory); state.setRedirect(false); @@ -472,13 +467,10 @@ public class ViewStateTests extends TestCase { state.getTransitionSet().add(t); MockRequestControlContext context = new MockRequestControlContext(flow); state.enter(context); - context = new MockRequestControlContext(context.getFlowExecutionContext()); context.getMockExternalContext().setAjaxRequest(true); + context.setEmbeddedMode(true); context.setAlwaysRedirectOnPause(true); context.setRedirectInSameState(true); - context.getFlowScope().remove("renderCalled"); - context.putRequestParameter("_eventId", "submit"); - state.resume(context); assertFalse(context.getMockExternalContext().getFlowExecutionRedirectRequested()); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilderTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilderTests.java index d211a18b..f6e68367 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilderTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilderTests.java @@ -18,7 +18,6 @@ import org.springframework.webflow.engine.ViewState; import org.springframework.webflow.engine.builder.FlowAssembler; import org.springframework.webflow.engine.builder.FlowBuilderException; import org.springframework.webflow.engine.impl.FlowExecutionImplFactory; -import org.springframework.webflow.engine.model.AjaxDrivenModel; import org.springframework.webflow.engine.model.AttributeModel; import org.springframework.webflow.engine.model.EndStateModel; import org.springframework.webflow.engine.model.EvaluateModel; @@ -130,14 +129,6 @@ public class FlowModelFlowBuilderTests extends TestCase { assertTrue(((Boolean) flow.getAttributes().get("persistenceContext")).booleanValue()); } - public void testAjaxDrivenFlow() { - model.setAjaxDriven(new AjaxDrivenModel()); - model.setStates(singleList(new EndStateModel("end"))); - Flow flow = getFlow(model); - assertNotNull(flow.getAttributes().get("ajaxDriven")); - assertTrue(((Boolean) flow.getAttributes().get("ajaxDriven")).booleanValue()); - } - public void testFlowInputOutputMapping() { InputModel input1 = new InputModel("foo", "flowScope.foo"); InputModel input2 = new InputModel("foo", "flowScope.bar"); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/model/builder/xml/WebFlowEntityResolverTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/model/builder/xml/WebFlowEntityResolverTests.java index e2c49dd4..9207405f 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/model/builder/xml/WebFlowEntityResolverTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/model/builder/xml/WebFlowEntityResolverTests.java @@ -8,13 +8,6 @@ public class WebFlowEntityResolverTests extends TestCase { private static final String PUBLIC_ID = "http://www.springframework.org/schema/webflow"; - public void testResolve23() throws Exception { - WebFlowEntityResolver resolver = new WebFlowEntityResolver(); - InputSource source = resolver.resolveEntity(PUBLIC_ID, - "http://www.springframework.org/schema/webflow/spring-webflow-2.3.xsd"); - assertNotNull(source); - } - public void testResolve20() throws Exception { WebFlowEntityResolver resolver = new WebFlowEntityResolver(); InputSource source = resolver.resolveEntity(PUBLIC_ID, diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/model/builder/xml/XmlFlowModelBuilderTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/model/builder/xml/XmlFlowModelBuilderTests.java index 967b46fb..19915556 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/model/builder/xml/XmlFlowModelBuilderTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/model/builder/xml/XmlFlowModelBuilderTests.java @@ -13,7 +13,6 @@ import org.springframework.webflow.engine.builder.FlowAssembler; import org.springframework.webflow.engine.builder.model.FlowModelFlowBuilder; import org.springframework.webflow.engine.impl.FlowExecutionImplFactory; import org.springframework.webflow.engine.model.AbstractStateModel; -import org.springframework.webflow.engine.model.AjaxDrivenModel; import org.springframework.webflow.engine.model.AttributeModel; import org.springframework.webflow.engine.model.BindingModel; import org.springframework.webflow.engine.model.ExceptionHandlerModel; @@ -104,16 +103,6 @@ public class XmlFlowModelBuilderTests extends TestCase { assertEquals("ROLE_USER", secured.getAttributes()); } - public void testFlowAjaxDriven() { - ClassPathResource resource = new ClassPathResource("flow-ajax-driven.xml", getClass()); - FlowModelBuilder builder = new XmlFlowModelBuilder(resource, registry); - builder.init(); - builder.build(); - FlowModel flow = builder.getFlowModel(); - AjaxDrivenModel ajaxDriven = flow.getAjaxDriven(); - assertNotNull(ajaxDriven); - } - public void testFlowSecuredState() { ClassPathResource resource = new ClassPathResource("flow-secured-state.xml", getClass()); FlowModelBuilder builder = new XmlFlowModelBuilder(resource, registry); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/model/builder/xml/flow-ajax-driven.xml b/spring-webflow/src/test/java/org/springframework/webflow/engine/model/builder/xml/flow-ajax-driven.xml deleted file mode 100644 index 85ce29a6..00000000 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/model/builder/xml/flow-ajax-driven.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - \ No newline at end of file