本文整理汇总了Java中org.apache.catalina.startup.Constants类的典型用法代码示例。如果您正苦于以下问题:Java Constants类的具体用法?Java Constants怎么用?Java Constants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Constants类属于org.apache.catalina.startup包,在下文中一共展示了Constants类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getWebappConfigFileFromDirectory
import org.apache.catalina.startup.Constants; //导入依赖的package包/类
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;
}
示例2: configureStart
import org.apache.catalina.startup.Constants; //导入依赖的package包/类
@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")));
}
示例3: execute
import org.apache.catalina.startup.Constants; //导入依赖的package包/类
/**
* 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();
}
}
示例4: execute
import org.apache.catalina.startup.Constants; //导入依赖的package包/类
/**
* 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();
}
}
示例5: noDefaultWebXmlPath
import org.apache.catalina.startup.Constants; //导入依赖的package包/类
static String noDefaultWebXmlPath() {
return Constants.NoDefaultWebXml;
}
示例6: execute
import org.apache.catalina.startup.Constants; //导入依赖的package包/类
/**
* 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();
}
}