Touchkit and normal app in 1 war?

Hi,

I’ve read the Touchkit documentation and now I’m asking myself if it’s possible to have something like a
browser-switch-application
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.

Regards

Andreas

Hi,

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.

cheers,
matti

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
/app
and my mobile app at
/app/m
. 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-mapping>
    <servlet-name>my main app</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>

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

  <servlet-mapping>
    <servlet-name>my main app</servlet-name>
    <url-pattern>/VAADIN/*</url-pattern>
  </servlet-mapping>

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

Thanks in advance

Andreas

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

Andreas