Theme inside portlet

I’m using vaadin to develop a portlet and I would like to create a custom theme. The problem is that if I put the theme inside the portlet project it doesn’t see the theme.
In particular the structure of my portlet is:

MyPortlet
-…
-WebContet
-WEB-INF
-META-INF
-VAADIN
-themes
-mytheme
-style.css

And in the init method I use the method setTheme(“mytheme”);

In other words I would like to avoid to put the theme inside the folder LIFERAY_HOME/tomcat-6.0.29/webapps/ROOT/html/VAADIN/themes.

I think the only way to serve Vaadin themes in Liferay, is to put them in the LIFERAY_HOME/tomcat-6.0.29/webapps/ROOT/html/VAADIN/themes folder.

An old thread, but for information if others stumble on this:

Vaadin themes should be loadable with the normal static resource mechanism, which in Vaadin Portlet 2.0 portlets means in practice that they should be in the shared theme folder. Getting around this is tricky portlet internal published directories with a static URL cannot be created with pure JSR-286 (Portlet 2.0) APIs.

However, if you have a servlet defined for your portlet (in web.xml - it might even be added there automatically by Liferay at deployment time, I cannot recall), you can use additional CSS etc. the Liferay way, with the CSS in a “css” directory and a header-css line for your portlet in your liferay-portlet.xml - look for more information on that in Liferay documentation or on the Liferay forum. Such CSS does not act like a Vaadin theme but it can contain rules that complement or extend Vaadin themes - you could even put all your theme rules in it and omit the setTheme() statement to use the portal default theme as a basis.

So there is no way to embed a theme within a Vaadin portlet ?

As I wrote above, when using Portlet 2.0, not as a Vaadin theme served by the portlet.

You can, however, have the theme served by a servlet in the same WAR as the portlet. The easiest way is not to serve it as a Vaadin theme but like a Liferay portlet theme (see above).

You might also be able to disable AbstractApplicationPortlet defaulting to the portal-level static resource directory and serve a Vaadin theme from the WAR, but I don’t have an example of doing so and it might require more changes in the portlet class as many of the related methods are private. For this, you would need to get a fixed URL for the servlet from the portal, which might or might not require using portal-specific APIs or approaches.

Note that this could also lead to widgetset or theme conflicts if on the same page you have multiple portlets using different themes and widgetsets.

Vaadin 7 should at least improve the internal APIs of AbstractApplicationPortlet and AbstractApplicationServlet.

an other solution would be the one described here: http://liferaylive.blogspot.ro/p/integration-of-vaadin-theme-into_11.html