Example usage for com.vaadin.server VaadinServlet VaadinServlet

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

Introduction

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

Prototype

VaadinServlet

Source Link

Usage

From source file:com.afonsohmm.vaadinjettysample.JLauncher.java

public static Server startServer(int port) throws Exception {

    Server server = new Server();

    final Connector connector = new SelectChannelConnector();

    connector.setPort(port);/* w ww  .j  a v  a 2  s.c  o  m*/
    server.setConnectors(new Connector[] { connector });

    WebAppContext context = new WebAppContext();
    VaadinServlet vaadinServlet = new VaadinServlet() {
    };

    ServletHolder servletHolder = new ServletHolder(vaadinServlet);
    servletHolder.setInitParameter("ui", MyVaadinUI.class.getName());

    context.setWar(System.getProperty("user.dir"));
    context.setContextPath("/");

    context.addServlet(servletHolder, "/*");
    server.setHandler(context);
    server.start();
    return server;
}

From source file:org.gluewine.vaadin.GluewineVaadinUI.java

License:Apache License

/**
 * Initializes the VaadinServlet and registers it with the Jetty instance.
 */// ww w  .ja  va 2  s .c  o  m
@RunOnActivate
public void intialize() {
    VaadinServlet servlet = new VaadinServlet();
    Map<String, String> params = new HashMap<String, String>();
    params.put(VaadinSession.UI_PARAMETER, getUnEnhancedClassName());
    Enumeration<?> keys = props.propertyNames();
    while (keys.hasMoreElements()) {
        String key = (String) keys.nextElement();
        params.put(key, props.getProperty(key));
    }
    launcher.register(context, servlet, params);
}

From source file:org.sensorhub.ui.AdminUIModule.java

License:Mozilla Public License

@Override
public void start() throws SensorHubException {
    // reset java util logging config so we don't get annoying atmosphere logs
    LogManager.getLogManager().reset();//.getLogger("org.atmosphere").setLevel(Level.OFF);

    vaadinServlet = new VaadinServlet();
    Map<String, String> initParams = new HashMap<String, String>();
    initParams.put(SERVLET_PARAM_UI_CLASS, AdminUI.class.getCanonicalName());
    initParams.put(SERVLET_PARAM_MODULE_ID, getLocalID());
    if (config.widgetSet != null)
        initParams.put(WIDGETSET, config.widgetSet);
    initParams.put("productionMode", "true"); // set to false to compile theme on-the-fly       
    HttpServer.getInstance().deployServlet(vaadinServlet, initParams, "/admin/*", "/VAADIN/*");
    HttpServer.getInstance().addServletSecurity("/admin/*", "admin");
}

From source file:org.vaadin.spring.boot.config.StaticContentVaadinServletConfiguration.java

License:Apache License

@Override
protected HttpServlet createServlet() {
    return new VaadinServlet();
}