Peter490
(Peter Varsanyi)
April 4, 2017, 9:00am
1
Hi Guys,
How can I use Vaadin CDI UI (not view!) provider?
I have created my UI privder class:
public class AppUIProvider extends CDIUIProvider {
@Override
public Class<? extends UI> getUIClass(UIClassSelectionEvent event) {
if (event.getRequest().getHeader("user-agent").contains("Firefox")) {
return AppUI.class;
} else {
return OtherUI.class;
}
}
}
How can I register/add/use this class?
Nicklas2
(Nicklas Karlsson)
April 5, 2017, 6:32am
2
Peter490
(Peter Varsanyi)
April 5, 2017, 7:05am
3
Thanks Nicklas.
I have tried to annotate the my VaadinCDIServlet class with @WebInitParam :
@WebInitParam(description = "Vaadin UI Provider", name = "UIProvider", value = "com.myproject.fw.ui.AppUIProvider")
But it seems, doesn’t work. Nothing happend.
Nicklas2
(Nicklas Karlsson)
April 5, 2017, 7:34am
4
Hmm. If nothing else helps, you might have to look at the source and how it’s used, e.g.
https://github.com/vaadin/cdi/blob/master/vaadin-cdi/src/main/java/com/vaadin/cdi/CDIUIProvider.java
The CDI extension itself appeared to deal mostly with Views
The CDIUIProvider is probably not available as a managed bean so @Specialize :ing it will probably not work
Henri2
(Henri Sara)
July 20, 2017, 11:24am
5