Search in sources :

Example 1 with Attribute

use of org.eclipse.jetty.ant.types.Attribute in project jetty.project by eclipse.

the class AntWebAppContext method doStart.

/**
     * 
     */
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());
    }
}
Also used : Attribute(org.eclipse.jetty.ant.types.Attribute) AntClassLoader(org.apache.tools.ant.AntClassLoader) URLClassLoader(java.net.URLClassLoader) WebAppClassLoader(org.eclipse.jetty.webapp.WebAppClassLoader) AntClassLoader(org.apache.tools.ant.AntClassLoader) WebXmlConfiguration(org.eclipse.jetty.webapp.WebXmlConfiguration) XmlConfiguration(org.eclipse.jetty.xml.XmlConfiguration) JettyWebXmlConfiguration(org.eclipse.jetty.webapp.JettyWebXmlConfiguration) WebAppClassLoader(org.eclipse.jetty.webapp.WebAppClassLoader) IOException(java.io.IOException) BuildException(org.apache.tools.ant.BuildException)

Aggregations

IOException (java.io.IOException)1 URLClassLoader (java.net.URLClassLoader)1 AntClassLoader (org.apache.tools.ant.AntClassLoader)1 BuildException (org.apache.tools.ant.BuildException)1 Attribute (org.eclipse.jetty.ant.types.Attribute)1 JettyWebXmlConfiguration (org.eclipse.jetty.webapp.JettyWebXmlConfiguration)1 WebAppClassLoader (org.eclipse.jetty.webapp.WebAppClassLoader)1 WebXmlConfiguration (org.eclipse.jetty.webapp.WebXmlConfiguration)1 XmlConfiguration (org.eclipse.jetty.xml.XmlConfiguration)1