Beispiel #1
0
  protected void startServer() throws Exception {
    server = configureServer();
    server.start();

    Throwable exceptionAtServerStart = server.webAppContext().getUnavailableException();
    if (exceptionAtServerStart != null) {
      server.stop();
      LOG.error("ERROR: Failed to start Go server.", exceptionAtServerStart);
      throw new RuntimeException("Failed to start Go server.", exceptionAtServerStart);
    }
  }
Beispiel #2
0
 private void performCustomConfiguration(JettyServer server) throws Exception {
   File jettyConfig = systemEnvironment.getJettyConfigFile();
   if (jettyConfig.exists()) {
     LOG.info("Configuring Jetty using " + jettyConfig.getAbsolutePath());
     FileInputStream serverConfiguration = new FileInputStream(jettyConfig);
     XmlConfiguration configuration = new XmlConfiguration(serverConfiguration);
     configuration.configure(server.getServer());
   } else {
     String message =
         String.format(
             "No custom jetty configuration (%s) found, using defaults.",
             jettyConfig.getAbsolutePath());
     LOG.info(message);
   }
 }
Beispiel #3
0
  JettyServer configureServer() throws Exception {
    JettyServer server = createServer();

    server.getContainer().addEventListener(mbeans());

    server.addConnector(selectChannelConnector());
    server.addConnector(sslConnector());

    server.addHandler(welcomeFileHandler());
    server.addHandler(legacyRequestHandler());
    server.addWebAppHandler(webApp());

    performCustomConfiguration(server);

    server.setStopAtShutdown(true);
    return server;
  }
Beispiel #4
0
 public void stop() throws Exception {
   server.stop();
 }