Example usage for com.vaadin.server VaadinServletService init

List of usage examples for com.vaadin.server VaadinServletService init

Introduction

In this page you can find the example usage for com.vaadin.server VaadinServletService init.

Prototype

public void init() throws ServiceException 

Source Link

Document

Initializes this service.

Usage

From source file:com.antonjohansson.lprs.ServiceServlet.java

License:Apache License

@Override
protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration)
        throws ServiceException {
    VaadinServletService service = new VaadinServletService(this, deploymentConfiguration) {
        @Override/*from   w w w  .ja v a2s.  c o m*/
        public void requestStart(VaadinRequest request, VaadinResponse response) {
            String remoteAddress = request.getRemoteAddr();
            MDC.put(MDC_REMOTE_ADDRESS, remoteAddress);
            super.requestStart(request, response);
        }

        @Override
        public void requestEnd(VaadinRequest request, VaadinResponse response, VaadinSession session) {
            super.requestEnd(request, response, session);
            MDC.remove(MDC_REMOTE_ADDRESS);
        }
    };
    service.init();
    return service;
}

From source file:fr.amapj.view.engine.ui.AmapJServlet.java

License:Open Source License

@Override
protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration)
        throws ServiceException {
    VaadinServletService servletService = new AmapJServletService(this, deploymentConfiguration);
    servletService.init();
    return servletService;
}

From source file:info.magnolia.ui.admincentral.AdmincentralVaadinServlet.java

License:Open Source License

@Override
protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration)
        throws ServiceException {
    VaadinServletService service = new VaadinServletService(this, deploymentConfiguration) {

        @Override/*from  ww w  . ja v  a  2 s .c  o  m*/
        protected List<RequestHandler> createRequestHandlers() throws ServiceException {
            List<RequestHandler> handlers = super.createRequestHandlers();
            for (int i = 0; i < handlers.size(); i++) {
                RequestHandler handler = handlers.get(i);
                if (handler instanceof ServletBootstrapHandler) {
                    handlers.set(i, new ServletBootstrapHandler() {

                        @Override
                        protected String getServiceUrl(BootstrapContext context) {

                            // We replace the default ServletBootstrapHandler with our own so that we can specify
                            // the serviceUrl explicitly. It's otherwise left empty making the client determine it
                            // using location.href. The client does not play well with this and appends paths after
                            // the JSESSIONID instead of in front of it. This results in a problem loading resources
                            // specified using @JavaScript and @StyleSheet.
                            //
                            // see com.vaadin.client.ApplicationConfiguration.loadFromDOM()
                            // see MGNLUI-2291
                            // see http://dev.vaadin.com/ticket/10974

                            return ServletUtil.getOriginalRequestURI(
                                    ((VaadinServletRequest) context.getRequest()).getHttpServletRequest());
                        }
                    });
                    break;
                }
            }
            return handlers;
        }
    };
    service.init();
    return service;
}

From source file:ru.osgisnips.vaadin.SimpleVaadinServlet.java

License:Apache License

@Override
protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration)
        throws ServiceException {

    VaadinServletService service = new VaadinServletService(this, deploymentConfiguration) {
        @Override/*  w w  w.j  av a2 s. c  om*/
        public ClassLoader getClassLoader() {
            return getClass().getClassLoader();
        }
    };
    // init() needed in 7.1, invalid in 7.0
    service.init();
    return service;
}