我想使用选择流控制,当名为#[function:dateStamp:dd-MM-yyyy] .xml的文件存在时,将选择一个路由,当此文件不存在时,将选择其他路由.
是否可以写'何时'选择部分来检查文件是否存在?
您可以使用MEL:
<configuration>
<expression-language>
<import class="java.text.SimpleDateFormat" />
<global-functions><![CDATA[
def xmlFileExists() {
filePath = '/tmp/' + new SimpleDateFormat('dd-MM-yyyy').format(new Date()) + '.xml';
new File(filePath).isFile();
}
]]></global-functions>
</expression-language>
</configuration>
...
<choice>
<when expression="#[xmlFileExists()]">
...
</when>
<otherwise>
...
</otherwise>
</choice>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3906 次 |
| 最近记录: |