~~NOTRANS~~
==== CORS ====
All details about [[http://en.wikipedia.org/wiki/Cross-origin_resource_sharing|cross-origin resource sharing]].
==== Use-Case ====
Embedding a Vaadin application in your CMS (e.g., Joomla, Typo3). The CMS runs in an hosted environment without Java application server (standard and cheap web hosting).
==== How To ====
There's an excellent [[https://vaadin.com/blog/-/blogs/using-cors-with-vaadin|blog post from Vaadin]]. We have a ready-to-use solution added to our Vaadin UI.
It's really simple to use. Add the following parameter to your web.xml:
cors.originhttp://www.hosteddomain.compushmodeautomatictrue
(be sure that async-support was enabled for all vaadin servlets/filters)
The ''cors.origin'' parameter can be a comma separated list.
Here's an example html file:
Embedded Vaadin application
And the rest of our web.xml:
EmbeddedUIcom.sibvisions.rad.ui.vaadin.server.VaadinServletUIcom.sibvisions.rad.ui.vaadin.impl.VaadinUIwidgetsetcom.sibvisions.rad.ui.vaadin.ext.ui.Widgetsetmaincom.sibvisions.apps.MyEmbeddedApplicationLauncher.uifactorycom.sibvisions.rad.ui.vaadin.impl.VaadinFactorypushmodeautomatictrueEmbeddedUI/*
The application was configured for ROOT context of Tomcat(8).
If you have a different context, simply change the URLs: browserDetailsUrl, serviceUrl and vaadinDir (see above html page).
\\
**Information**
There's a problem in Vaadin with push mechanism: https://dev.vaadin.com/ticket/14477
A workaround for Tomcat8, via web.xml:
org.atmosphere.container.JSR356AsyncSupport.mappingPath/app/web/ui
Set the parameter for the servlet, which is used multiple times, e.g.:
VaadinUI/VAADIN/*VaadinUI/app/web/ui/*