在MobileMail,运行mvn package 打包,然后运行mvn jetty:run
用firefox浏览器打开,报如下错误:
Ooops...
You accessed this demo with a browser that is currently not supported by TouchKit. TouchKit is ment to be used with modern webkit based mobile browsers, e.g. with iPhone. Curretly those cover huge majority of actively used mobile browsers. Support will be extended as other mobile browsers develop and gain popularity. Testing ought to work with desktop Safari or Chrome as well.
原因是touchkit不支持 非mobile device,最根本原因是需要实现webkit的浏览器。
看手册原文描述为:
The browser support in TouchKit concentrates on WebKit which appears to be emerging as the leading mobile browser core. In addition to Apple's products, also the default browser in Android uses WebKit as the layout engine.Yet there are differences, as the Android's JavaScript engine, which is highly relevant for Vaadin, is the Google Chrome's V8 engine.
大概意思是:TouchKit目前只支持webkit的浏览器,比如苹果或者安卓用webkit作为渲染引擎的产品,这两者是有区别的,安卓是js引起。Vaadin强烈推荐使用google chrome V8引擎。这样屏幕可以自动适应。
需要解决的问题是:
当浏览器是非webkit的时候,自动选择非Touchkit的窗口模式,否则就是mobile device的模式,mobile模式又包括smartphone 和 tablet。
浏览器内核引擎的介绍文章参考:
http://www.iteye.com/news/3498-why-mozilla-has-to-defend-core-gecko
面向不同browser device解决办法: 只需要在web.xml文件中进行配置:
Vaadin Web Application Vaadin production mode productionMode false Vaadin Application Servlet com.vaadin.addon.touchkit.server.TouchKitApplicationServlet Vaadin application class to start application com.vaadin.demo.mobilemail.MobileMailApplication widgetset com.vaadin.demo.mobilemail.gwt.MobileMailWidgetSet Vaadin fallback application class to start fallbackApplication com.vaadin.demo.mobilemail.FallbackApplication Application widgetset fallbackWidgetset com.vaadin.terminal.gwt.DefaultWidgetSet Vaadin Application Servlet /* manifest text/cache-manifest
注意,将非webkit内核浏览器的application 配置到fallbackApplication的配置中。
Vaadin fallback application class to start fallbackApplication com.vaadin.demo.mobilemail.FallbackApplication Application widgetset fallbackWidgetset com.vaadin.terminal.gwt.DefaultWidgetSet