Problem with @PushStateNaviagtion & CDI

Hello,

I am currently trying to implement @PushStateNavigation and have a problem with it. The application is deployed under its own context path on my WildFly application server. When I now navigate to a view, the context path is removed and only the path of the view remains.

As an example, I call the application under:
http://localhost:8080/Manager-1.0-SNAPSHOT/

As soon as the navigator notices that I am not logged in, I will be redirected to the LoginView:
http://localhost:8080/login

However, the path should be as follows:
http://localhost:8080/Manager-1.0-SNAPSHOT/login

I configured the UI with the annotation @CDIUI (“”) (without servlet). The view has the annotation @CDIView (value = “login”).

The navigator is created as follows:

    Navigator navigator = new Navigator(this, viewLayout.getContent()) {
        private static final long serialVersionUID = 1837510418715700018L;

        @Override
        public void navigateTo(String navigationState) {
            try {
                // Redirect not authorized users to login page
                if(userManager.isAuthenticated()) {
                    super.navigateTo(navigationState);
                } else {
                    super.navigateTo("login");
                }
            } catch (Exception ex) {
                handleNavigationError(navigationState, ex);
            }
        }
    };

What do I have to configure so that PushStateNavigation does not remove the context path? I’m currently using Vaadin version 8.3.0.

After further testing, I came to the conclusion that it doesn’t work with the current implementation. When a UI is annotated with @CDIUI(“”), the pathInfo is set to “/”. In the class “com.vaadin.ui.UI” causes the following line of code to remove not only the additional path information, but also the context path:

uiRootPath = uiRootPath.substring(0, uiRootPath.indexOf(uiPathInfo) + uiPathInfo.length());

/Manager-1.0-SNAPSHOT

will be translated to

/

If I annotate the UI with @CDIUI(“test”) then this function translates

/Manager-1.0-SNAPSHOT/test

to

/Manager-1.0-SNAPSHOT/test

and everything is working fine. But in this case my UI is not longer located in the root of the context path.

How you have defined the context path now? It looks like you have configured Manager-1.0-SNAPSHOT in it, but in a way push state navigation does not get it.

Yes, I think it is working exactly like that unless you override VaadinCDIServlet and define the context there with annotation.

Some one filed a ticket in GitHub related to this:
https://github.com/vaadin/framework/issues/10633