Proxy with getUIClass and UIProvider problem

Im trying to load one GUI with normal browser and one with Mobile. I followed the follwing hint:

https://vaadin.com/wiki/-/wiki/Main/Creating+an+application+with+different+features+for+different+clients

But it does not call my ProxyUI class. The Notifications are not displayed in ProxUI.java,
so it seems the class VaadinUI.java is called directly (because the same UI is called in both desktop and mobile and it works). My code:


ProxyUI.java

public class ProxyUI extends UIProvider {
@Override
public Class<? extends UI> getUIClass(UIClassSelectionEvent event) {
if(event.getRequest().getHeader(“user-agent”).contains(“mobile”)) {
Notification.show(“This solution is for mobile”);
return VaadinUI.class;
} else {
// TODO Not yet implemented
Notification.show(“This solution is for desktop”);
return WebUI.class;
}
}
}


web.xml


resteasy

org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap


Resteasy
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher


Resteasy
/*


resteasy.scan
true


resteasy.servlet.mapping.prefix
/


30


myapp
com.vaadin.server.VaadinServlet

facmulta
UIProvider
ch.oneict.facmulta.ui.ProxyUI



WebUI.java

public class WebUI extends UI {

@Override
protected void init(VaadinRequest request) {
    setContent(new Label("Normal desktop browser is not supported"));
}

}


VaadinUI.java

@Theme(“touchkit”)
@SuppressWarnings(“serial”)
public class VaadinUI extends UI {

private String loggedInUser;

@WebServlet(urlPatterns = {"/app/*", "/VAADIN/*"}, asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = VaadinUI.class, widgetset = "ch.oneict.facmulta.ui.AppWidgetSet")
public static class Servlet extends TouchKitServlet {
}

@Override
protected void init(VaadinRequest request) {

Any help most appreciated… Thanks!

Hi,

You have your servlet introduced in both web.xml and with servlet 3 style. In web.xml you don’t map the servlet at all and in servlet 3 style introduction (probably the one that is used by server), you are not defining the UIProvider. Use either of them, not both.

cheers,
matti