當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。