Vaadin XS - multiple vaadin applications in web.xml?

Hi,
Is it possible to create multiple vaadin application inside a project?
My current web.xml looks like following:

<servlet>
		<servlet-name>First Servlet</servlet-name>
		<servlet-class>com.vaadin.addons.xs.server.XSApplicationServlet</servlet-class>

		<init-param>
			<param-name>application</param-name>
			<param-value>de.vlad.FirstApplication</param-value>
		</init-param>
		<init-param>
			<param-name>widgetset</param-name>
			<param-value>de.vlad.MyWidgetset</param-value>
		</init-param>

	</servlet>

<servlet>
		<servlet-name>Second Servlet</servlet-name>
		<servlet-class>com.vaadin.addons.xs.server.XSApplicationServlet</servlet-class>

		<init-param>
			<param-name>application</param-name>
			<param-value>de.vlad.SecondApplication</param-value>
		</init-param>
		<init-param>
			<param-name>widgetset</param-name>
			<param-value>de.vlad.MyWidgetset</param-value>
		</init-param>

	</servlet>


	<servlet-mapping>
		<servlet-name>First Servlet</servlet-name>
		<url-pattern>/first/*</url-pattern>
	</servlet-mapping>

	<servlet-mapping>
		<servlet-name>Second Servlet</servlet-name>
		<url-pattern>/second/*</url-pattern>
	</servlet-mapping>
	
	<servlet-mapping>
		<servlet-name>Second Servlet</servlet-name>
		<url-pattern>/*</url-pattern>
	</servlet-mapping>

With this config I can only access to the second servlet over the embedding feature of XS.
If I write

<script src="http://localhost:9090/projectname/first/getEmbedJs" type="text/javascript"></script>

The vaadin application does not load and shows the error “Widgetset could not be loaded”.
If I launch my app directly over the browser with the url “http://localhost:9090/projectname/first/
everything works fine. Am I doing something wrong? Or there is not support for multiple apps with XS?

kind regards

Vlad

Hi,

Based on the message the url to widgetset that the “getEmbedJs” set is invalid. I think it makes assumption that the VAADIN directory can always be found next to the actual application. You could investigate if there is something that could be improved on that area and fill an enchantment ticket to dev.vaadin.com.

In the mean time I think you could just copy paste the script it (it == the servlet from “getEmbedJs” address) produces and manually fix urls so that the widget set can be properly loaded. If you are afraid of the complex js it generates, you could also manually write the proper “vaadin kickstart”. This gives you rather simple and maintainable kickstart code, but full control of resource urls etc. Below are couple of examples you could use see page source.
demo.vaadin.com/multiapp.html (official manual startup example for non XS Vaadin app)
http://dl.dropbox.com/u/4041822/vembed/index2.html (a prototype example of Vaadin XS, the app server won’t respond, but usage with Vaadin XS should be similar)

I hope this helps!

cheers,
matti