Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DiscoveryNavigator.setErrorView(MyView.class) does not handle error correctly #19

Open
AdrienC opened this issue Jul 1, 2013 · 0 comments

Comments

@AdrienC
Copy link

AdrienC commented Jul 1, 2013

Hi,
if I set my error view with setErrorView(MyView.class), when Navigator has to redirect to the error view, it creates a new instance of MyView.class instead of getting the autowired view as expected.

Here's my workaround:
navigator.setErrorProvider(new ViewProvider() {
private static final long serialVersionUID = 1L;

        @Override
        public String getViewName(String viewAndParameters) {
            return ErrorView.NAME;
        }

        @Override
        public View getView(String viewName) {
            String errorViewBeanName = SpringApplicationContext.getApplicationContext().getBeanNamesForType(ErrorView.class)[0];
            VaadinView vaadinView = (VaadinView) ErrorView.class.getAnnotation(VaadinView.class);
            return ( (DiscoveryNavigator) navigator ).getView(ErrorView.NAME, errorViewBeanName, vaadinView.cached());
        }
    });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant