Ok thanks
Here is a fix for flowController mapped to extension :
Code:
package com.netapsys.shop.flow.handler;
import javax.servlet.http.HttpServletRequest;
import org.springframework.webflow.context.servlet.DefaultFlowUrlHandler;
import org.springframework.webflow.core.collection.AttributeMap;
/**
* An extension of {@link DefaultFlowUrlHandler} to handle
* the relaunch of flow mapped with extension such "*.html".
*
* When the swf send a redirect to the browser for an expired flow
* the url is simply the id of the flow.
*
* Thus this class is a quick fix and should be deprecated soon.
*
* How to use it ?
*
* In Your dispatcher config :
* <bean id="flowController" class="org.springframework.webflow.mvc.servlet.FlowController">
* <constructor-arg ref="flowExecutor" />
* <property name="flowUrlHandler" ref="urlHandler" />
* </bean>
* <bean id="urlHandler" class="com.netapsys.shop.flow.handler.SimpleExtensionUrlHandler">
* <property name="extension" value="html" />
* </bean>
*
* @author Michael Courcy
* @date 4 mai 08
* @version $Revision$ $Date$
*
*/
public class SimpleExtensionUrlHandler
extends DefaultFlowUrlHandler
{
/**
* The extension we must add at the end of the url when the a redicect is
* sent to the browser.
*/
private String extension = "";
/**
* {@inheritDoc}
*
* @see org.springframework.webflow.context.servlet.DefaultFlowUrlHandler
* #createFlowDefinitionUrl(java.lang.String,
* org.springframework.webflow.core.collection.AttributeMap,
* javax.servlet.http.HttpServletRequest)
*/
public String createFlowDefinitionUrl(final String flowId,
final AttributeMap input, final HttpServletRequest request)
{
final String initialUrl = super.createFlowDefinitionUrl(flowId, input,
request);
if ("".equals(extension)) {
return initialUrl;
}
else {
final String urlWithExtension = addExtenstionToUrl(initialUrl,
extension);
return urlWithExtension;
}
}
/**
* Add an extension to the url.
*
* @param initialUrl the url we must change with an extra extension
* @param ext the value of the extension, you have to set this extension
* with {@link #setExtension(String)}
* @return the url modified
*/
public String addExtenstionToUrl(final String initialUrl, final String ext)
{
final int posQuestionMark = initialUrl.indexOf("?");
if (posQuestionMark == -1) {
return initialUrl + "." + ext;
}
else {
final String firstPartUrl = initialUrl.substring(0, posQuestionMark);
final String secondPartUrl = initialUrl.substring(posQuestionMark);
return firstPartUrl + "." + ext + secondPartUrl;
}
}
/**
* Getter for <code>extension</code>.
*
* @return the value of extension.
*/
public String getExtension()
{
return extension;
}
/**
* Setter for <code>extension</code>.
*
* @param extension : the value to set in extension.
*/
public void setExtension(final String extension)
{
this.extension = extension;
}
}
in your dispatcher config :
Code:
<bean id="flowController" class="org.springframework.webflow.mvc.servlet.FlowController">
<constructor-arg ref="flowExecutor" />
<property name="flowUrlHandler" ref="urlHandler" />
</bean>
<bean id="urlHandler" class="com.netapsys.shop.flow.handler.SimpleExtensionUrlHandler">
<property name="extension" value="html" />
</bean>
For you lumpynose yo will use "zug" instead of "html".
Do you want me to propose a fix directly in DefaultFlowUrlHandler ?