Example usage for com.vaadin.server VaadinServletService VaadinServletService

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

Introduction

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

Prototype

public VaadinServletService(VaadinServlet servlet, DeploymentConfiguration deploymentConfiguration)
            throws ServiceException 

Source Link

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/*  w  w w . jav  a 2  s  . c  om*/
        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: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  www.  j a v  a  2s.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/*from   w w w .j av a2s.c  o  m*/
        public ClassLoader getClassLoader() {
            return getClass().getClassLoader();
        }
    };
    // init() needed in 7.1, invalid in 7.0
    service.init();
    return service;
}