本文整理汇总了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);
}
}
示例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();
}