diff --git a/spring-faces/src/main/resources/META-INF/spring-faces.tld b/spring-faces/src/main/resources/META-INF/spring-faces.tld index fd69cde2..0d5fe59d 100644 --- a/spring-faces/src/main/resources/META-INF/spring-faces.tld +++ b/spring-faces/src/main/resources/META-INF/spring-faces.tld @@ -11,7 +11,6 @@ Renders the necessary CSS stylesheet includes for the Spring Faces components.

-

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 Yahoo performance guidelines. If this tag is not included, the stylesheet includes will be rendered @@ -25,7 +24,6 @@ Renders a resource include that will route through the ResourceServlet.

-

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 @@ - - regExp + regExp + false java.lang.String - - required + required + false boolean @@ -177,16 +175,16 @@ - - regExp + regExp + false java.lang.String - - required + required + false boolean @@ -250,16 +248,16 @@ - - regExp + regExp + false java.lang.String - - required + required + false boolean @@ -1661,7 +1659,6 @@ - @@ -1697,12 +1694,8 @@ a literal String and handle any custom processing of the event in the flow definition.]]> - - action - - - false - + action + false java.lang.Object action() @@ -1710,8 +1703,8 @@ - The event to listen to on the child component that will trigger the Ajax request. For example, - event="onchange" will fire an Ajax event when the child component's value changes. + event="onchange" will fire an Ajax event when the child component's value changes.]]> event @@ -1729,5 +1722,5 @@ - + \ No newline at end of file diff --git a/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/BookingFlowHandler.java b/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/BookingFlowHandler.java index d701a26a..6ae0e015 100644 --- a/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/BookingFlowHandler.java +++ b/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/BookingFlowHandler.java @@ -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"; } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowController.java b/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowController.java index e2f05ca0..8ffe9406 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowController.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowController.java @@ -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) diff --git a/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowHandler.java b/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowHandler.java index ba4e0f9a..3c810916 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowHandler.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowHandler.java @@ -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. + *

+ * 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 diff --git a/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowHandlerAdapter.java b/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowHandlerAdapter.java index 23a65976..b9a788f6 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowHandlerAdapter.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/mvc/servlet/FlowHandlerAdapter.java @@ -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,