I have a program that listens to ftp address and whenever new file appears it takes it and converts to pojo. But I run it from main()
method. It's not very comfortable.
I would like to create a servlet that will do the same, but i will create war
file and put it into TomCat and the program will run itself, so i wouldn't have to run it.
I have created web.xml
with camel servlet and spring listener and don't know what my further steps should be.
Here's what I have now:
My class:
@Component
public class test extends SpringRouteBuilder {
@Override
public void configure() throws Exception {
from("ftp://Mike@localhost?noop=true&binary=true").to("file://data");
}
}
web.xml:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:camel-config.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
camel-config.xml
<context:component-scan base-package="org.apache.camel.spring.issues.contextscan"/>
<camelContext id="camel5" xmlns="http://camel.apache.org/schema/spring">
<routeBuilder ref="myBuilder" />
</camelContext>
<bean id="myBuilder" class="test"/>
UPD:
Now i see that my program connects to ftp, but it doesn't copy files.
I pasted log i'm getting http://pastebin.com/2tTf6QmL