Including Vaadin in an Apache Camel Application


We have a application that is built using the apache camel framework. The application contains a few monitoring and management html pages that are built as standard camel router using camels jetty and velocity endpoints.

The routes look something like this

from( "jetty://http:")
.process( ----)
.to( "velocity:montoringPage.vm");

This little bit of camel magic will

  • start a embedded jetty server on port 8080
  • send any requests for monitoringPage.html through the code
    process( …)
    , which I have not shown to keep the example simple .Typically this would do stuff like put the current state of the application onto a velocity context map.
  • Use the velocity template monitoringPage.vm to render the application state as html
  • Stream the response back to the browser

Although this works very well for simple pages, our application has grown to a point where we are having to provide pages that include interactive tree structures. The normal approach at this point would be to start hacking together javascript and end up with the normal client side code mess.

I have dabbled with Vaardin and ZK in the past and see this as an opportunity to introduce these techniques to my team.

Now my question: has anyone got any ideas on how to integrate Vaadin with Camel?

I have been think in the following lines

  • Set up a jetty route that send all request to a method on a bean
  • Use the bean to wrap vaardin.
  • Send the output of the bean method back to the browser.

but I suspect that it will not work as this approach effectively removed any servlets out of the equation.

Another approach would be start up an embedded jetty server without using camel and then use the singleton pattern to connect my Vaardin code to the camel routes…