Ejemplo n.º 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);
    }
  }
Ejemplo n.º 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);
   }
 }
Ejemplo n.º 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;
  }
Ejemplo n.º 4
0
 public void stop() throws Exception {
   server.stop();
 }