Touchkit and normal app in 1 war?


I’ve read the Touchkit documentation and now I’m asking myself if it’s possible to have something like a
that will start the right application class (normal or Touchkit) depending on the browser beeing used?

This would make my life much easier and I have only one application that i need to deploy.




War files can contain multiple servlets. So you could for example host desktop app in */main and mobile version in */mobile. Servlet spec is the only limit here.

Then there is of course the question, which one to host by default. TouchKit contains “fallback application feature” that can be help with that struggle. It simply forwards all non-webkit browsers (which are not supported by TouchKitWidgetSet), to a fallback application that you define in the web.xml. You can then use that to directly show the “desktop version” or to forward browsers to the desired url. To detect webkit based desktop browsers (which you might also want to forward to your desktop app), you can use isTouchDevice() method in WebBrowser in the initialization of your TouchKit application.

Check out the
TouchKit tutorial
to get used to the fallback application concept.


Hi Matti,

I think I will go with the two-application-in-one-war approach. So i.e. I want to have my desktop app at
and my mobile app at
. Since I’m not an expert regarding servlet configuration, I ask you, if you could help me get started. I’m using NetBeans as IDE together with Tomcat. So far, my web.xml has one entry for my application and the servlet mapping is

    <servlet-name>my main app</servlet-name>

I read in the Vaadin book that I also need another mapping if I’m not using the default:

    <servlet-name>my main app</servlet-name>

This works fine as long as I don’t change the url-pattern
. I tried as url-pattern
but then I couldn’t access my app any more. The url
didn’t worked either.

Thanks in advance


You need to use /m/* url-pattern to have /app/m. My understanding is that the Servlet JSR allows mapping sub-paths to different servlets, so you can map /* and /m/* for the servlets. However, if you have any static content, you can’t use the /* as then all requests to the content would be mapped to that.

Thank you Marko. Now I can acces my app under /app/m.

Best regards