Java 类org.apache.catalina.startup.Constants 实例源码

项目:dhus-core    文件:TomcatServer.java   
private URL getWebappConfigFileFromDirectory (File docBase, String url)
{
   URL result = null;
   File webAppContextXml =
      new File (docBase, Constants.ApplicationContextXml);
   if (webAppContextXml.exists ())
   {
      try
      {
         result = webAppContextXml.toURI ().toURL ();
      }
      catch (MalformedURLException e)
      {
         LOGGER.warn("Unable to determine web application context.xml " + docBase, e);
      }
   }
   return result;
}
项目:DataHubSystem    文件:TomcatServer.java   
private URL getWebappConfigFileFromDirectory (File docBase, String url)
{
   URL result = null;
   File webAppContextXml =
      new File (docBase, Constants.ApplicationContextXml);
   if (webAppContextXml.exists ())
   {
      try
      {
         result = webAppContextXml.toURI ().toURL ();
      }
      catch (MalformedURLException e)
      {
         LOGGER.warn("Unable to determine web application context.xml " + docBase, e);
      }
   }
   return result;
}
项目:tomee    文件:TomcatWebAppBuilder.java   
@Override
public void configureStart(final LifecycleEvent event, final StandardContext standardContext) {
    final ContextTransaction contextTransaction = new ContextTransaction();
    contextTransaction.setProperty(org.apache.naming.factory.Constants.FACTORY, UserTransactionFactory.class.getName());
    standardContext.getNamingResources().setTransaction(contextTransaction);

    if (event != null) {
        // ensure NamingContext is available for eager usage (@Observes @Initialized(ApplicationScoped) for instance)
        standardContext.getNamingContextListener().lifecycleEvent(event);
    }

    TomcatHelper.configureJarScanner(standardContext);

    startInternal(standardContext);

    // clear a bit log for default case
    addMyFacesDefaultParameters(standardContext.getLoader().getClassLoader(), standardContext.getServletContext());

    // breaks cdi
    standardContext.setTldValidation(Boolean.parseBoolean(SystemInstance.get().getProperty("tomee.tld.validation", "false")));
    // breaks jstl
    standardContext.setXmlValidation(Boolean.parseBoolean(SystemInstance.get().getProperty("tomee.xml.validation", "false")));
}
项目:lams    文件:ValidatorTask.java   
/**
 * Execute the specified command.  This logic only performs the common
 * attribute validation required by all subclasses; it does not perform
 * any functional logic directly.
 *
 * @exception BuildException if a validation error occurs
 */
public void execute() throws BuildException {

    if (path == null) {
        throw new BuildException("Must specify 'path'");
    }

    File file = new File(path, Constants.ApplicationWebXml);
    if ((!file.exists()) || (!file.canRead())) {
        throw new BuildException("Cannot find web.xml");
    }

    // Commons-logging likes having the context classloader set
    ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
    Thread.currentThread().setContextClassLoader
        (ValidatorTask.class.getClassLoader());

    Digester digester = DigesterFactory.newDigester(true, true, null);
    try {
        file = file.getCanonicalFile();
        InputStream stream = 
            new BufferedInputStream(new FileInputStream(file));
        InputSource is = new InputSource(file.toURL().toExternalForm());
        is.setByteStream(stream);
        digester.parse(is);
        handleOutput("web.xml validated");
    } catch (Throwable t) {
        if (isFailOnError()) {
            throw new BuildException("Validation failure", t);
        } else {
            handleErrorOutput("Validation failure: " + t);
        }
    } finally {
        Thread.currentThread().setContextClassLoader(oldCL);
        closeRedirector();
    }

}
项目:WBSAirback    文件:ValidatorTask.java   
/**
 * Execute the specified command.  This logic only performs the common
 * attribute validation required by all subclasses; it does not perform
 * any functional logic directly.
 *
 * @exception BuildException if a validation error occurs
 */
@Override
public void execute() throws BuildException {

    if (path == null) {
        throw new BuildException("Must specify 'path'");
    }

    File file = new File(path, Constants.ApplicationWebXml);
    if ((!file.exists()) || (!file.canRead())) {
        throw new BuildException("Cannot find web.xml");
    }

    // Commons-logging likes having the context classloader set
    ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
    Thread.currentThread().setContextClassLoader
        (ValidatorTask.class.getClassLoader());

    Digester digester = DigesterFactory.newDigester(true, true, null);
    try {
        file = file.getCanonicalFile();
        InputStream stream = 
            new BufferedInputStream(new FileInputStream(file));
        InputSource is =
            new InputSource(file.toURI().toURL().toExternalForm());
        is.setByteStream(stream);
        digester.parse(is);
        handleOutput("web.xml validated");
    } catch (Exception e) {
        if (isFailOnError()) {
            throw new BuildException("Validation failure", e);
        } else {
            handleErrorOutput("Validation failure: " + e);
        }
    } finally {
        Thread.currentThread().setContextClassLoader(oldCL);
        closeRedirector();
    }

}
项目:armeria    文件:TomcatUtil.java   
static String noDefaultWebXmlPath() {
    return Constants.NoDefaultWebXml;
}
项目:class-guard    文件:ValidatorTask.java   
/**
 * Execute the specified command.  This logic only performs the common
 * attribute validation required by all subclasses; it does not perform
 * any functional logic directly.
 *
 * @exception BuildException if a validation error occurs
 */
@Override
public void execute() throws BuildException {

    if (path == null) {
        throw new BuildException("Must specify 'path'");
    }

    File file = new File(path, Constants.ApplicationWebXml);
    if ((!file.exists()) || (!file.canRead())) {
        throw new BuildException("Cannot find web.xml");
    }

    // Commons-logging likes having the context classloader set
    ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
    Thread.currentThread().setContextClassLoader
        (ValidatorTask.class.getClassLoader());

    // Called through trusted manager interface. If running under a
    // SecurityManager assume that untrusted applications may be deployed.
    Digester digester = DigesterFactory.newDigester(
            true, true, null, Globals.IS_SECURITY_ENABLED);
    try {
        file = file.getCanonicalFile();
        InputStream stream = 
            new BufferedInputStream(new FileInputStream(file));
        InputSource is =
            new InputSource(file.toURI().toURL().toExternalForm());
        is.setByteStream(stream);
        digester.parse(is);
        handleOutput("web.xml validated");
    } catch (Exception e) {
        if (isFailOnError()) {
            throw new BuildException("Validation failure", e);
        } else {
            handleErrorOutput("Validation failure: " + e);
        }
    } finally {
        Thread.currentThread().setContextClassLoader(oldCL);
        closeRedirector();
    }

}
项目:apache-tomcat-7.0.57    文件:ValidatorTask.java   
/**
 * Execute the specified command.  This logic only performs the common
 * attribute validation required by all subclasses; it does not perform
 * any functional logic directly.
 *
 * @exception BuildException if a validation error occurs
 */
@Override
public void execute() throws BuildException {

    if (path == null) {
        throw new BuildException("Must specify 'path'");
    }

    File file = new File(path, Constants.ApplicationWebXml);
    if ((!file.exists()) || (!file.canRead())) {
        throw new BuildException("Cannot find web.xml");
    }

    // Commons-logging likes having the context classloader set
    ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
    Thread.currentThread().setContextClassLoader
        (ValidatorTask.class.getClassLoader());

    // Called through trusted manager interface. If running under a
    // SecurityManager assume that untrusted applications may be deployed.
    Digester digester = DigesterFactory.newDigester(
            true, true, null, Globals.IS_SECURITY_ENABLED);
    try {
        file = file.getCanonicalFile();
        InputStream stream = 
            new BufferedInputStream(new FileInputStream(file));
        InputSource is =
            new InputSource(file.toURI().toURL().toExternalForm());
        is.setByteStream(stream);
        digester.parse(is);
        handleOutput("web.xml validated");
    } catch (Exception e) {
        if (isFailOnError()) {
            throw new BuildException("Validation failure", e);
        } else {
            handleErrorOutput("Validation failure: " + e);
        }
    } finally {
        Thread.currentThread().setContextClassLoader(oldCL);
        closeRedirector();
    }

}
项目:apache-tomcat-7.0.57    文件:ValidatorTask.java   
/**
 * Execute the specified command.  This logic only performs the common
 * attribute validation required by all subclasses; it does not perform
 * any functional logic directly.
 *
 * @exception BuildException if a validation error occurs
 */
@Override
public void execute() throws BuildException {

    if (path == null) {
        throw new BuildException("Must specify 'path'");
    }

    File file = new File(path, Constants.ApplicationWebXml);
    if ((!file.exists()) || (!file.canRead())) {
        throw new BuildException("Cannot find web.xml");
    }

    // Commons-logging likes having the context classloader set
    ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
    Thread.currentThread().setContextClassLoader
        (ValidatorTask.class.getClassLoader());

    // Called through trusted manager interface. If running under a
    // SecurityManager assume that untrusted applications may be deployed.
    Digester digester = DigesterFactory.newDigester(
            true, true, null, Globals.IS_SECURITY_ENABLED);
    try {
        file = file.getCanonicalFile();
        InputStream stream = 
            new BufferedInputStream(new FileInputStream(file));
        InputSource is =
            new InputSource(file.toURI().toURL().toExternalForm());
        is.setByteStream(stream);
        digester.parse(is);
        handleOutput("web.xml validated");
    } catch (Exception e) {
        if (isFailOnError()) {
            throw new BuildException("Validation failure", e);
        } else {
            handleErrorOutput("Validation failure: " + e);
        }
    } finally {
        Thread.currentThread().setContextClassLoader(oldCL);
        closeRedirector();
    }

}