当前位置: 首页>>代码示例>>Java>>正文


Java VaadinServlet类代码示例

本文整理汇总了Java中com.vaadin.server.VaadinServlet的典型用法代码示例。如果您正苦于以下问题:Java VaadinServlet类的具体用法?Java VaadinServlet怎么用?Java VaadinServlet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


VaadinServlet类属于com.vaadin.server包,在下文中一共展示了VaadinServlet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import com.vaadin.server.VaadinServlet; //导入依赖的package包/类
public static void main(String[] args) {
    int port = Configuration.INSTANCE.getInt("port", 8080);
    Server server = new Server(port);
    ServletContextHandler contextHandler
            = new ServletContextHandler(ServletContextHandler.SESSIONS);
    contextHandler.setContextPath("/");
    ServletHolder sh = new ServletHolder(new VaadinServlet());
    contextHandler.addServlet(sh, "/*");
    contextHandler.setInitParameter("ui", AnalysisUI.class.getCanonicalName());
    contextHandler.setInitParameter("productionMode", String.valueOf(PRODUCTION_MODE));
    server.setHandler(contextHandler);
    try {
        server.start();
        server.join();
    } catch (Exception e) {
        LOG.error("Failed to start application", e);
    }
}
 
开发者ID:tokenmill,项目名称:crawling-framework,代码行数:19,代码来源:Application.java

示例2: main

import com.vaadin.server.VaadinServlet; //导入依赖的package包/类
public static void main(String[] args) {
    int port = Configuration.INSTANCE.getInt("port", 8080);
    Server server = new Server(port);
    ServletContextHandler contextHandler
            = new ServletContextHandler(ServletContextHandler.SESSIONS);
    contextHandler.setContextPath("/");
    ServletHolder sh = new ServletHolder(new VaadinServlet());
    contextHandler.addServlet(sh, "/*");
    contextHandler.setInitParameter("ui", CrawlerAdminUI.class.getCanonicalName());
    contextHandler.setInitParameter("productionMode", String.valueOf(PRODUCTION_MODE));
    server.setHandler(contextHandler);
    try {
        server.start();
        server.join();
    } catch (Exception e) {
        LOG.error("Failed to start application", e);
    }
}
 
开发者ID:tokenmill,项目名称:crawling-framework,代码行数:19,代码来源:Application.java

示例3: main

import com.vaadin.server.VaadinServlet; //导入依赖的package包/类
/**
 * The main entry point, use configuration as follows:
 * <pre>
 *     tamaya.server.contextPath: the context path, default=/tamaya
 *     tamaya.server.port: the port, default=8090
 *     tamaya.server.productionMode: vadiin production mode setting, default=false.
 * </pre>
 * @param args the args
 * @throws Exception if startup fails.
 */
public static void main(String[] args) throws Exception {
    Configuration config = ConfigurationProvider.getConfiguration();
    String contextPath = config.getOrDefault("tamaya.server.contextPath", "/tamaya");
    String appBase = ".";
    Tomcat tomcat = new Tomcat();
    tomcat.setPort(Integer.valueOf(config.getOrDefault("tamaya.server.port", Integer.class, 8090) ));

    // Define a web application context.
    Context context = tomcat.addWebapp(contextPath, new File(
            appBase).getAbsolutePath());
    // Add Vadiin servlet
    Wrapper wrapper = tomcat.addServlet(context, "vadiin-servlet",
            VaadinServlet.class.getName());
    wrapper.addInitParameter("ui",
            TamayaUI.class.getName());
    wrapper.addInitParameter("productionMode",config.getOrDefault("tamaya.server.productionMode", String.class,
            "false"));
    wrapper.addInitParameter("asyncSupported", "true");
    context.addServletMapping("/*", "vadiin-servlet");
    // bootstrap.addBundle(new AssetsBundle("/VAADIN", "/VAADIN", null, "vaadin"));
    tomcat.start();
    tomcat.getServer().await();
}
 
开发者ID:apache,项目名称:incubator-tamaya-sandbox,代码行数:34,代码来源:TamayaUI.java

示例4: start

import com.vaadin.server.VaadinServlet; //导入依赖的package包/类
@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");
}
 
开发者ID:sensiasoft,项目名称:sensorhub,代码行数:17,代码来源:AdminUIModule.java

示例5: createAceEditor

import com.vaadin.server.VaadinServlet; //导入依赖的package包/类
public static AceEditor createAceEditor() {
    AceEditor editor = new AceEditor();
    editor.setSizeFull();
    ServletContext context = VaadinServlet.getCurrent().getServletContext();
    if (context.getRealPath("/VAADIN/ace") != null) {
        String acePath = context.getContextPath() + "/VAADIN/ace";
        editor.setThemePath(acePath);
        editor.setModePath(acePath);
        editor.setWorkerPath(acePath);
    } else {
        log.warn("Could not find a local version of the ace editor.  " + "You might want to consider installing the ace web artifacts at "
                + context.getRealPath(""));
    }
    editor.setHighlightActiveLine(true);
    editor.setShowPrintMargin(false);
    return editor;
}
 
开发者ID:JumpMind,项目名称:sqlexplorer-vaadin,代码行数:18,代码来源:CommonUiUtils.java

示例6: getStubResourceBaseDir

import com.vaadin.server.VaadinServlet; //导入依赖的package包/类
/**
 * Returns path to directory where the stub should store it files.
 * 
 * @return path to the base-directory of stub-resources
 */
protected String getStubResourceBaseDir() {
	
	String pathToRes = VaadinServlet.getCurrent().getServletContext()
			.getInitParameter(STUB_RES_PATH_PARAM);
			
	if (pathToRes == null || pathToRes.equals("")) {
		pathToRes = VaadinServlet.getCurrent().getServletContext()
				.getRealPath("/VILLE/stub");
		// likely deployed as war, use temp-location
		if (pathToRes == null) {
			logger.warning("Placing VILLE-stub-resources-directory under temp");
			pathToRes = System.getProperty("java.io.tmpdir") + "/VILLE/stub";
		}
	}
	
	logger.info("Used VILLE-stub resource path: " + pathToRes);
	
	return pathToRes;
}
 
开发者ID:villeteam,项目名称:vexer,代码行数:25,代码来源:VilleExerStubUI.java

示例7: getLocalesToTest

import com.vaadin.server.VaadinServlet; //导入依赖的package包/类
/**
 * Return a list of Locales that will be available in the testing UI.
 * 
 * @return {@link List} of {@link Locale}s
 */
protected List<Locale> getLocalesToTest() {
	
	String localesStr = VaadinServlet.getCurrent().getServletContext()
			.getInitParameter(LOCALES_TO_TEST_PARAM);
			
	List<Locale> res = new ArrayList<Locale>();
	if (localesStr != null && !localesStr.equals("")) {
		String[] locales = localesStr.split(";");
		for (String aLocal : locales) {
			if (aLocal.contains("_")) {
				String[] langCountry = aLocal.split("_");
				res.add(new Locale(langCountry[0], langCountry[1]));
			} else {
				res.add(new Locale(aLocal));
			}
		}
	} else {
		
		res.add(Locale.ENGLISH);
	}
	return res;
}
 
开发者ID:villeteam,项目名称:vexer,代码行数:28,代码来源:VilleExerStubUI.java

示例8: requestClose

import com.vaadin.server.VaadinServlet; //导入依赖的package包/类
/**
 * Do on test closing
 * 
 * @param event
 */
public void requestClose(@Observes final CloseTestEvent event) {
	log.debug("close requested");
	if (requestBack) {
		log.debug("closing ProcessUI with history back");
		JavaScript javaScript = ui.getPage().getJavaScript();
		javaScript.execute("window.history.back();");
		ui.requestClose();

	} else {
		String path = VaadinServlet.getCurrent().getServletContext().getContextPath();
		ui.getPage().setLocation(path + CLOSE_URL);
		// this is also possible way but not for SWT browser
		// Page.getCurrent().getJavaScript().execute("window.setTimeout(function(){/*window.open('','_self','');*/window.close();},10);")

		log.debug("closing ProcessUI");
		ui.requestClose();
	}
}
 
开发者ID:tilioteo,项目名称:hypothesis,代码行数:24,代码来源:ProcessUIPresenter.java

示例9: TestSpringVaadinServletService

import com.vaadin.server.VaadinServlet; //导入依赖的package包/类
public TestSpringVaadinServletService(VaadinServlet servlet, WebApplicationContext applicationContext)
		throws ServiceException {
	super(servlet, new DefaultDeploymentConfiguration(TestSpringVaadinServletService.class, new Properties()),
			"");
	this.appContext = applicationContext;
	init();
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:8,代码来源:AbstractVaadinSpringTest.java

示例10: vaadinServlet

import com.vaadin.server.VaadinServlet; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public VaadinServlet vaadinServlet() {
	HolonVaadinServlet servlet = new HolonVaadinServlet();
	configureServlet(servlet);

	LOGGER.debug(() -> "HolonVaadinServlet configured");

	return servlet;
}
 
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:11,代码来源:HolonVaadinServletAutoConfiguration.java

示例11: start

import com.vaadin.server.VaadinServlet; //导入依赖的package包/类
@Validate
private void start() {
    bootstrapVaadinServlet = new VaadinServlet();
    try {
        webContainer.registerServlet(bootstrapVaadinServlet, new String[]{"/VAADIN/*"}, null, null);
    }
    catch (ServletException ex) {
        logger.error("Exception registering boostrapVaadinServlet!", ex);
    }
    logger.info("VaadinManager started, Registered boostrapVaadinServlet!");

    EventAdminHelper.postEvent(VaadinEventTopics.MANAGER_STARTED);
}
 
开发者ID:andyphillips404,项目名称:awplab-core,代码行数:14,代码来源:VaadinManagerProvider.java

示例12: registerProvider

import com.vaadin.server.VaadinServlet; //导入依赖的package包/类
@Override
public void registerProvider(VaadinProvider vaadinProvider) throws ServletException, InvalidVaadinProvider {
    if (vaadinProvider.getPath() == null || !vaadinProvider.getPath().startsWith("/") || vaadinProvider.getPath().endsWith("/")) {
        throw new InvalidVaadinProvider("Invalid path, path must not be null, start with a / and end with no /");
    }

    //if (!(vaadinProvider instanceof VaadinServlet)) {
    //    throw new InvalidVaadinProvider("Vaading provider must extend vaadin servlet");
    //}
    if (providers.contains(vaadinProvider)) throw new InvalidVaadinProvider("VaadinProvider already registerd");

    VaadinServlet vaadinServlet = new BaseVaadinServlet(vaadinProvider);

    Dictionary<String, Object> initParams = new Hashtable<String, Object>();
    initParams.put("productionMode", vaadinProvider.productionMode() ? "true" : "false");
    vaadinProvider.heartbeatInterval().ifPresent(integer -> {initParams.put("heartbeatInterval", Integer.toString(integer)); });
    vaadinProvider.closeIdleSessions().ifPresent(close -> {initParams.put("closeIdleSessions", close ? "true" : "false"); });
    vaadinProvider.pushMode().ifPresent(pushMode -> {initParams.put("pushmode", pushMode.toString().toLowerCase());});
    //initParams.put("UIProvider", new VaadinUIProvider(vaadinProvider, vaadinServlet));

    webContainer.registerServlet(vaadinServlet, new String[] { vaadinProvider.getPath() + "/*"}, initParams, 0, true, (vaadinProvider instanceof BasicAuthRequired ? new BasicAuthHttpContext(webContainer.getDefaultSharedHttpContext(), (BasicAuthRequired)vaadinProvider) : webContainer.getDefaultSharedHttpContext()));

    servlets.put(vaadinProvider, vaadinServlet);

    EventAdminHelper.postEvent(VaadinEventTopics.PROVIDER_ADDED, VaadinEventData.VAADIN_PROVIDER, vaadinProvider);


}
 
开发者ID:andyphillips404,项目名称:awplab-core,代码行数:29,代码来源:VaadinManagerProvider.java

示例13: compileTheme

import com.vaadin.server.VaadinServlet; //导入依赖的package包/类
private void compileTheme() {
    try {
        binder.commit();
        ServletContext context = VaadinServlet.getCurrent().getServletContext();
        String fullPath = context.getRealPath("/VAADIN/themes/dashboard");
        String customScssFileName = fullPath + "/custom.scss";
        SassCompiler.writeFile(customScssFileName, module.getModel());

        ProcessBuilder processBuilder = new ProcessBuilder("java", "-cp", "../../../WEB-INF/lib/*", "com.vaadin.sass.SassCompiler", "styles.scss", "styles.css");
        processBuilder.directory(new File(fullPath));
        File error = new File(fullPath, "custom.scss.log");
        processBuilder.redirectErrorStream(true);
        processBuilder.redirectError(Redirect.PIPE);
        Process process = processBuilder.start();
        process.waitFor();

        BufferedReader reader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
        StringBuilder builder = new StringBuilder();
        String line = reader.readLine();
        while (line != null) {
            builder.append(line);
            line = reader.readLine();
        }
        reader.close();
        if (!builder.toString().trim().isEmpty()) {
            throw new Exception(builder.toString());
        }

    } catch (Exception ex) {
        logger.log(Level.SEVERE, ex.getMessage(), ex);
        Notification.show("Error", ex.getMessage(), Notification.Type.ERROR_MESSAGE);
    }
}
 
开发者ID:hybridbpm,项目名称:hybridbpm,代码行数:34,代码来源:FormEditor.java

示例14: startUndertow

import com.vaadin.server.VaadinServlet; //导入依赖的package包/类
private static void startUndertow() throws ServletException {
    ServletInfo servletInfo = new ServletInfo(VaadinServlet.class.getName(), VaadinServlet.class)
            .setAsyncSupported(true)
            .setLoadOnStartup(1)
            .addInitParam("ui", "com.hybridbpm.ui.HybridbpmUI").addInitParam("widgetset", "com.hybridbpm.ui.HybridbpmWidgetSet")
            .addMapping("/*").addMapping("/VAADIN");

    DeploymentInfo deploymentInfo = deployment()
            .setClassLoader(HybridbpmServer.class.getClassLoader())
            .setContextPath(PATH)
            .setDeploymentName("hybridbpm.war")
            .setDisplayName("HYBRIDBPM")
            .setResourceManager(new ClassPathResourceManager(HybridbpmServer.class.getClassLoader()))
            .addServlets(servletInfo)
            .addServletContextAttribute(WebSocketDeploymentInfo.ATTRIBUTE_NAME, new WebSocketDeploymentInfo());

    DeploymentManager manager = defaultContainer().addDeployment(deploymentInfo);
    manager.deploy();

    PathHandler path = Handlers.path(Handlers.redirect(PATH)).addPrefixPath(PATH, manager.start());

    Undertow.Builder builder = Undertow.builder().addHttpListener(8080, "0.0.0.0").setHandler(path);

    undertow = builder.build();
    undertow.start();
    logger.info("HybridbpmServer UI started");
}
 
开发者ID:hybridbpm,项目名称:hybridbpm,代码行数:28,代码来源:HybridbpmServer.java

示例15: getWebApplicationContext

import com.vaadin.server.VaadinServlet; //导入依赖的package包/类
public static WebApplicationContext getWebApplicationContext() {
    VaadinServlet servlet = VaadinServlet.getCurrent();
    if (servlet != null) {
    return WebApplicationContextUtils
            .getRequiredWebApplicationContext(servlet.getServletContext());
    } else {
        return null;
    }
}
 
开发者ID:JumpMind,项目名称:metl,代码行数:10,代码来源:AppUI.java


注:本文中的com.vaadin.server.VaadinServlet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。