static logout page

Hi,

how could I refer to the static page? I added a button as a method to my layout:

    private Component buildLogoutButton() {
        Button closeButton = new Button("Logout");

        closeButton.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                getUI().getSession().close();
                getUI().getPage().setLocation("/webapp/logout.html");

            }
        });

        closeButton.setPrimaryStyleName("valo-menu-item");
        closeButton.setIcon(FontAwesome.POWER_OFF);

        return closeButton;
    }

I wrote a simple html page and put into my folder /src/main/webapp/logout.html

but Im getting an error in my browser when I clicked on the button :frowning:

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.Wed Aug 16 11:37:07 CEST 2017
There was an unexpected error (type=Not Found, status=404).
No message available

Hi Tomasz,
you should predend the current contextPath to your html page path.
Assuming you are using maven to package yuor app as a war the page
src/main/webapp/logout.html
will be accessible through the url
//logout.html
.

To redirect to that page in your Vaadin 7.x app you should use

getUI().getPage().setLocation(VaadinService.getCurrentRequest().getContextPath() + "/logout.html")

If you are using Vaadin 8.x you can use

Page.getCurrent().setLocation(VaadinRequest.getCurrent().getContextPath() + "/logout.html");

HTH
Marco