SpringBootVaadin - Navigation to accessDeniedView fails

Hi all,

I have a basic UI with two views: one default view and one view (-class) set as accessDeniedView and a ViewAccessControl:er returning false to all requests. When I access ‘/’ I expect my access denied view to be displayed but that is not the case, instead I get an error telling me there is no view available for “”.
When debugging I can see that the accessController is invoked for both views, denying access to both (always returns false). Then the SpringViewProvider is invoked (getViewName) and reaches the point with the promising comment:
// check also disallowed views to support access denied view
It get’s the correct accessDeniedView-class, finds both my Views and enters getViewName with parameter viewAndParameters as empty string and my two views.
getViewName then tries to match the given empty String with the name of the Views: no match of course…
The SpringViewProvider then returns null to the Navigator and the dreaded “Trying to navigate to an unknown state” exception is thrown.

What am I doing wrong here? Even if I explicitly allow the AccessDeniewView in my AccessController it will still fail since the SpringViewProvider tries to find the view by name matching the currently requested view. Why isn’t getAccessDeniewView used in the SpringViewProvider instead of trying to find the view by name? If found ‘we’ could then return the name of that View to the Navigator and the Navigator would be happy. Could also be that I’m doing something completly wrong here :slight_smile:

I’m on vaadin-server 7.7.5 and vaadin-spring 1.1.1 (using spring-boot-starter)

br, Svante

Hi,
as stated in
docs
for non existing views the error view is show (SpringNavigator.setErrorView).
I think what you should either marking a view for “” state (@SpringView(name=“”)) or explicitly navigate to your main view in UI.init method.

HTH
Marco

Yes Marco, for some reason, at some point in time I decided to remove the ‘name’ attribute from the annotation at my default view, no idea why :slight_smile: Now it works as expected, thanks!