コード例 #1
0
  /**
   * Starts the web application. The web application root directory will be define in
   * target/jawr-integration-test, the directory used for the war generation.
   *
   * @throws Exception if an exception occurs
   */
  public void startWebApplication() throws Exception {

    // Create a new class loader to take in account the changes of the jawr
    // config file in the WEB-INF/classes
    WebAppClassLoader webAppClassLoader = new WebAppClassLoader(jettyWebAppContext);
    jettyWebAppContext.setClassLoader(webAppClassLoader);
    // Fix issue with web app context reloading on Windows where deleting temporary directory fails
    // because of locked files
    jettyWebAppContext.setPersistTempDirectory(true);

    if (server.isStopped()) {
      LOGGER.info("Start jetty server....");
      server.start();
    }
    if (jettyWebAppContext.isStopped()) {
      LOGGER.info("Start jetty webApp context....");
      jettyWebAppContext.start();
    }
  }