16.3. 例子

相对路径名称

考虑文件消费者端点,其中起始目录指定为 相对路径名称。例如,以下 File 端点具有起始目录 ./filelanguage

file://filelanguage

现在,在扫描 filelanguage 目录时,假设端点只消耗以下文件:

./filelanguage/test/hello.txt

最后,假设 filelanguage 目录本身有以下绝对位置:

/workspace/camel/camel-core/target/filelanguage

根据前面的场景,文件语言变量在应用到当前交换时返回以下值:

表达式结果

file:name

test/hello.txt

file:name.ext

txt

file:name.noext

test/hello

file:onlyname

hello.txt

file:onlyname.noext

hello

file:ext

txt

file:parent

filelanguage/test

file:path

filelanguage/test/hello.txt

file:absolute

false

file:absolute.path

/workspace/camel/camel-core/target/filelanguage/test/hello.txt

绝对路径名

考虑文件消费者端点,其中起始目录指定为 绝对路径名。例如,以下 File 端点具有起始目录 /workspace/camel/camel-core/target/filelanguage

file:///workspace/camel/camel-core/target/filelanguage

现在,在扫描 filelanguage 目录时,假设端点只消耗以下文件:

./filelanguage/test/hello.txt

根据前面的场景,文件语言变量在应用到当前交换时返回以下值:

表达式结果

file:name

test/hello.txt

file:name.ext

txt

file:name.noext

test/hello

file:onlyname

hello.txt

file:onlyname.noext

hello

file:ext

txt

file:parent

/workspace/camel/camel-core/target/filelanguage/test

file:path

/workspace/camel/camel-core/target/filelanguage/test/hello.txt

file:absolute

true

file:absolute.path

/workspace/camel/camel-core/target/filelanguage/test/hello.txt