Access launcher and application before application starts

Information about development with Vaadin UI.

Access launcher and application before application starts

Postby Development@SIB » Sat Feb 07, 2015 1:06 am

Sometimes, it's important to configure the application or to set custom properties into the launcher, before the application starts. This could be useful if external authentication systems will be used, e.g. via SpringSecurity or different Authentication Filters.

It's still possible to use special authenticators for your application, but sometimes this mechanism is too late because the Http Filter handles authentication.

Usually you would extend the standard VaadinUI implementation to do some tweaks, but not everything is possible because you can't do anything between launcher creation and application instantiation.

If you need early access to launcher and application, you could use the IVaadinUIPhaseController. It's a simple interface that defines a phaseChanged method. This method will be called at specific states of VaadinUI.

You can use it to get access to the launcher directly after its creation or to access the application instance before it will be visible.

Simply, add an init-parameter to your web.xml:
Syntax: [ Download ] [ Hide ]
(if you run a portlet, use the parameter name: vaadinui.phaseController)

The parameter defines your implementation of IVaadinUIPhaseController, e.g.
Syntax: [ Download ] [ Hide ]
public class CustomUIPhaseController implements IVaadinUIPhaseController
    public void phaseChanged(UIPhaseEvent pEvent)
        switch (pEvent.getPhase())
            case UIPhaseEvent.PHASE_CONFIGURE_LAUNCHER:
                System.out.println("Configure Launcher via UI phase controller");
                //not handled


The PHASE_CONFIGURE_LAUNCHER phase will be fired, directly after launcher creation and before application instantiation. The PHASE_CONFIGURE_APPLICATION will be fired after the application instance was created. The PHASE_BEFORE_NOTIFYVISIBLE will be fired before the notifyVisible method of the application will be invoked.
User avatar
Posts: 310
Joined: Mon Sep 28, 2009 1:54 pm

Return to Documentation