Search code examples
vaadinvaadin8spark-javavaadin10

How can I use Vaadin with SparkJava


I have implemented an API that is REST based using SparkJava (http://sparkjava.com). Its a standalone app and works great.

Now I'd like to implement part of that functionality access through a Vaadin UI. I'm quite new to Vaadin as well.

Does anyone know how I can still keep the single VM model, and able to use Vaadin's wonderful UI structures with greatness of SparkJava?

Is there someway that I can bind the Vaadin Servlet to the SparkJava Route perhaps?? Just thinking loud here.

Appreciate your help very much!!

I assume this is possible because I saw its used with Jetty (Vaadin 10/11 and embedded Jetty)


Solution

  • sure that is possible! You can simply make Jetty expose both SparkJava filter, and Vaadin 10+ servlet. I've created an example application which builds on Alejandro's work: https://github.com/mvysny/embedded-jetty-demo