Hello Friends Iam试图处理
org.springframework.webflow.execution.repository.snapshot.SnapshotNotFoundException
这个例外,但我没有这样做。 通过这种方式我处理SnapshotNotFoundException。
<transition on-exception="org.springframework.webflow.execution.repository.snapshot.SnapshotNotFoundException"
to="exceptionHandler" />
答案 0 :(得分:4)
声明性异常处理似乎不适用于内部Web Flow异常。对于这种特殊情况,我们必须实施自定义FlowHandler
。handleException()
。
类似的东西:
public class CustomFlowHandler extends AbstractFlowHandler
{
@Override
public String handleException(FlowException e, HttpServletRequest request,
HttpServletResponse response)
{
if (e instanceof FlowExecutionRestorationFailureException)
{
if (e.getCause() instanceof SnapshotNotFoundException)
{
// TODO return the desired location string. See javadoc for options
return "serverRelative:/missingSnapshot.html";
}
}
return super.handleException(e, request, response);
}
}
在Spring配置文件中:
<!-- custom flow handler -->
<bean name="your-flow-name" class="yourpackage.CustomFlowHandler"/>