Spring Webflow: How to to customize externalRedirect in end-state?

Wilhelm Kleu picture Wilhelm Kleu · Aug 5, 2011 · Viewed 7.7k times · Source

The parent flow of my webflows has the following end-state defined:

<end-state id="endState" view="externalRedirect:contextRelative:index.html"/>

This will redirect to http://server/context/index.html

All my flows are now configured to run in an "embedded" mode (no menus/header/etc.) if the context path contains /embedded (I implemented this by using my own ViewResolver and different tiles layouts). Example: http://server/context/embedded/page.htm uses the same flow as http://server/context/page.htm but with a different layout.

When the site is running in "embedded" mode I want the end-state to redirect to http://server/context/embedded/index.html.

How can I customize this to rather use externalRedirect:contextRelative:embedded/index.html when the the URI contains /embedded?

Answer

Link19 picture Link19 · Mar 1, 2012

You could determine the embedded state from a managed bean and use EL to determine a path:

externalRedirect:contextRelative:#{myBean.getPath()}