Download Component Reference - Red Hat Customer Portal
Transcript
Chapter 28. FTP2
public boolean accept(GenericFile file) {
// we only want report files
return file.getFileName().startsWith("report");
}
}
And then we can configure our route using the filter attribute to reference our filter (using # notation) that we
have defined in the spring XML file:
<!-- define our sorter as a plain spring bean -->
<bean id="myFilter" class="com.mycompany.MyFileFilter"/>
<route>
<from uri="ftp://[email protected]?password=secret&filter=#myFilter"/>
<to uri="bean:processInbox"/>
</route>
Filtering using ANT path matcher
The ANT path matcher is a filter that is shipped out-of-the-box in the camel-spring jar. So you need to depend
6
on camel-spring if you are using Maven. The reason is that we leverage Spring's AntPathMatcher to do the
actual matching.
The file paths are matched with the following rules:
• ? matches one character
• * matches zero or more characters
• ** matches zero or more directories in a path
The sample below demonstrates how to use it:
<camelContext xmlns="http://camel.apache.org/schema/spring">
<template id="camelTemplate"/>
<!-- use myFilter as filter to allow setting ANT paths for which files to scan for -->
<endpoint id="myFTPEndpoint" uri="ftp://admin@localhost:20123/antpath?password=admin&ecurs
ive=true&elay=10000&nitialDelay=2000&ilter=#myAntFilter"/>
<route>
<from ref="myFTPEndpoint"/>
<to uri="mock:result"/>
</route>
6
http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/util/AntPathMatcher.html
174
Fuse Mediation Router Component Reference Version 2.6
Related documents
JavaBIP User Manual - RiSD
Table of Contents
Network technologies for Java-enabled, mobile devices
Flexible authentication for stateless web services
User Manual Modem Logger
Workflow Patterns - Information Systems
Manutenzione
14 CB1100-3LMGC6100.book
rapport de recherche
JBoss WS CXF User Guide - for use with JBoss
Questo manuale deve essere considerato parte integrante