diff --git a/spring-webflow-samples/booking-jsf/src/main/webapp/WEB-INF/web.xml b/spring-webflow-samples/booking-jsf/src/main/webapp/WEB-INF/web.xml index e6515d92..0ddf630c 100755 --- a/spring-webflow-samples/booking-jsf/src/main/webapp/WEB-INF/web.xml +++ b/spring-webflow-samples/booking-jsf/src/main/webapp/WEB-INF/web.xml @@ -28,6 +28,18 @@ facelets.BUILD_BEFORE_RESTORE false + + + Resources Servlet + org.springframework.faces.ui.resource.ResourceServlet + 0 + + + + + Resources Servlet + /resources/* + @@ -50,7 +62,7 @@ contextConfigLocation /WEB-INF/config/web-application-config.xml - 1 + 2 diff --git a/spring-webflow-samples/booking-jsf/src/main/webapp/intro.xhtml b/spring-webflow-samples/booking-jsf/src/main/webapp/intro.xhtml index 4d20d74e..b51eda13 100755 --- a/spring-webflow-samples/booking-jsf/src/main/webapp/intro.xhtml +++ b/spring-webflow-samples/booking-jsf/src/main/webapp/intro.xhtml @@ -6,12 +6,12 @@ Spring Faces: Hotel Booking Sample Application diff --git a/spring-webflow-samples/booking-jsf/src/main/webapp/template.xhtml b/spring-webflow-samples/booking-jsf/src/main/webapp/template.xhtml index d4ea33c9..8967b059 100644 --- a/spring-webflow-samples/booking-jsf/src/main/webapp/template.xhtml +++ b/spring-webflow-samples/booking-jsf/src/main/webapp/template.xhtml @@ -6,12 +6,12 @@ Spring Faces: Hotel Booking Sample Application diff --git a/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/DefaultFlowUrlHandler.java b/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/DefaultFlowUrlHandler.java index d9aaa5e4..ccd1803a 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/DefaultFlowUrlHandler.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/DefaultFlowUrlHandler.java @@ -33,10 +33,7 @@ public class DefaultFlowUrlHandler implements FlowUrlHandler { public String createFlowExecutionUrl(String flowId, String flowExecutionKey, HttpServletRequest request) { StringBuffer url = new StringBuffer(); - url.append(request.getContextPath()); - url.append(request.getServletPath()); - url.append('/'); - url.append(encode(flowId)); + url.append(request.getRequestURI()); url.append('?'); appendQueryParameter(url, "execution", flowExecutionKey); return url.toString(); @@ -44,8 +41,7 @@ public class DefaultFlowUrlHandler implements FlowUrlHandler { public String createFlowDefinitionUrl(String flowId, AttributeMap input, HttpServletRequest request) { StringBuffer url = new StringBuffer(); - url.append(request.getContextPath()); - url.append(request.getServletPath()); + url.append(getFlowHandlerUri(request)); url.append('/'); url.append(encode(flowId)); if (input != null && !input.isEmpty()) { @@ -84,4 +80,10 @@ public class DefaultFlowUrlHandler implements FlowUrlHandler { } } + private String getFlowHandlerUri(HttpServletRequest request) { + String flowRequestUri = request.getRequestURI(); + int lastSlash = flowRequestUri.lastIndexOf('/'); + return flowRequestUri.substring(0, lastSlash); + } + } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/DefaultFlowUrlHandlerTests.java b/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/DefaultFlowUrlHandlerTests.java index c3a81c35..c7001613 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/DefaultFlowUrlHandlerTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/DefaultFlowUrlHandlerTests.java @@ -5,7 +5,6 @@ import java.util.LinkedHashMap; import junit.framework.TestCase; import org.springframework.mock.web.MockHttpServletRequest; -import org.springframework.webflow.context.servlet.DefaultFlowUrlHandler; import org.springframework.webflow.core.collection.CollectionUtils; import org.springframework.webflow.core.collection.LocalAttributeMap; @@ -34,6 +33,7 @@ public class DefaultFlowUrlHandlerTests extends TestCase { request.setContextPath("/springtravel"); request.setServletPath("/app"); request.setPathInfo("/foo"); + request.setRequestURI("/springtravel/app/foo"); String url = urlHandler.createFlowDefinitionUrl("bookHotel", null, request); assertEquals("/springtravel/app/bookHotel", url); } @@ -42,6 +42,7 @@ public class DefaultFlowUrlHandlerTests extends TestCase { request.setContextPath("/springtravel"); request.setServletPath("/app"); request.setPathInfo("/foo"); + request.setRequestURI("/springtravel/app/foo"); String url = urlHandler.createFlowDefinitionUrl("bookHotel", CollectionUtils.EMPTY_ATTRIBUTE_MAP, request); assertEquals("/springtravel/app/bookHotel", url); } @@ -50,6 +51,7 @@ public class DefaultFlowUrlHandlerTests extends TestCase { request.setContextPath("/springtravel"); request.setServletPath("/app"); request.setPathInfo("/foo"); + request.setRequestURI("/springtravel/app/foo"); LocalAttributeMap input = new LocalAttributeMap(new LinkedHashMap()); input.put("foo", "bar"); input.put("bar", "needs encoding"); @@ -63,6 +65,7 @@ public class DefaultFlowUrlHandlerTests extends TestCase { request.setContextPath("/springtravel"); request.setServletPath("/app"); request.setPathInfo("/foo"); + request.setRequestURI("/springtravel/app/foo"); String url = urlHandler.createFlowExecutionUrl("foo", "12345", request); assertEquals("/springtravel/app/foo?execution=12345", url); }