Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

What happened to Root in 7.0.0.beta1 ?

Archie Cobbs
1 decade ago Sep 14, 2012 7:51pm
Roland Krüger
1 decade ago Sep 14, 2012 8:22pm
Archie Cobbs
1 decade ago Sep 14, 2012 8:32pm
Roland Krüger
1 decade ago Sep 14, 2012 8:49pm
Archie Cobbs
1 decade ago Sep 14, 2012 9:52pm
Joonas Lehtinen
1 decade ago Sep 15, 2012 7:17am
Jouni Koivuviita
1 decade ago Sep 15, 2012 7:18am
Joonas Lehtinen
1 decade ago Sep 15, 2012 7:53am

Here is an example on how to use UIProviders:

Deploy with your own custom servlet

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
    <display-name>Vaadin Web Application</display-name>
    <context-param>
        <description>Vaadin production mode</description>
        <param-name>productionMode</param-name>
        <param-value>false</param-value>
    </context-param>
    <servlet>
        <servlet-name>Vaadin</servlet-name>
        <servlet-class>t.t.MyServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>Vaadin</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
</web-app>

The servlet then chooses the UI

public class MyServlet extends VaadinServlet {
	protected void onVaadinSessionStarted(WrappedHttpServletRequest request,
			VaadinServletSession session) throws ServletException {
		session.addUIProvider(new AbstractUIProvider() {
			public Class<? extends UI> getUIClass(WrappedRequest request) {
				String path = request.getRequestPathInfo();
				if (path != null) {
					if (path.startsWith("/ui1"))
						return UI1.class;
					if (path.startsWith("/ui2"))
						return UI2.class;
				}
				return null; // No default UI set
			}
		});
		super.onVaadinSessionStarted(request, session);
	}
}

Couple of notes here. In almost all cases it would be better to use new high level views with Navigator instead of multiple UI:s. Multiple UI:s would be preferred over views when you want to have completely different UI for the same system - for example serving a mobile ui user agent is determined to be a smartphone.

Jens Jansson
1 decade ago Sep 15, 2012 8:03am
This wiki article

also shows the same thing Joonas presented.

The tutorials in the wiki is the best place to find what has changed and how to do them. Check them out

There is also a draft version of the Vaadin 7 Book of Vaadin but it is not really up to date yet regarding the changes in Beta 1.

Archie Cobbs
1 decade ago Sep 16, 2012 3:18pm
Jens Jansson
1 decade ago Sep 16, 2012 5:47pm
Archie Cobbs
1 decade ago Sep 24, 2012 4:59pm
Leif Åstrand
1 decade ago Sep 24, 2012 6:42pm
Archie Cobbs
1 decade ago Sep 24, 2012 7:06pm
Mark Thomas
1 decade ago Sep 24, 2012 9:09pm
Leif Åstrand
1 decade ago Sep 25, 2012 7:05am
Archie Cobbs
1 decade ago Sep 25, 2012 2:33pm
Artur Signell
1 decade ago Sep 25, 2012 3:52pm
Archie Cobbs
1 decade ago Sep 25, 2012 5:28pm