Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Is it possible to have a global request handler, associated with a specifie

Josef Karthauser
6 years ago Nov 12, 2015 8:49pm
Josef Karthauser
6 years ago Nov 15, 2015 11:02pm

Ok, I've found out how. The RequestHandler needed to be bound globally so that it can handle the request immediately:

 

public static class Servlet extends VaadinServlet {
        @Override
        protected void service(HttpServletRequest request,
                HttpServletResponse response) throws ServletException, IOException {
            getService().addSessionInitListener(new SessionInitListener() {
                @Override
                public void sessionInit(SessionInitEvent event)
                        throws ServiceException {
                    event.getSession().addRequestHandler(googleEarthView.globalRequestHandler())
                }
            });
            super.service(request, response)
        }
    }