This shows you the differences between two versions of the page.

Link to this comparison view

vaadin:launch_control [2018/02/06 12:55] (current)
admin created
Line 1: Line 1:
 +~~Title: Access launcher and application before application starts~~
 +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:
 +<file xml>
 +  <​param-name>​phaseController</​param-name>​
 +  <​param-value>​com.sibvisions.apps.vaadin.CustomUIPhaseController</​param-value>​
 +//(if you run a portlet, use the parameter name: vaadinui.phaseController)//​
 +The parameter defines your implementation of IVaadinUIPhaseController,​ e.g.
 +<file java>
 +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"​);​
 +                ​
 +                System.out.println(((LauncherEvent)pEvent).getLauncher().
 +                                   ​getParameter(VaadinUI.PARAM_REQUESTURL));​
 +                break;
 +            default:
 +                //not handled
 +                break;
 +        }
 +    }
 +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.
This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information