Vaadin UI.getcurrent returns null in the request handler

Why the method UI.getCurrentin vaadin returns null, but getUI()actualy returns UIin the same case. For instance:

    @Override
    public boolean handleRequest(VaadinSession session,VaadinRequest request, VaadinResponse        response)
                throws IOException {

            UI.getCurrent(); //returns null
            getUI(); //works

            return false;
        }

I am trying to make a login page with a custom layout (to save autocomplete), as vaadin suppressed LoginForm.

+4
source share
1 answer

The difference between the two methods or methods of obtaining the user interface is indicated in the book of Vaadin.

https://vaadin.com/book/-/page/advanced.global.html

Vaadin : getUI() UI.getCurrent().

getUI() :

data = ((MyUI)component.getUI()).getUserData();

, , , , . , , , .

, :

data = ((MyUI) UI.getCurrent()).getUserData();
+2

All Articles