com.vaadin.server.VaadinServlet Java Examples
The following examples show how to use
com.vaadin.server.VaadinServlet.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VertxVaadinService.java From vertx-vaadin with MIT License | 6 votes |
@Override public InputStream getThemeResourceAsStream(UI uI, String themeName, String resource) { String filename = VaadinServlet.THEME_DIR_PATH + '/' + themeName + "/" + resource; String normalized = Paths.get(filename).normalize().toString(); if (!normalized.startsWith("VAADIN/") || normalized.contains("/../")) { throw new VertxException(String.format( "Requested resource [%s] not accessible in the VAADIN directory or access to it is forbidden.", filename)); } FileSystem fileSystem = getVertx().fileSystem(); if (fileSystem.existsBlocking(filename)) { return new ByteArrayInputStream(fileSystem.readFileBlocking(filename).getBytes()); } return null; }
Example #2
Source File: AdminUIModule.java From sensorhub with Mozilla Public License 2.0 | 6 votes |
@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"); }
Example #3
Source File: VertxBootstrapHandler.java From vertx-vaadin with MIT License | 5 votes |
@Override public String getThemeName(BootstrapContext context) { String themeName = context.getRequest() .getParameter(VaadinServlet.URL_PARAMETER_THEME); if (themeName == null) { themeName = super.getThemeName(context); } return themeName; }
Example #4
Source File: VaadinVerticleWidgetsetUT.java From vertx-vaadin with MIT License | 5 votes |
@Test public void shouldIgnoreDefaultWidgetsetFromVaadinServletConfiguration(TestContext context) { WithoutDefaultWidgetSet verticle = new WithoutDefaultWidgetSet(); rule.vertx().deployVerticle(verticle, context.asyncAssertSuccess(event -> { assertThat(verticle.config.containsKey(VaadinServlet.PARAMETER_WIDGETSET)).isFalse(); })); }
Example #5
Source File: VaadinVerticleWidgetsetUT.java From vertx-vaadin with MIT License | 5 votes |
@Test public void shouldUseWidgetsetFromVaadinServletConfiguration(TestContext context) { WithDefaultWidgetSet verticle = new WithDefaultWidgetSet(); rule.vertx().deployVerticle(verticle, context.asyncAssertSuccess(event -> { assertThat(verticle.config.containsKey(VaadinServlet.PARAMETER_WIDGETSET)).isTrue(); assertThat(verticle.config.getString(VaadinServlet.PARAMETER_WIDGETSET)).isEqualTo(TEST_WIDGETSET); })); }
Example #6
Source File: AsyncVaadinServletConfiguration.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
@Bean public VaadinServlet vaadinServlet(final LocalizedSystemMessagesProvider localizedSystemMessagesProvider) { return new SpringVaadinServlet() { @Override public void servletInitialized() throws ServletException { super.servletInitialized(); getService().setSystemMessagesProvider(localizedSystemMessagesProvider); } }; }
Example #7
Source File: AddressbookExampleUIEx.java From vaadinator with Apache License 2.0 | 5 votes |
@Override protected void init(VaadinRequest request) { // for mobile, set yet another theme if (VaadinServlet.getCurrent() instanceof TouchKitServlet) { setTheme("touchkitexex"); } super.init(request); }
Example #8
Source File: VertxVaadinService.java From vertx-vaadin with MIT License | 4 votes |
@Override public String getConfiguredWidgetset(VaadinRequest request) { return getDeploymentConfiguration().getWidgetset(VaadinServlet.DEFAULT_WIDGETSET); }