public void doStart() {
    try {
      TaskLog.logWithTimestamp("Starting web application " + this.getDescriptor());
      if (jettyEnvXml != null && jettyEnvXml.exists())
        envConfiguration.setJettyEnvXml(Resource.toURL(jettyEnvXml));

      ClassLoader parentLoader = this.getClass().getClassLoader();
      if (parentLoader instanceof AntClassLoader)
        parentLoader = new AntURLClassLoader((AntClassLoader) parentLoader);

      setClassLoader(new WebAppClassLoader(parentLoader, this));
      if (attributes != null && attributes.getAttributes() != null) {
        for (Attribute a : attributes.getAttributes()) setAttribute(a.getName(), a.getValue());
      }

      // apply a context xml file if one was supplied
      if (contextXml != null) {
        XmlConfiguration xmlConfiguration = new XmlConfiguration(Resource.toURL(contextXml));
        TaskLog.log("Applying context xml file " + contextXml);
        xmlConfiguration.configure(this);
      }

      super.doStart();
    } catch (Exception e) {
      TaskLog.log(e.toString());
    }
  }
Esempio n. 2
0
  public void doStart() throws Exception {
    setConfigurations(configs);

    // Initialize map containing all jars in /WEB-INF/lib
    webInfJarMap.clear();
    for (File file : webInfJars) {
      // Return all jar files from class path
      String fileName = file.getName();
      if (fileName.endsWith(".jar")) webInfJarMap.put(fileName, file);
    }

    if (this.jettyEnvXml != null) envConfig.setJettyEnvXml(new File(this.jettyEnvXml).toURL());
    setShutdown(false);
    super.doStart();
  }
  public void doStart() throws Exception {
    // Set up the pattern that tells us where the jars are that need scanning for
    // stuff like taglibs so we can tell jasper about it (see TagLibConfiguration)

    // Allow user to set up pattern for names of jars from the container classpath
    // that will be scanned - note that by default NO jars are scanned
    String tmp = _containerIncludeJarPattern;
    if (tmp == null || "".equals(tmp))
      tmp = (String) getAttribute(WebInfConfiguration.CONTAINER_JAR_PATTERN);

    tmp = addPattern(tmp, DEFAULT_CONTAINER_INCLUDE_JAR_PATTERN);
    setAttribute(WebInfConfiguration.CONTAINER_JAR_PATTERN, tmp);

    // Allow user to set up pattern of jar names from WEB-INF that will be scanned.
    // Note that by default ALL jars considered to be in WEB-INF will be scanned - setting
    // a pattern restricts scanning
    if (_webInfIncludeJarPattern != null)
      setAttribute(WebInfConfiguration.WEBINF_JAR_PATTERN, _webInfIncludeJarPattern);

    // Set up the classes dirs that comprises the equivalent of WEB-INF/classes
    if (_testClasses != null) _webInfClasses.add(_testClasses);
    if (_classes != null) _webInfClasses.add(_classes);

    // Set up the classpath
    _classpathFiles = new ArrayList<File>();
    _classpathFiles.addAll(_webInfClasses);
    _classpathFiles.addAll(_webInfJars);

    // Initialize map containing all jars in /WEB-INF/lib
    _webInfJarMap.clear();
    for (File file : _webInfJars) {
      // Return all jar files from class path
      String fileName = file.getName();
      if (fileName.endsWith(".jar")) _webInfJarMap.put(fileName, file);
    }

    if (this._jettyEnvXml != null)
      _envConfig.setJettyEnvXml(Resource.toURL(new File(this._jettyEnvXml)));

    // CHECK setShutdown(false);
    super.doStart();
  }
  public void doStart() throws Exception {
    // Set up the pattern that tells us where the jars are that need scanning for
    // stuff like taglibs so we can tell jasper about it (see TagLibConfiguration)
    String tmp =
        (String) getAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern");

    tmp = addPattern(tmp, ".*/.*jsp-api-[^/]*\\.jar$");
    tmp = addPattern(tmp, ".*/.*jsp-[^/]*\\.jar$");
    tmp = addPattern(tmp, ".*/.*taglibs[^/]*\\.jar$");
    tmp = addPattern(tmp, ".*/.*jstl[^/]*\\.jar$");
    tmp = addPattern(tmp, ".*/.*jsf-impl-[^/]*\\.jar$"); // add in 2 most popular jsf impls
    tmp = addPattern(tmp, ".*/.*javax.faces-[^/]*\\.jar$");
    tmp = addPattern(tmp, ".*/.*myfaces-impl-[^/]*\\.jar$");

    setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern", tmp);

    // Set up the classes dirs that comprises the equivalent of WEB-INF/classes
    if (testClasses != null) webInfClasses.add(testClasses);
    if (classes != null) webInfClasses.add(classes);

    // Set up the classpath
    classpathFiles = new ArrayList<File>();
    classpathFiles.addAll(webInfClasses);
    classpathFiles.addAll(webInfJars);

    // Initialize map containing all jars in /WEB-INF/lib
    webInfJarMap.clear();
    for (File file : webInfJars) {
      // Return all jar files from class path
      String fileName = file.getName();
      if (fileName.endsWith(".jar")) webInfJarMap.put(fileName, file);
    }

    if (this.jettyEnvXml != null)
      envConfig.setJettyEnvXml(Resource.toURL(new File(this.jettyEnvXml)));

    // setShutdown(false);
    super.doStart();
  }