flow handler fixes
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
<tag>
|
||||
<description>
|
||||
<![CDATA[<p>Renders the necessary CSS stylesheet includes for the Spring Faces components.</p>
|
||||
|
||||
<p>Use of this tag in the head section of a page that contains the Spring Faces components is recommended
|
||||
as a browser performance optimization in keeping with the <a href="http://developer.yahoo.com/performance/">
|
||||
Yahoo performance guidelines</a>. If this tag is not included, the stylesheet includes will be rendered
|
||||
@@ -25,7 +24,6 @@
|
||||
<tag>
|
||||
<description>
|
||||
<![CDATA[<p>Renders a resource include that will route through the <code>ResourceServlet</code>.</p>
|
||||
|
||||
<p>The included resource can be either CSS or JavaScript. The type of include to render will be determined
|
||||
from the resource's file extension. The ResourceServlet will set the proper response headers for aggressive
|
||||
caching of the resource by the browser and will gzip the resource if the client browser supports it. These
|
||||
@@ -104,16 +102,16 @@
|
||||
</attribute>
|
||||
<attribute>
|
||||
<description><![CDATA[JavaScript regular expression string used to validate the input.]]></description>
|
||||
<name></name>
|
||||
<required>regExp</required>
|
||||
<name>regExp</name>
|
||||
<required>false</required>
|
||||
<deferred-value>
|
||||
<type>java.lang.String</type>
|
||||
</deferred-value>
|
||||
</attribute>
|
||||
<attribute>
|
||||
<description><![CDATA[If true, the field must be non-empty to pass client-side validation.]]></description>
|
||||
<name></name>
|
||||
<required>required</required>
|
||||
<name>required</name>
|
||||
<required>false</required>
|
||||
<deferred-value>
|
||||
<type>boolean</type>
|
||||
</deferred-value>
|
||||
@@ -177,16 +175,16 @@
|
||||
</attribute>
|
||||
<attribute>
|
||||
<description><![CDATA[JavaScript regular expression string used to validate the input.]]></description>
|
||||
<name></name>
|
||||
<required>regExp</required>
|
||||
<name>regExp</name>
|
||||
<required>false</required>
|
||||
<deferred-value>
|
||||
<type>java.lang.String</type>
|
||||
</deferred-value>
|
||||
</attribute>
|
||||
<attribute>
|
||||
<description><![CDATA[If true, the field must be non-empty to pass client-side validation.]]></description>
|
||||
<name></name>
|
||||
<required>required</required>
|
||||
<name>required</name>
|
||||
<required>false</required>
|
||||
<deferred-value>
|
||||
<type>boolean</type>
|
||||
</deferred-value>
|
||||
@@ -250,16 +248,16 @@
|
||||
</attribute>
|
||||
<attribute>
|
||||
<description><![CDATA[JavaScript regular expression string used to validate the input.]]></description>
|
||||
<name></name>
|
||||
<required>regExp</required>
|
||||
<name>regExp</name>
|
||||
<required>false</required>
|
||||
<deferred-value>
|
||||
<type>java.lang.String</type>
|
||||
</deferred-value>
|
||||
</attribute>
|
||||
<attribute>
|
||||
<description><![CDATA[If true, the field must be non-empty to pass client-side validation.]]></description>
|
||||
<name></name>
|
||||
<required>required</required>
|
||||
<name>required</name>
|
||||
<required>false</required>
|
||||
<deferred-value>
|
||||
<type>boolean</type>
|
||||
</deferred-value>
|
||||
@@ -1661,7 +1659,6 @@
|
||||
</deferred-value>
|
||||
</attribute>
|
||||
</tag>
|
||||
</tag>
|
||||
|
||||
<tag>
|
||||
<description>
|
||||
@@ -1697,12 +1694,8 @@
|
||||
a literal String and handle any custom processing of the event in the
|
||||
flow definition.]]>
|
||||
</description>
|
||||
<name>
|
||||
action
|
||||
</name>
|
||||
<required>
|
||||
false
|
||||
</required>
|
||||
<name>action</name>
|
||||
<required>false</required>
|
||||
<deferred-method>
|
||||
<method-signature>
|
||||
java.lang.Object action()
|
||||
@@ -1710,8 +1703,8 @@
|
||||
</deferred-method>
|
||||
</attribute>
|
||||
<attribute>
|
||||
<description>The event to listen to on the child component that will trigger the Ajax request. For example,
|
||||
<code>event="onchange"</code> will fire an Ajax event when the child component's value changes.
|
||||
<description><![CDATA[The event to listen to on the child component that will trigger the Ajax request. For example,
|
||||
<code>event="onchange"</code> will fire an Ajax event when the child component's value changes.]]>
|
||||
</description>
|
||||
<name>event</name>
|
||||
</attribute>
|
||||
@@ -1729,5 +1722,5 @@
|
||||
</deferred-value>
|
||||
</attribute>
|
||||
</tag>
|
||||
|
||||
|
||||
</taglib>
|
||||
@@ -9,6 +9,6 @@ import org.springframework.webflow.mvc.servlet.AbstractFlowHandler;
|
||||
public class BookingFlowHandler extends AbstractFlowHandler {
|
||||
public String handleExecutionOutcome(String outcome, AttributeMap output, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
return "/spring/hotels/index";
|
||||
return "hotels/index";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,15 +270,22 @@ public class FlowController extends AbstractController {
|
||||
FlowHandler handler = getFlowHandler(flowId);
|
||||
if (handler != null) {
|
||||
String location = handler.handleExecutionOutcome(outcome, endedOutput, request, response);
|
||||
return location != null ? createRedirectView(location) : defaultHandleFlowOutcome(flowId, outcome,
|
||||
return location != null ? createRedirectView(location, request) : defaultHandleFlowOutcome(flowId, outcome,
|
||||
endedOutput, request, response);
|
||||
} else {
|
||||
return defaultHandleFlowOutcome(flowId, outcome, endedOutput, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
private ModelAndView createRedirectView(String location) {
|
||||
return new ModelAndView(new RedirectView(location, true));
|
||||
private ModelAndView createRedirectView(String location, HttpServletRequest request) {
|
||||
if (location.startsWith("/")) {
|
||||
return new ModelAndView(new RedirectView(location, true));
|
||||
} else {
|
||||
StringBuffer url = new StringBuffer(request.getServletPath());
|
||||
url.append('/');
|
||||
url.append(location);
|
||||
return new ModelAndView(new RedirectView(url.toString(), true));
|
||||
}
|
||||
}
|
||||
|
||||
private ModelAndView handleFlowException(FlowException e, HttpServletRequest request, HttpServletResponse response)
|
||||
|
||||
@@ -54,6 +54,11 @@ public interface FlowHandler {
|
||||
/**
|
||||
* Handles a specific flow execution outcome. Used by a Controller to get the location of the resource to redirect
|
||||
* to after the outcome is handled.
|
||||
* <p>
|
||||
* If the location string returned begins with a forward-slash, the location is treated as relative to the web
|
||||
* application context path. If the location string does not begin with a slash, the location is treated as relative
|
||||
* to the current servlet path.
|
||||
*
|
||||
* @param outcome the outcome that was reached
|
||||
* @param output the output returned by the flow execution
|
||||
* @param request the current request
|
||||
|
||||
@@ -227,16 +227,23 @@ public class FlowHandlerAdapter extends WebApplicationObjectSupport implements H
|
||||
} else {
|
||||
String location = handler.handleExecutionOutcome(result.getEndedOutcome(), result.getEndedOutput(),
|
||||
request, response);
|
||||
return location != null ? createRedirectView(location) : defaultHandleFlowOutcome(result.getFlowId(),
|
||||
result.getEndedOutcome(), result.getEndedOutput(), request, response);
|
||||
return location != null ? createRedirectView(location, request) : defaultHandleFlowOutcome(result
|
||||
.getFlowId(), result.getEndedOutcome(), result.getEndedOutput(), request, response);
|
||||
}
|
||||
} else {
|
||||
throw new IllegalStateException("Execution result should have been one of [paused] or [ended]");
|
||||
}
|
||||
}
|
||||
|
||||
private ModelAndView createRedirectView(String location) {
|
||||
return new ModelAndView(new RedirectView(location, true));
|
||||
private ModelAndView createRedirectView(String location, HttpServletRequest request) {
|
||||
if (location.startsWith("/")) {
|
||||
return new ModelAndView(new RedirectView(location, true));
|
||||
} else {
|
||||
StringBuffer url = new StringBuffer(request.getServletPath());
|
||||
url.append('/');
|
||||
url.append(location);
|
||||
return new ModelAndView(new RedirectView(url.toString(), true));
|
||||
}
|
||||
}
|
||||
|
||||
private void sendRedirect(ServletExternalContext context, HttpServletRequest request, HttpServletResponse response,
|
||||
|
||||
Reference in New Issue
Block a user