當前位置: 首頁>>代碼示例>>Java>>正文


Java WebAppContext.getUnavailableException方法代碼示例

本文整理匯總了Java中org.eclipse.jetty.webapp.WebAppContext.getUnavailableException方法的典型用法代碼示例。如果您正苦於以下問題:Java WebAppContext.getUnavailableException方法的具體用法?Java WebAppContext.getUnavailableException怎麽用?Java WebAppContext.getUnavailableException使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jetty.webapp.WebAppContext的用法示例。


在下文中一共展示了WebAppContext.getUnavailableException方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: start

import org.eclipse.jetty.webapp.WebAppContext; //導入方法依賴的package包/類
public void start() {
    try {
        // start the server
        server.start();

        // ensure everything started successfully
        for (Handler handler : server.getChildHandlers()) {
            // see if the handler is a web app
            if (handler instanceof WebAppContext) {
                WebAppContext context = (WebAppContext) handler;

                // see if this webapp had any exceptions that would
                // cause it to be unavailable
                if (context.getUnavailableException() != null) {
                    startUpFailure(context.getUnavailableException());
                }
            }
        }

        dumpUrls();
    } catch (final Throwable t) {
        startUpFailure(t);
    }
}
 
開發者ID:apache,項目名稱:nifi-registry,代碼行數:25,代碼來源:JettyServer.java

示例2: main

import org.eclipse.jetty.webapp.WebAppContext; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
    C2Properties properties = C2Properties.getInstance();

    final HandlerCollection handlers = new HandlerCollection();
    for (Path path : Files.list(Paths.get(C2_SERVER_HOME, "webapps")).collect(Collectors.toList())) {
         handlers.addHandler(loadWar(path.toFile(), "/c2", JettyServer.class.getClassLoader()));
    }

    Server server;
    int port = Integer.parseInt(properties.getProperty("minifi.c2.server.port", "10080"));
    if (properties.isSecure()) {
        SslContextFactory sslContextFactory = properties.getSslContextFactory();
        HttpConfiguration config = new HttpConfiguration();
        config.setSecureScheme("https");
        config.setSecurePort(port);
        config.addCustomizer(new SecureRequestCustomizer());

        server = new Server();

        ServerConnector serverConnector = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, "http/1.1"), new HttpConnectionFactory(config));
        serverConnector.setPort(port);

        server.addConnector(serverConnector);
    } else {
        server = new Server(port);
    }

    server.setHandler(handlers);
    server.start();

    // ensure everything started successfully
    for (Handler handler : server.getChildHandlers()) {
        // see if the handler is a web app
        if (handler instanceof WebAppContext) {
            WebAppContext context = (WebAppContext) handler;

            // see if this webapp had any exceptions that would
            // cause it to be unavailable
            if (context.getUnavailableException() != null) {

                System.err.println("Failed to start web server: " + context.getUnavailableException().getMessage());
                System.err.println("Shutting down...");
                logger.warn("Failed to start web server... shutting down.", context.getUnavailableException());
                server.stop();
                System.exit(1);
            }
        }
    }

    server.dumpStdErr();
    server.join();
}
 
開發者ID:apache,項目名稱:nifi-minifi,代碼行數:53,代碼來源:JettyServer.java


注:本文中的org.eclipse.jetty.webapp.WebAppContext.getUnavailableException方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。