This commit is contained in:
2024-11-30 19:03:49 +08:00
commit 1e6763c160
3806 changed files with 737676 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
BASIC=org.apache.catalina.authenticator.BasicAuthenticator
CLIENT-CERT=org.apache.catalina.authenticator.SSLAuthenticator
DIGEST=org.apache.catalina.authenticator.DigestAuthenticator
FORM=org.apache.catalina.authenticator.FormAuthenticator
NONE=org.apache.catalina.authenticator.NonLoginAuthenticator
SPNEGO=org.apache.catalina.authenticator.SpnegoAuthenticator

View File

@@ -0,0 +1,594 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.catalina.Globals;
import org.apache.catalina.security.SecurityClassLoad;
import org.apache.catalina.startup.ClassLoaderFactory.Repository;
import org.apache.catalina.startup.ClassLoaderFactory.RepositoryType;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
/**
* Bootstrap loader for Catalina. This application constructs a class loader
* for use in loading the Catalina internal classes (by accumulating all of the
* JAR files found in the "server" directory under "catalina.home"), and
* starts the regular execution of the container. The purpose of this
* roundabout approach is to keep the Catalina internal classes (and any
* other classes they depend on, such as an XML parser) out of the system
* class path and therefore not visible to application level classes.
*
* @author Craig R. McClanahan
* @author Remy Maucherat
*/
public final class Bootstrap {
private static final Log log = LogFactory.getLog(Bootstrap.class);
/**
* Daemon object used by main.
*/
private static final Object daemonLock = new Object();
private static volatile Bootstrap daemon = null;
private static final File catalinaBaseFile;
private static final File catalinaHomeFile;
private static final Pattern PATH_PATTERN = Pattern.compile("(\".*?\")|(([^,])*)");
static {
// Will always be non-null
String userDir = System.getProperty("user.dir");
// Home first
String home = System.getProperty(Globals.CATALINA_HOME_PROP);
File homeFile = null;
if (home != null) {
File f = new File(home);
try {
homeFile = f.getCanonicalFile();
} catch (IOException ioe) {
homeFile = f.getAbsoluteFile();
}
}
if (homeFile == null) {
// First fall-back. See if current directory is a bin directory
// in a normal Tomcat install
File bootstrapJar = new File(userDir, "bootstrap.jar");
if (bootstrapJar.exists()) {
File f = new File(userDir, "..");
try {
homeFile = f.getCanonicalFile();
} catch (IOException ioe) {
homeFile = f.getAbsoluteFile();
}
}
}
if (homeFile == null) {
// Second fall-back. Use current directory
File f = new File(userDir);
try {
homeFile = f.getCanonicalFile();
} catch (IOException ioe) {
homeFile = f.getAbsoluteFile();
}
}
catalinaHomeFile = homeFile;
System.setProperty(
Globals.CATALINA_HOME_PROP, catalinaHomeFile.getPath());
// Then base
String base = System.getProperty(Globals.CATALINA_BASE_PROP);
if (base == null) {
catalinaBaseFile = catalinaHomeFile;
} else {
File baseFile = new File(base);
try {
baseFile = baseFile.getCanonicalFile();
} catch (IOException ioe) {
baseFile = baseFile.getAbsoluteFile();
}
catalinaBaseFile = baseFile;
}
System.setProperty(
Globals.CATALINA_BASE_PROP, catalinaBaseFile.getPath());
}
// -------------------------------------------------------------- Variables
/**
* Daemon reference.
*/
private Object catalinaDaemon = null;
ClassLoader commonLoader = null;
ClassLoader catalinaLoader = null;
ClassLoader sharedLoader = null;
// -------------------------------------------------------- Private Methods
private void initClassLoaders() {
try {
commonLoader = createClassLoader("common", null);
if (commonLoader == null) {
// no config file, default to this loader - we might be in a 'single' env.
commonLoader = this.getClass().getClassLoader();
}
catalinaLoader = createClassLoader("server", commonLoader);
sharedLoader = createClassLoader("shared", commonLoader);
} catch (Throwable t) {
handleThrowable(t);
log.error("Class loader creation threw exception", t);
System.exit(1);
}
}
private ClassLoader createClassLoader(String name, ClassLoader parent)
throws Exception {
String value = CatalinaProperties.getProperty(name + ".loader");
if ((value == null) || (value.equals("")))
return parent;
value = replace(value);
List<Repository> repositories = new ArrayList<>();
String[] repositoryPaths = getPaths(value);
for (String repository : repositoryPaths) {
// Check for a JAR URL repository
try {
@SuppressWarnings("unused")
URL url = new URL(repository);
repositories.add(new Repository(repository, RepositoryType.URL));
continue;
} catch (MalformedURLException e) {
// Ignore
}
// Local repository
if (repository.endsWith("*.jar")) {
repository = repository.substring
(0, repository.length() - "*.jar".length());
repositories.add(new Repository(repository, RepositoryType.GLOB));
} else if (repository.endsWith(".jar")) {
repositories.add(new Repository(repository, RepositoryType.JAR));
} else {
repositories.add(new Repository(repository, RepositoryType.DIR));
}
}
return ClassLoaderFactory.createClassLoader(repositories, parent);
}
/**
* System property replacement in the given string.
*
* @param str The original string
* @return the modified string
*/
protected String replace(String str) {
// Implementation is copied from ClassLoaderLogManager.replace(),
// but added special processing for catalina.home and catalina.base.
String result = str;
int pos_start = str.indexOf("${");
if (pos_start >= 0) {
StringBuilder builder = new StringBuilder();
int pos_end = -1;
while (pos_start >= 0) {
builder.append(str, pos_end + 1, pos_start);
pos_end = str.indexOf('}', pos_start + 2);
if (pos_end < 0) {
pos_end = pos_start - 1;
break;
}
String propName = str.substring(pos_start + 2, pos_end);
String replacement;
if (propName.length() == 0) {
replacement = null;
} else if (Globals.CATALINA_HOME_PROP.equals(propName)) {
replacement = getCatalinaHome();
} else if (Globals.CATALINA_BASE_PROP.equals(propName)) {
replacement = getCatalinaBase();
} else {
replacement = System.getProperty(propName);
}
if (replacement != null) {
builder.append(replacement);
} else {
builder.append(str, pos_start, pos_end + 1);
}
pos_start = str.indexOf("${", pos_end + 1);
}
builder.append(str, pos_end + 1, str.length());
result = builder.toString();
}
return result;
}
/**
* Initialize daemon.
* @throws Exception Fatal initialization error
*/
public void init() throws Exception {
initClassLoaders();
Thread.currentThread().setContextClassLoader(catalinaLoader);
SecurityClassLoad.securityClassLoad(catalinaLoader);
// Load our startup class and call its process() method
if (log.isDebugEnabled())
log.debug("Loading startup class");
Class<?> startupClass = catalinaLoader.loadClass("org.apache.catalina.startup.Catalina");
Object startupInstance = startupClass.getConstructor().newInstance();
// Set the shared extensions class loader
if (log.isDebugEnabled())
log.debug("Setting startup class properties");
String methodName = "setParentClassLoader";
Class<?> paramTypes[] = new Class[1];
paramTypes[0] = Class.forName("java.lang.ClassLoader");
Object paramValues[] = new Object[1];
paramValues[0] = sharedLoader;
Method method =
startupInstance.getClass().getMethod(methodName, paramTypes);
method.invoke(startupInstance, paramValues);
catalinaDaemon = startupInstance;
}
/**
* Load daemon.
*/
private void load(String[] arguments) throws Exception {
// Call the load() method
String methodName = "load";
Object param[];
Class<?> paramTypes[];
if (arguments==null || arguments.length==0) {
paramTypes = null;
param = null;
} else {
paramTypes = new Class[1];
paramTypes[0] = arguments.getClass();
param = new Object[1];
param[0] = arguments;
}
Method method =
catalinaDaemon.getClass().getMethod(methodName, paramTypes);
if (log.isDebugEnabled()) {
log.debug("Calling startup class " + method);
}
method.invoke(catalinaDaemon, param);
}
/**
* getServer() for configtest
*/
private Object getServer() throws Exception {
String methodName = "getServer";
Method method = catalinaDaemon.getClass().getMethod(methodName);
return method.invoke(catalinaDaemon);
}
// ----------------------------------------------------------- Main Program
/**
* Load the Catalina daemon.
* @param arguments Initialization arguments
* @throws Exception Fatal initialization error
*/
public void init(String[] arguments) throws Exception {
init();
load(arguments);
}
/**
* Start the Catalina daemon.
* @throws Exception Fatal start error
*/
public void start() throws Exception {
if (catalinaDaemon == null) {
init();
}
Method method = catalinaDaemon.getClass().getMethod("start", (Class [])null);
method.invoke(catalinaDaemon, (Object [])null);
}
/**
* Stop the Catalina Daemon.
* @throws Exception Fatal stop error
*/
public void stop() throws Exception {
Method method = catalinaDaemon.getClass().getMethod("stop", (Class []) null);
method.invoke(catalinaDaemon, (Object []) null);
}
/**
* Stop the standalone server.
* @throws Exception Fatal stop error
*/
public void stopServer() throws Exception {
Method method =
catalinaDaemon.getClass().getMethod("stopServer", (Class []) null);
method.invoke(catalinaDaemon, (Object []) null);
}
/**
* Stop the standalone server.
* @param arguments Command line arguments
* @throws Exception Fatal stop error
*/
public void stopServer(String[] arguments) throws Exception {
Object param[];
Class<?> paramTypes[];
if (arguments == null || arguments.length == 0) {
paramTypes = null;
param = null;
} else {
paramTypes = new Class[1];
paramTypes[0] = arguments.getClass();
param = new Object[1];
param[0] = arguments;
}
Method method =
catalinaDaemon.getClass().getMethod("stopServer", paramTypes);
method.invoke(catalinaDaemon, param);
}
/**
* Set flag.
* @param await <code>true</code> if the daemon should block
* @throws Exception Reflection error
*/
public void setAwait(boolean await)
throws Exception {
Class<?> paramTypes[] = new Class[1];
paramTypes[0] = Boolean.TYPE;
Object paramValues[] = new Object[1];
paramValues[0] = Boolean.valueOf(await);
Method method =
catalinaDaemon.getClass().getMethod("setAwait", paramTypes);
method.invoke(catalinaDaemon, paramValues);
}
public boolean getAwait() throws Exception {
Class<?> paramTypes[] = new Class[0];
Object paramValues[] = new Object[0];
Method method =
catalinaDaemon.getClass().getMethod("getAwait", paramTypes);
Boolean b=(Boolean)method.invoke(catalinaDaemon, paramValues);
return b.booleanValue();
}
/**
* Destroy the Catalina Daemon.
*/
public void destroy() {
// FIXME
}
/**
* Main method and entry point when starting Tomcat via the provided
* scripts.
*
* @param args Command line arguments to be processed
*/
public static void main(String args[]) {
synchronized (daemonLock) {
if (daemon == null) {
// Don't set daemon until init() has completed
Bootstrap bootstrap = new Bootstrap();
try {
bootstrap.init();
} catch (Throwable t) {
handleThrowable(t);
t.printStackTrace();
return;
}
daemon = bootstrap;
} else {
// When running as a service the call to stop will be on a new
// thread so make sure the correct class loader is used to
// prevent a range of class not found exceptions.
Thread.currentThread().setContextClassLoader(daemon.catalinaLoader);
}
}
try {
String command = "start";
if (args.length > 0) {
command = args[args.length - 1];
}
if (command.equals("startd")) {
args[args.length - 1] = "start";
daemon.load(args);
daemon.start();
} else if (command.equals("stopd")) {
args[args.length - 1] = "stop";
daemon.stop();
} else if (command.equals("start")) {
daemon.setAwait(true);
daemon.load(args);
daemon.start();
if (null == daemon.getServer()) {
System.exit(1);
}
} else if (command.equals("stop")) {
daemon.stopServer(args);
} else if (command.equals("configtest")) {
daemon.load(args);
if (null == daemon.getServer()) {
System.exit(1);
}
System.exit(0);
} else {
log.warn("Bootstrap: command \"" + command + "\" does not exist.");
}
} catch (Throwable t) {
// Unwrap the Exception for clearer error reporting
if (t instanceof InvocationTargetException &&
t.getCause() != null) {
t = t.getCause();
}
handleThrowable(t);
t.printStackTrace();
System.exit(1);
}
}
/**
* Obtain the name of configured home (binary) directory. Note that home and
* base may be the same (and are by default).
* @return the catalina home
*/
public static String getCatalinaHome() {
return catalinaHomeFile.getPath();
}
/**
* Obtain the name of the configured base (instance) directory. Note that
* home and base may be the same (and are by default). If this is not set
* the value returned by {@link #getCatalinaHome()} will be used.
* @return the catalina base
*/
public static String getCatalinaBase() {
return catalinaBaseFile.getPath();
}
/**
* Obtain the configured home (binary) directory. Note that home and
* base may be the same (and are by default).
* @return the catalina home as a file
*/
public static File getCatalinaHomeFile() {
return catalinaHomeFile;
}
/**
* Obtain the configured base (instance) directory. Note that
* home and base may be the same (and are by default). If this is not set
* the value returned by {@link #getCatalinaHomeFile()} will be used.
* @return the catalina base as a file
*/
public static File getCatalinaBaseFile() {
return catalinaBaseFile;
}
// Copied from ExceptionUtils since that class is not visible during start
private static void handleThrowable(Throwable t) {
if (t instanceof ThreadDeath) {
throw (ThreadDeath) t;
}
if (t instanceof VirtualMachineError) {
throw (VirtualMachineError) t;
}
// All other instances of Throwable will be silently swallowed
}
// Protected for unit testing
protected static String[] getPaths(String value) {
List<String> result = new ArrayList<>();
Matcher matcher = PATH_PATTERN.matcher(value);
while (matcher.find()) {
String path = value.substring(matcher.start(), matcher.end());
path = path.trim();
if (path.length() == 0) {
continue;
}
char first = path.charAt(0);
char last = path.charAt(path.length() - 1);
if (first == '"' && last == '"' && path.length() > 1) {
path = path.substring(1, path.length() - 1);
path = path.trim();
if (path.length() == 0) {
continue;
}
} else if (path.contains("\"")) {
// Unbalanced quotes
// Too early to use standard i18n support. The class path hasn't
// been configured.
throw new IllegalArgumentException(
"The double quote [\"] character only be used to quote paths. It must " +
"not appear in a path. This loader path is not valid: [" + value + "]");
} else {
// Not quoted - NO-OP
}
result.add(path);
}
return result.toArray(new String[result.size()]);
}
}

View File

@@ -0,0 +1,916 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Constructor;
import java.net.ConnectException;
import java.net.Socket;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.LogManager;
import org.apache.catalina.Container;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleState;
import org.apache.catalina.Server;
import org.apache.catalina.core.StandardContext;
import org.apache.catalina.security.SecurityConfig;
import org.apache.juli.ClassLoaderLogManager;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.tomcat.util.ExceptionUtils;
import org.apache.tomcat.util.digester.Digester;
import org.apache.tomcat.util.digester.Rule;
import org.apache.tomcat.util.digester.RuleSet;
import org.apache.tomcat.util.log.SystemLogHandler;
import org.apache.tomcat.util.res.StringManager;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXParseException;
/**
* Startup/Shutdown shell program for Catalina. The following command line
* options are recognized:
* <ul>
* <li><b>-config {pathname}</b> - Set the pathname of the configuration file
* to be processed. If a relative path is specified, it will be
* interpreted as relative to the directory pathname specified by the
* "catalina.base" system property. [conf/server.xml]</li>
* <li><b>-help</b> - Display usage information.</li>
* <li><b>-nonaming</b> - Disable naming support.</li>
* <li><b>configtest</b> - Try to test the config</li>
* <li><b>start</b> - Start an instance of Catalina.</li>
* <li><b>stop</b> - Stop the currently running instance of Catalina.</li>
* </ul>
*
* @author Craig R. McClanahan
* @author Remy Maucherat
*/
public class Catalina {
/**
* The string manager for this package.
*/
protected static final StringManager sm =
StringManager.getManager(Constants.Package);
// ----------------------------------------------------- Instance Variables
/**
* Use await.
*/
protected boolean await = false;
/**
* Pathname to the server configuration file.
*/
protected String configFile = "conf/server.xml";
// XXX Should be moved to embedded
/**
* The shared extensions class loader for this server.
*/
protected ClassLoader parentClassLoader =
Catalina.class.getClassLoader();
/**
* The server component we are starting or stopping.
*/
protected Server server = null;
/**
* Use shutdown hook flag.
*/
protected boolean useShutdownHook = true;
/**
* Shutdown hook.
*/
protected Thread shutdownHook = null;
/**
* Is naming enabled ?
*/
protected boolean useNaming = true;
/**
* Prevent duplicate loads.
*/
protected boolean loaded = false;
// ----------------------------------------------------------- Constructors
public Catalina() {
setSecurityProtection();
ExceptionUtils.preload();
}
// ------------------------------------------------------------- Properties
public void setConfigFile(String file) {
configFile = file;
}
public String getConfigFile() {
return configFile;
}
public void setUseShutdownHook(boolean useShutdownHook) {
this.useShutdownHook = useShutdownHook;
}
public boolean getUseShutdownHook() {
return useShutdownHook;
}
/**
* Set the shared extensions class loader.
*
* @param parentClassLoader The shared extensions class loader.
*/
public void setParentClassLoader(ClassLoader parentClassLoader) {
this.parentClassLoader = parentClassLoader;
}
public ClassLoader getParentClassLoader() {
if (parentClassLoader != null) {
return parentClassLoader;
}
return ClassLoader.getSystemClassLoader();
}
public void setServer(Server server) {
this.server = server;
}
public Server getServer() {
return server;
}
/**
* @return <code>true</code> if naming is enabled.
*/
public boolean isUseNaming() {
return this.useNaming;
}
/**
* Enables or disables naming support.
*
* @param useNaming The new use naming value
*/
public void setUseNaming(boolean useNaming) {
this.useNaming = useNaming;
}
public void setAwait(boolean b) {
await = b;
}
public boolean isAwait() {
return await;
}
// ------------------------------------------------------ Protected Methods
/**
* Process the specified command line arguments.
*
* @param args Command line arguments to process
* @return <code>true</code> if we should continue processing
*/
protected boolean arguments(String args[]) {
boolean isConfig = false;
if (args.length < 1) {
usage();
return false;
}
for (int i = 0; i < args.length; i++) {
if (isConfig) {
configFile = args[i];
isConfig = false;
} else if (args[i].equals("-config")) {
isConfig = true;
} else if (args[i].equals("-nonaming")) {
setUseNaming(false);
} else if (args[i].equals("-help")) {
usage();
return false;
} else if (args[i].equals("start")) {
// NOOP
} else if (args[i].equals("configtest")) {
// NOOP
} else if (args[i].equals("stop")) {
// NOOP
} else {
usage();
return false;
}
}
return true;
}
/**
* Return a File object representing our configuration file.
* @return the main configuration file
*/
protected File configFile() {
File file = new File(configFile);
if (!file.isAbsolute()) {
file = new File(Bootstrap.getCatalinaBase(), configFile);
}
return file;
}
/**
* Create and configure the Digester we will be using for startup.
* @return the main digester to parse server.xml
*/
protected Digester createStartDigester() {
long t1=System.currentTimeMillis();
// Initialize the digester
Digester digester = new Digester();
digester.setValidating(false);
digester.setRulesValidation(true);
Map<Class<?>, List<String>> fakeAttributes = new HashMap<>();
List<String> objectAttrs = new ArrayList<>();
objectAttrs.add("className");
fakeAttributes.put(Object.class, objectAttrs);
// Ignore attribute added by Eclipse for its internal tracking
List<String> contextAttrs = new ArrayList<>();
contextAttrs.add("source");
fakeAttributes.put(StandardContext.class, contextAttrs);
digester.setFakeAttributes(fakeAttributes);
digester.setUseContextClassLoader(true);
// Configure the actions we will be using
digester.addObjectCreate("Server",
"org.apache.catalina.core.StandardServer",
"className");
digester.addSetProperties("Server");
digester.addSetNext("Server",
"setServer",
"org.apache.catalina.Server");
digester.addObjectCreate("Server/GlobalNamingResources",
"org.apache.catalina.deploy.NamingResourcesImpl");
digester.addSetProperties("Server/GlobalNamingResources");
digester.addSetNext("Server/GlobalNamingResources",
"setGlobalNamingResources",
"org.apache.catalina.deploy.NamingResourcesImpl");
digester.addObjectCreate("Server/Listener",
null, // MUST be specified in the element
"className");
digester.addSetProperties("Server/Listener");
digester.addSetNext("Server/Listener",
"addLifecycleListener",
"org.apache.catalina.LifecycleListener");
digester.addObjectCreate("Server/Service",
"org.apache.catalina.core.StandardService",
"className");
digester.addSetProperties("Server/Service");
digester.addSetNext("Server/Service",
"addService",
"org.apache.catalina.Service");
digester.addObjectCreate("Server/Service/Listener",
null, // MUST be specified in the element
"className");
digester.addSetProperties("Server/Service/Listener");
digester.addSetNext("Server/Service/Listener",
"addLifecycleListener",
"org.apache.catalina.LifecycleListener");
//Executor
digester.addObjectCreate("Server/Service/Executor",
"org.apache.catalina.core.StandardThreadExecutor",
"className");
digester.addSetProperties("Server/Service/Executor");
digester.addSetNext("Server/Service/Executor",
"addExecutor",
"org.apache.catalina.Executor");
digester.addRule("Server/Service/Connector",
new ConnectorCreateRule());
digester.addRule("Server/Service/Connector",
new SetAllPropertiesRule(new String[]{"executor", "sslImplementationName"}));
digester.addSetNext("Server/Service/Connector",
"addConnector",
"org.apache.catalina.connector.Connector");
digester.addObjectCreate("Server/Service/Connector/SSLHostConfig",
"org.apache.tomcat.util.net.SSLHostConfig");
digester.addSetProperties("Server/Service/Connector/SSLHostConfig");
digester.addSetNext("Server/Service/Connector/SSLHostConfig",
"addSslHostConfig",
"org.apache.tomcat.util.net.SSLHostConfig");
digester.addRule("Server/Service/Connector/SSLHostConfig/Certificate",
new CertificateCreateRule());
digester.addRule("Server/Service/Connector/SSLHostConfig/Certificate",
new SetAllPropertiesRule(new String[]{"type"}));
digester.addSetNext("Server/Service/Connector/SSLHostConfig/Certificate",
"addCertificate",
"org.apache.tomcat.util.net.SSLHostConfigCertificate");
digester.addObjectCreate("Server/Service/Connector/SSLHostConfig/OpenSSLConf",
"org.apache.tomcat.util.net.openssl.OpenSSLConf");
digester.addSetProperties("Server/Service/Connector/SSLHostConfig/OpenSSLConf");
digester.addSetNext("Server/Service/Connector/SSLHostConfig/OpenSSLConf",
"setOpenSslConf",
"org.apache.tomcat.util.net.openssl.OpenSSLConf");
digester.addObjectCreate("Server/Service/Connector/SSLHostConfig/OpenSSLConf/OpenSSLConfCmd",
"org.apache.tomcat.util.net.openssl.OpenSSLConfCmd");
digester.addSetProperties("Server/Service/Connector/SSLHostConfig/OpenSSLConf/OpenSSLConfCmd");
digester.addSetNext("Server/Service/Connector/SSLHostConfig/OpenSSLConf/OpenSSLConfCmd",
"addCmd",
"org.apache.tomcat.util.net.openssl.OpenSSLConfCmd");
digester.addObjectCreate("Server/Service/Connector/Listener",
null, // MUST be specified in the element
"className");
digester.addSetProperties("Server/Service/Connector/Listener");
digester.addSetNext("Server/Service/Connector/Listener",
"addLifecycleListener",
"org.apache.catalina.LifecycleListener");
digester.addObjectCreate("Server/Service/Connector/UpgradeProtocol",
null, // MUST be specified in the element
"className");
digester.addSetProperties("Server/Service/Connector/UpgradeProtocol");
digester.addSetNext("Server/Service/Connector/UpgradeProtocol",
"addUpgradeProtocol",
"org.apache.coyote.UpgradeProtocol");
// Add RuleSets for nested elements
digester.addRuleSet(new NamingRuleSet("Server/GlobalNamingResources/"));
digester.addRuleSet(new EngineRuleSet("Server/Service/"));
digester.addRuleSet(new HostRuleSet("Server/Service/Engine/"));
digester.addRuleSet(new ContextRuleSet("Server/Service/Engine/Host/"));
addClusterRuleSet(digester, "Server/Service/Engine/Host/Cluster/");
digester.addRuleSet(new NamingRuleSet("Server/Service/Engine/Host/Context/"));
// When the 'engine' is found, set the parentClassLoader.
digester.addRule("Server/Service/Engine",
new SetParentClassLoaderRule(parentClassLoader));
addClusterRuleSet(digester, "Server/Service/Engine/Cluster/");
long t2=System.currentTimeMillis();
if (log.isDebugEnabled()) {
log.debug("Digester for server.xml created " + ( t2-t1 ));
}
return digester;
}
/**
* Cluster support is optional. The JARs may have been removed.
*/
private void addClusterRuleSet(Digester digester, String prefix) {
Class<?> clazz = null;
Constructor<?> constructor = null;
try {
clazz = Class.forName("org.apache.catalina.ha.ClusterRuleSet");
constructor = clazz.getConstructor(String.class);
RuleSet ruleSet = (RuleSet) constructor.newInstance(prefix);
digester.addRuleSet(ruleSet);
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug(sm.getString("catalina.noCluster",
e.getClass().getName() + ": " + e.getMessage()), e);
} else if (log.isInfoEnabled()) {
log.info(sm.getString("catalina.noCluster",
e.getClass().getName() + ": " + e.getMessage()));
}
}
}
/**
* Create and configure the Digester we will be using for shutdown.
* @return the digester to process the stop operation
*/
protected Digester createStopDigester() {
// Initialize the digester
Digester digester = new Digester();
digester.setUseContextClassLoader(true);
// Configure the rules we need for shutting down
digester.addObjectCreate("Server",
"org.apache.catalina.core.StandardServer",
"className");
digester.addSetProperties("Server");
digester.addSetNext("Server",
"setServer",
"org.apache.catalina.Server");
return digester;
}
public void stopServer() {
stopServer(null);
}
public void stopServer(String[] arguments) {
if (arguments != null) {
arguments(arguments);
}
Server s = getServer();
if (s == null) {
// Create and execute our Digester
Digester digester = createStopDigester();
File file = configFile();
try (FileInputStream fis = new FileInputStream(file)) {
InputSource is =
new InputSource(file.toURI().toURL().toString());
is.setByteStream(fis);
digester.push(this);
digester.parse(is);
} catch (Exception e) {
log.error("Catalina.stop: ", e);
System.exit(1);
}
} else {
// Server object already present. Must be running as a service
try {
s.stop();
s.destroy();
} catch (LifecycleException e) {
log.error("Catalina.stop: ", e);
}
return;
}
// Stop the existing server
s = getServer();
if (s.getPort()>0) {
try (Socket socket = new Socket(s.getAddress(), s.getPort());
OutputStream stream = socket.getOutputStream()) {
String shutdown = s.getShutdown();
for (int i = 0; i < shutdown.length(); i++) {
stream.write(shutdown.charAt(i));
}
stream.flush();
} catch (ConnectException ce) {
log.error(sm.getString("catalina.stopServer.connectException",
s.getAddress(),
String.valueOf(s.getPort())));
log.error("Catalina.stop: ", ce);
System.exit(1);
} catch (IOException e) {
log.error("Catalina.stop: ", e);
System.exit(1);
}
} else {
log.error(sm.getString("catalina.stopServer"));
System.exit(1);
}
}
/**
* Start a new server instance.
*/
public void load() {
if (loaded) {
return;
}
loaded = true;
long t1 = System.nanoTime();
initDirs();
// Before digester - it may be needed
initNaming();
// Create and execute our Digester
Digester digester = createStartDigester();
InputSource inputSource = null;
InputStream inputStream = null;
File file = null;
try {
try {
file = configFile();
inputStream = new FileInputStream(file);
inputSource = new InputSource(file.toURI().toURL().toString());
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug(sm.getString("catalina.configFail", file), e);
}
}
if (inputStream == null) {
try {
inputStream = getClass().getClassLoader()
.getResourceAsStream(getConfigFile());
inputSource = new InputSource
(getClass().getClassLoader()
.getResource(getConfigFile()).toString());
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug(sm.getString("catalina.configFail",
getConfigFile()), e);
}
}
}
// This should be included in catalina.jar
// Alternative: don't bother with xml, just create it manually.
if (inputStream == null) {
try {
inputStream = getClass().getClassLoader()
.getResourceAsStream("server-embed.xml");
inputSource = new InputSource
(getClass().getClassLoader()
.getResource("server-embed.xml").toString());
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug(sm.getString("catalina.configFail",
"server-embed.xml"), e);
}
}
}
if (inputStream == null || inputSource == null) {
if (file == null) {
log.warn(sm.getString("catalina.configFail",
getConfigFile() + "] or [server-embed.xml]"));
} else {
log.warn(sm.getString("catalina.configFail",
file.getAbsolutePath()));
if (file.exists() && !file.canRead()) {
log.warn("Permissions incorrect, read permission is not allowed on the file.");
}
}
return;
}
try {
inputSource.setByteStream(inputStream);
digester.push(this);
digester.parse(inputSource);
} catch (SAXParseException spe) {
log.warn("Catalina.start using " + getConfigFile() + ": " +
spe.getMessage());
return;
} catch (Exception e) {
log.warn("Catalina.start using " + getConfigFile() + ": " , e);
return;
}
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
// Ignore
}
}
}
getServer().setCatalina(this);
getServer().setCatalinaHome(Bootstrap.getCatalinaHomeFile());
getServer().setCatalinaBase(Bootstrap.getCatalinaBaseFile());
// Stream redirection
initStreams();
// Start the new server
try {
getServer().init();
} catch (LifecycleException e) {
if (Boolean.getBoolean("org.apache.catalina.startup.EXIT_ON_INIT_FAILURE")) {
throw new java.lang.Error(e);
} else {
log.error("Catalina.start", e);
}
}
long t2 = System.nanoTime();
if(log.isInfoEnabled()) {
log.info("Initialization processed in " + ((t2 - t1) / 1000000) + " ms");
}
}
/*
* Load using arguments
*/
public void load(String args[]) {
try {
if (arguments(args)) {
load();
}
} catch (Exception e) {
e.printStackTrace(System.out);
}
}
/**
* Start a new server instance.
*/
public void start() {
if (getServer() == null) {
load();
}
if (getServer() == null) {
log.fatal("Cannot start server. Server instance is not configured.");
return;
}
long t1 = System.nanoTime();
// Start the new server
try {
getServer().start();
} catch (LifecycleException e) {
log.fatal(sm.getString("catalina.serverStartFail"), e);
try {
getServer().destroy();
} catch (LifecycleException e1) {
log.debug("destroy() failed for failed Server ", e1);
}
return;
}
long t2 = System.nanoTime();
if(log.isInfoEnabled()) {
log.info("Server startup in " + ((t2 - t1) / 1000000) + " ms");
}
// Register shutdown hook
if (useShutdownHook) {
if (shutdownHook == null) {
shutdownHook = new CatalinaShutdownHook();
}
Runtime.getRuntime().addShutdownHook(shutdownHook);
// If JULI is being used, disable JULI's shutdown hook since
// shutdown hooks run in parallel and log messages may be lost
// if JULI's hook completes before the CatalinaShutdownHook()
LogManager logManager = LogManager.getLogManager();
if (logManager instanceof ClassLoaderLogManager) {
((ClassLoaderLogManager) logManager).setUseShutdownHook(
false);
}
}
if (await) {
await();
stop();
}
}
/**
* Stop an existing server instance.
*/
public void stop() {
try {
// Remove the ShutdownHook first so that server.stop()
// doesn't get invoked twice
if (useShutdownHook) {
Runtime.getRuntime().removeShutdownHook(shutdownHook);
// If JULI is being used, re-enable JULI's shutdown to ensure
// log messages are not lost
LogManager logManager = LogManager.getLogManager();
if (logManager instanceof ClassLoaderLogManager) {
((ClassLoaderLogManager) logManager).setUseShutdownHook(
true);
}
}
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
// This will fail on JDK 1.2. Ignoring, as Tomcat can run
// fine without the shutdown hook.
}
// Shut down the server
try {
Server s = getServer();
LifecycleState state = s.getState();
if (LifecycleState.STOPPING_PREP.compareTo(state) <= 0
&& LifecycleState.DESTROYED.compareTo(state) >= 0) {
// Nothing to do. stop() was already called
} else {
s.stop();
s.destroy();
}
} catch (LifecycleException e) {
log.error("Catalina.stop", e);
}
}
/**
* Await and shutdown.
*/
public void await() {
getServer().await();
}
/**
* Print usage information for this application.
*/
protected void usage() {
System.out.println
("usage: java org.apache.catalina.startup.Catalina"
+ " [ -config {pathname} ]"
+ " [ -nonaming ] "
+ " { -help | start | stop }");
}
protected void initDirs() {
String temp = System.getProperty("java.io.tmpdir");
if (temp == null || (!(new File(temp)).isDirectory())) {
log.error(sm.getString("embedded.notmp", temp));
}
}
protected void initStreams() {
// Replace System.out and System.err with a custom PrintStream
System.setOut(new SystemLogHandler(System.out));
System.setErr(new SystemLogHandler(System.err));
}
protected void initNaming() {
// Setting additional variables
if (!useNaming) {
log.info( "Catalina naming disabled");
System.setProperty("catalina.useNaming", "false");
} else {
System.setProperty("catalina.useNaming", "true");
String value = "org.apache.naming";
String oldValue =
System.getProperty(javax.naming.Context.URL_PKG_PREFIXES);
if (oldValue != null) {
value = value + ":" + oldValue;
}
System.setProperty(javax.naming.Context.URL_PKG_PREFIXES, value);
if( log.isDebugEnabled() ) {
log.debug("Setting naming prefix=" + value);
}
value = System.getProperty
(javax.naming.Context.INITIAL_CONTEXT_FACTORY);
if (value == null) {
System.setProperty
(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
"org.apache.naming.java.javaURLContextFactory");
} else {
log.debug( "INITIAL_CONTEXT_FACTORY already set " + value );
}
}
}
/**
* Set the security package access/protection.
*/
protected void setSecurityProtection(){
SecurityConfig securityConfig = SecurityConfig.newInstance();
securityConfig.setPackageDefinition();
securityConfig.setPackageAccess();
}
// --------------------------------------- CatalinaShutdownHook Inner Class
// XXX Should be moved to embedded !
/**
* Shutdown hook which will perform a clean shutdown of Catalina if needed.
*/
protected class CatalinaShutdownHook extends Thread {
@Override
public void run() {
try {
if (getServer() != null) {
Catalina.this.stop();
}
} catch (Throwable ex) {
ExceptionUtils.handleThrowable(ex);
log.error(sm.getString("catalina.shutdownHookFail"), ex);
} finally {
// If JULI is used, shut JULI down *after* the server shuts down
// so log messages aren't lost
LogManager logManager = LogManager.getLogManager();
if (logManager instanceof ClassLoaderLogManager) {
((ClassLoaderLogManager) logManager).shutdown();
}
}
}
}
private static final Log log = LogFactory.getLog(Catalina.class);
}
// ------------------------------------------------------------ Private Classes
/**
* Rule that sets the parent class loader for the top object on the stack,
* which must be a <code>Container</code>.
*/
final class SetParentClassLoaderRule extends Rule {
public SetParentClassLoaderRule(ClassLoader parentClassLoader) {
this.parentClassLoader = parentClassLoader;
}
ClassLoader parentClassLoader = null;
@Override
public void begin(String namespace, String name, Attributes attributes)
throws Exception {
if (digester.getLogger().isDebugEnabled()) {
digester.getLogger().debug("Setting parent class loader");
}
Container top = (Container) digester.peek();
top.setParentClassLoader(parentClassLoader);
}
}

View File

@@ -0,0 +1,137 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Enumeration;
import java.util.Properties;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
/**
* Utility class to read the bootstrap Catalina configuration.
*
* @author Remy Maucherat
*/
public class CatalinaProperties {
private static final Log log = LogFactory.getLog(CatalinaProperties.class);
private static Properties properties = null;
static {
loadProperties();
}
/**
* @param name The property name
* @return specified property value
*/
public static String getProperty(String name) {
return properties.getProperty(name);
}
/**
* Load properties.
*/
private static void loadProperties() {
InputStream is = null;
try {
String configUrl = System.getProperty("catalina.config");
if (configUrl != null) {
is = (new URL(configUrl)).openStream();
}
} catch (Throwable t) {
handleThrowable(t);
}
if (is == null) {
try {
File home = new File(Bootstrap.getCatalinaBase());
File conf = new File(home, "conf");
File propsFile = new File(conf, "catalina.properties");
is = new FileInputStream(propsFile);
} catch (Throwable t) {
handleThrowable(t);
}
}
if (is == null) {
try {
is = CatalinaProperties.class.getResourceAsStream
("/org/apache/catalina/startup/catalina.properties");
} catch (Throwable t) {
handleThrowable(t);
}
}
if (is != null) {
try {
properties = new Properties();
properties.load(is);
} catch (Throwable t) {
handleThrowable(t);
log.warn(t);
} finally {
try {
is.close();
} catch (IOException ioe) {
log.warn("Could not close catalina.properties", ioe);
}
}
}
if ((is == null)) {
// Do something
log.warn("Failed to load catalina.properties");
// That's fine - we have reasonable defaults.
properties = new Properties();
}
// Register the properties as system properties
Enumeration<?> enumeration = properties.propertyNames();
while (enumeration.hasMoreElements()) {
String name = (String) enumeration.nextElement();
String value = properties.getProperty(name);
if (value != null) {
System.setProperty(name, value);
}
}
}
// Copied from ExceptionUtils since that class is not visible during start
private static void handleThrowable(Throwable t) {
if (t instanceof ThreadDeath) {
throw (ThreadDeath) t;
}
if (t instanceof VirtualMachineError) {
throw (VirtualMachineError) t;
}
// All other instances of Throwable will be silently swallowed
}
}

View File

@@ -0,0 +1,61 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import org.apache.tomcat.util.digester.Rule;
import org.apache.tomcat.util.net.SSLHostConfig;
import org.apache.tomcat.util.net.SSLHostConfigCertificate;
import org.apache.tomcat.util.net.SSLHostConfigCertificate.Type;
import org.xml.sax.Attributes;
/**
* Rule implementation that creates an SSLHostConfigCertificate.
*/
public class CertificateCreateRule extends Rule {
@Override
public void begin(String namespace, String name, Attributes attributes) throws Exception {
SSLHostConfig sslHostConfig = (SSLHostConfig)digester.peek();
Type type;
String typeValue = attributes.getValue("type");
if (typeValue == null || typeValue.length() == 0) {
type = Type.UNDEFINED;
} else {
type = Type.valueOf(typeValue);
}
SSLHostConfigCertificate certificate = new SSLHostConfigCertificate(sslHostConfig, type);
digester.push(certificate);
}
/**
* Process the end of this element.
*
* @param namespace the namespace URI of the matching element, or an
* empty string if the parser is not namespace aware or the element has
* no namespace
* @param name the local name if the parser is namespace aware, or just
* the element name otherwise
*/
@Override
public void end(String namespace, String name) throws Exception {
digester.pop();
}
}

View File

@@ -0,0 +1,325 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
/**
* <p>Utility class for building class loaders for Catalina. The factory
* method requires the following parameters in order to build a new class
* loader (with suitable defaults in all cases):</p>
* <ul>
* <li>A set of directories containing unpacked classes (and resources)
* that should be included in the class loader's
* repositories.</li>
* <li>A set of directories containing classes and resources in JAR files.
* Each readable JAR file discovered in these directories will be
* added to the class loader's repositories.</li>
* <li><code>ClassLoader</code> instance that should become the parent of
* the new class loader.</li>
* </ul>
*
* @author Craig R. McClanahan
*/
public final class ClassLoaderFactory {
private static final Log log = LogFactory.getLog(ClassLoaderFactory.class);
// --------------------------------------------------------- Public Methods
/**
* Create and return a new class loader, based on the configuration
* defaults and the specified directory paths:
*
* @param unpacked Array of pathnames to unpacked directories that should
* be added to the repositories of the class loader, or <code>null</code>
* for no unpacked directories to be considered
* @param packed Array of pathnames to directories containing JAR files
* that should be added to the repositories of the class loader,
* or <code>null</code> for no directories of JAR files to be considered
* @param parent Parent class loader for the new class loader, or
* <code>null</code> for the system class loader.
* @return the new class loader
*
* @exception Exception if an error occurs constructing the class loader
*/
public static ClassLoader createClassLoader(File unpacked[],
File packed[],
final ClassLoader parent)
throws Exception {
if (log.isDebugEnabled())
log.debug("Creating new class loader");
// Construct the "class path" for this class loader
Set<URL> set = new LinkedHashSet<>();
// Add unpacked directories
if (unpacked != null) {
for (int i = 0; i < unpacked.length; i++) {
File file = unpacked[i];
if (!file.canRead())
continue;
file = new File(file.getCanonicalPath() + File.separator);
URL url = file.toURI().toURL();
if (log.isDebugEnabled())
log.debug(" Including directory " + url);
set.add(url);
}
}
// Add packed directory JAR files
if (packed != null) {
for (int i = 0; i < packed.length; i++) {
File directory = packed[i];
if (!directory.isDirectory() || !directory.canRead())
continue;
String filenames[] = directory.list();
if (filenames == null) {
continue;
}
for (int j = 0; j < filenames.length; j++) {
String filename = filenames[j].toLowerCase(Locale.ENGLISH);
if (!filename.endsWith(".jar"))
continue;
File file = new File(directory, filenames[j]);
if (log.isDebugEnabled())
log.debug(" Including jar file " + file.getAbsolutePath());
URL url = file.toURI().toURL();
set.add(url);
}
}
}
// Construct the class loader itself
final URL[] array = set.toArray(new URL[set.size()]);
return AccessController.doPrivileged(
new PrivilegedAction<URLClassLoader>() {
@Override
public URLClassLoader run() {
if (parent == null)
return new URLClassLoader(array);
else
return new URLClassLoader(array, parent);
}
});
}
/**
* Create and return a new class loader, based on the configuration
* defaults and the specified directory paths:
*
* @param repositories List of class directories, jar files, jar directories
* or URLS that should be added to the repositories of
* the class loader.
* @param parent Parent class loader for the new class loader, or
* <code>null</code> for the system class loader.
* @return the new class loader
*
* @exception Exception if an error occurs constructing the class loader
*/
public static ClassLoader createClassLoader(List<Repository> repositories,
final ClassLoader parent)
throws Exception {
if (log.isDebugEnabled())
log.debug("Creating new class loader");
// Construct the "class path" for this class loader
Set<URL> set = new LinkedHashSet<>();
if (repositories != null) {
for (Repository repository : repositories) {
if (repository.getType() == RepositoryType.URL) {
URL url = buildClassLoaderUrl(repository.getLocation());
if (log.isDebugEnabled())
log.debug(" Including URL " + url);
set.add(url);
} else if (repository.getType() == RepositoryType.DIR) {
File directory = new File(repository.getLocation());
directory = directory.getCanonicalFile();
if (!validateFile(directory, RepositoryType.DIR)) {
continue;
}
URL url = buildClassLoaderUrl(directory);
if (log.isDebugEnabled())
log.debug(" Including directory " + url);
set.add(url);
} else if (repository.getType() == RepositoryType.JAR) {
File file=new File(repository.getLocation());
file = file.getCanonicalFile();
if (!validateFile(file, RepositoryType.JAR)) {
continue;
}
URL url = buildClassLoaderUrl(file);
if (log.isDebugEnabled())
log.debug(" Including jar file " + url);
set.add(url);
} else if (repository.getType() == RepositoryType.GLOB) {
File directory=new File(repository.getLocation());
directory = directory.getCanonicalFile();
if (!validateFile(directory, RepositoryType.GLOB)) {
continue;
}
if (log.isDebugEnabled())
log.debug(" Including directory glob "
+ directory.getAbsolutePath());
String filenames[] = directory.list();
if (filenames == null) {
continue;
}
for (int j = 0; j < filenames.length; j++) {
String filename = filenames[j].toLowerCase(Locale.ENGLISH);
if (!filename.endsWith(".jar"))
continue;
File file = new File(directory, filenames[j]);
file = file.getCanonicalFile();
if (!validateFile(file, RepositoryType.JAR)) {
continue;
}
if (log.isDebugEnabled())
log.debug(" Including glob jar file "
+ file.getAbsolutePath());
URL url = buildClassLoaderUrl(file);
set.add(url);
}
}
}
}
// Construct the class loader itself
final URL[] array = set.toArray(new URL[set.size()]);
if (log.isDebugEnabled())
for (int i = 0; i < array.length; i++) {
log.debug(" location " + i + " is " + array[i]);
}
return AccessController.doPrivileged(
new PrivilegedAction<URLClassLoader>() {
@Override
public URLClassLoader run() {
if (parent == null)
return new URLClassLoader(array);
else
return new URLClassLoader(array, parent);
}
});
}
private static boolean validateFile(File file,
RepositoryType type) throws IOException {
if (RepositoryType.DIR == type || RepositoryType.GLOB == type) {
if (!file.isDirectory() || !file.canRead()) {
String msg = "Problem with directory [" + file +
"], exists: [" + file.exists() +
"], isDirectory: [" + file.isDirectory() +
"], canRead: [" + file.canRead() + "]";
File home = new File (Bootstrap.getCatalinaHome());
home = home.getCanonicalFile();
File base = new File (Bootstrap.getCatalinaBase());
base = base.getCanonicalFile();
File defaultValue = new File(base, "lib");
// Existence of ${catalina.base}/lib directory is optional.
// Hide the warning if Tomcat runs with separate catalina.home
// and catalina.base and that directory is absent.
if (!home.getPath().equals(base.getPath())
&& file.getPath().equals(defaultValue.getPath())
&& !file.exists()) {
log.debug(msg);
} else {
log.warn(msg);
}
return false;
}
} else if (RepositoryType.JAR == type) {
if (!file.canRead()) {
log.warn("Problem with JAR file [" + file +
"], exists: [" + file.exists() +
"], canRead: [" + file.canRead() + "]");
return false;
}
}
return true;
}
/*
* These two methods would ideally be in the utility class
* org.apache.tomcat.util.buf.UriUtil but that class is not visible until
* after the class loaders have been constructed.
*/
private static URL buildClassLoaderUrl(String urlString) throws MalformedURLException {
// URLs passed to class loaders may point to directories that contain
// JARs. If these URLs are used to construct URLs for resources in a JAR
// the URL will be used as is. It is therefore necessary to ensure that
// the sequence "!/" is not present in a class loader URL.
String result = urlString.replaceAll("!/", "%21/");
return new URL(result);
}
private static URL buildClassLoaderUrl(File file) throws MalformedURLException {
// Could be a directory or a file
String fileUrlString = file.toURI().toString();
fileUrlString = fileUrlString.replaceAll("!/", "%21/");
return new URL(fileUrlString);
}
public enum RepositoryType {
DIR,
GLOB,
JAR,
URL
}
public static class Repository {
private final String location;
private final RepositoryType type;
public Repository(String location, RepositoryType type) {
this.location = location;
this.type = type;
}
public String getLocation() {
return location;
}
public RepositoryType getType() {
return type;
}
}
}

View File

@@ -0,0 +1,108 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import java.lang.reflect.Method;
import org.apache.catalina.Executor;
import org.apache.catalina.Service;
import org.apache.catalina.connector.Connector;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.tomcat.util.IntrospectionUtils;
import org.apache.tomcat.util.digester.Rule;
import org.apache.tomcat.util.res.StringManager;
import org.xml.sax.Attributes;
/**
* Rule implementation that creates a connector.
*/
public class ConnectorCreateRule extends Rule {
private static final Log log = LogFactory.getLog(ConnectorCreateRule.class);
protected static final StringManager sm = StringManager.getManager(ConnectorCreateRule.class);
// --------------------------------------------------------- Public Methods
/**
* Process the beginning of this element.
*
* @param namespace the namespace URI of the matching element, or an
* empty string if the parser is not namespace aware or the element has
* no namespace
* @param name the local name if the parser is namespace aware, or just
* the element name otherwise
* @param attributes The attribute list for this element
*/
@Override
public void begin(String namespace, String name, Attributes attributes)
throws Exception {
Service svc = (Service)digester.peek();
Executor ex = null;
if ( attributes.getValue("executor")!=null ) {
ex = svc.getExecutor(attributes.getValue("executor"));
}
Connector con = new Connector(attributes.getValue("protocol"));
if (ex != null) {
setExecutor(con, ex);
}
String sslImplementationName = attributes.getValue("sslImplementationName");
if (sslImplementationName != null) {
setSSLImplementationName(con, sslImplementationName);
}
digester.push(con);
}
private static void setExecutor(Connector con, Executor ex) throws Exception {
Method m = IntrospectionUtils.findMethod(con.getProtocolHandler().getClass(),"setExecutor",new Class[] {java.util.concurrent.Executor.class});
if (m!=null) {
m.invoke(con.getProtocolHandler(), new Object[] {ex});
}else {
log.warn(sm.getString("connector.noSetExecutor", con));
}
}
private static void setSSLImplementationName(Connector con, String sslImplementationName) throws Exception {
Method m = IntrospectionUtils.findMethod(con.getProtocolHandler().getClass(),"setSslImplementationName",new Class[] {String.class});
if (m != null) {
m.invoke(con.getProtocolHandler(), new Object[] {sslImplementationName});
} else {
log.warn(sm.getString("connector.noSetSSLImplementationName", con));
}
}
/**
* Process the end of this element.
*
* @param namespace the namespace URI of the matching element, or an
* empty string if the parser is not namespace aware or the element has
* no namespace
* @param name the local name if the parser is namespace aware, or just
* the element name otherwise
*/
@Override
public void end(String namespace, String name) throws Exception {
digester.pop();
}
}

View File

@@ -0,0 +1,50 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
/**
* String constants for the startup package.
* <br>
* Note that some values include a leading '/' and that some do not. This is
* intentional based on how the values are used.
*
* @author Craig R. McClanahan
*/
public final class Constants {
public static final String Package = "org.apache.catalina.startup";
public static final String ApplicationContextXml = "META-INF/context.xml";
public static final String ApplicationWebXml = "/WEB-INF/web.xml";
public static final String DefaultContextXml = "conf/context.xml";
public static final String DefaultWebXml = "conf/web.xml";
public static final String HostContextXml = "context.xml.default";
public static final String HostWebXml = "web.xml.default";
public static final String WarTracker = "/META-INF/war-tracker";
/**
* A dummy value used to suppress loading the default web.xml file.
*
* <p>
* It is useful when embedding Tomcat, when the default configuration is
* done programmatically, e.g. by calling
* <code>Tomcat.initWebappDefaults(context)</code>.
*
* @see Tomcat
*/
public static final String NoDefaultWebXml = "org/apache/catalina/startup/NO_DEFAULT_XML";
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,254 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import org.apache.tomcat.util.digester.Digester;
import org.apache.tomcat.util.digester.RuleSetBase;
/**
* <p><strong>RuleSet</strong> for processing the contents of a
* Context definition element.</p>
*
* @author Craig R. McClanahan
*/
@SuppressWarnings("deprecation")
public class ContextRuleSet extends RuleSetBase {
// ----------------------------------------------------- Instance Variables
/**
* The matching pattern prefix to use for recognizing our elements.
*/
protected final String prefix;
/**
* Should the context be created.
*/
protected final boolean create;
// ------------------------------------------------------------ Constructor
/**
* Construct an instance of this <code>RuleSet</code> with the default
* matching pattern prefix.
*/
public ContextRuleSet() {
this("");
}
/**
* Construct an instance of this <code>RuleSet</code> with the specified
* matching pattern prefix.
*
* @param prefix Prefix for matching pattern rules (including the
* trailing slash character)
*/
public ContextRuleSet(String prefix) {
this(prefix, true);
}
/**
* Construct an instance of this <code>RuleSet</code> with the specified
* matching pattern prefix.
*
* @param prefix Prefix for matching pattern rules (including the
* trailing slash character)
* @param create <code>true</code> if the main context instance should be
* created
*/
public ContextRuleSet(String prefix, boolean create) {
this.prefix = prefix;
this.create = create;
}
// --------------------------------------------------------- Public Methods
/**
* <p>Add the set of Rule instances defined in this RuleSet to the
* specified <code>Digester</code> instance, associating them with
* our namespace URI (if any). This method should only be called
* by a Digester instance.</p>
*
* @param digester Digester instance to which the new Rule instances
* should be added.
*/
@Override
public void addRuleInstances(Digester digester) {
if (create) {
digester.addObjectCreate(prefix + "Context",
"org.apache.catalina.core.StandardContext", "className");
digester.addSetProperties(prefix + "Context");
} else {
digester.addRule(prefix + "Context", new SetContextPropertiesRule());
}
if (create) {
digester.addRule(prefix + "Context",
new LifecycleListenerRule
("org.apache.catalina.startup.ContextConfig",
"configClass"));
digester.addSetNext(prefix + "Context",
"addChild",
"org.apache.catalina.Container");
}
digester.addObjectCreate(prefix + "Context/Listener",
null, // MUST be specified in the element
"className");
digester.addSetProperties(prefix + "Context/Listener");
digester.addSetNext(prefix + "Context/Listener",
"addLifecycleListener",
"org.apache.catalina.LifecycleListener");
digester.addObjectCreate(prefix + "Context/Loader",
"org.apache.catalina.loader.WebappLoader",
"className");
digester.addSetProperties(prefix + "Context/Loader");
digester.addSetNext(prefix + "Context/Loader",
"setLoader",
"org.apache.catalina.Loader");
digester.addObjectCreate(prefix + "Context/Manager",
"org.apache.catalina.session.StandardManager",
"className");
digester.addSetProperties(prefix + "Context/Manager");
digester.addSetNext(prefix + "Context/Manager",
"setManager",
"org.apache.catalina.Manager");
digester.addObjectCreate(prefix + "Context/Manager/Store",
null, // MUST be specified in the element
"className");
digester.addSetProperties(prefix + "Context/Manager/Store");
digester.addSetNext(prefix + "Context/Manager/Store",
"setStore",
"org.apache.catalina.Store");
digester.addObjectCreate(prefix + "Context/Manager/SessionIdGenerator",
"org.apache.catalina.util.StandardSessionIdGenerator",
"className");
digester.addSetProperties(prefix + "Context/Manager/SessionIdGenerator");
digester.addSetNext(prefix + "Context/Manager/SessionIdGenerator",
"setSessionIdGenerator",
"org.apache.catalina.SessionIdGenerator");
digester.addObjectCreate(prefix + "Context/Parameter",
"org.apache.tomcat.util.descriptor.web.ApplicationParameter");
digester.addSetProperties(prefix + "Context/Parameter");
digester.addSetNext(prefix + "Context/Parameter",
"addApplicationParameter",
"org.apache.tomcat.util.descriptor.web.ApplicationParameter");
digester.addRuleSet(new RealmRuleSet(prefix + "Context/"));
digester.addObjectCreate(prefix + "Context/Resources",
"org.apache.catalina.webresources.StandardRoot",
"className");
digester.addSetProperties(prefix + "Context/Resources");
digester.addSetNext(prefix + "Context/Resources",
"setResources",
"org.apache.catalina.WebResourceRoot");
digester.addObjectCreate(prefix + "Context/Resources/PreResources",
null, // MUST be specified in the element
"className");
digester.addSetProperties(prefix + "Context/Resources/PreResources");
digester.addSetNext(prefix + "Context/Resources/PreResources",
"addPreResources",
"org.apache.catalina.WebResourceSet");
digester.addObjectCreate(prefix + "Context/Resources/JarResources",
null, // MUST be specified in the element
"className");
digester.addSetProperties(prefix + "Context/Resources/JarResources");
digester.addSetNext(prefix + "Context/Resources/JarResources",
"addJarResources",
"org.apache.catalina.WebResourceSet");
digester.addObjectCreate(prefix + "Context/Resources/PostResources",
null, // MUST be specified in the element
"className");
digester.addSetProperties(prefix + "Context/Resources/PostResources");
digester.addSetNext(prefix + "Context/Resources/PostResources",
"addPostResources",
"org.apache.catalina.WebResourceSet");
digester.addObjectCreate(prefix + "Context/ResourceLink",
"org.apache.tomcat.util.descriptor.web.ContextResourceLink");
digester.addSetProperties(prefix + "Context/ResourceLink");
digester.addRule(prefix + "Context/ResourceLink",
new SetNextNamingRule("addResourceLink",
"org.apache.tomcat.util.descriptor.web.ContextResourceLink"));
digester.addObjectCreate(prefix + "Context/Valve",
null, // MUST be specified in the element
"className");
digester.addSetProperties(prefix + "Context/Valve");
digester.addSetNext(prefix + "Context/Valve",
"addValve",
"org.apache.catalina.Valve");
digester.addCallMethod(prefix + "Context/WatchedResource",
"addWatchedResource", 0);
digester.addCallMethod(prefix + "Context/WrapperLifecycle",
"addWrapperLifecycle", 0);
digester.addCallMethod(prefix + "Context/WrapperListener",
"addWrapperListener", 0);
digester.addObjectCreate(prefix + "Context/JarScanner",
"org.apache.tomcat.util.scan.StandardJarScanner",
"className");
digester.addSetProperties(prefix + "Context/JarScanner");
digester.addSetNext(prefix + "Context/JarScanner",
"setJarScanner",
"org.apache.tomcat.JarScanner");
digester.addObjectCreate(prefix + "Context/JarScanner/JarScanFilter",
"org.apache.tomcat.util.scan.StandardJarScanFilter",
"className");
digester.addSetProperties(prefix + "Context/JarScanner/JarScanFilter");
digester.addSetNext(prefix + "Context/JarScanner/JarScanFilter",
"setJarScanFilter",
"org.apache.tomcat.JarScanFilter");
digester.addObjectCreate(prefix + "Context/CookieProcessor",
"org.apache.tomcat.util.http.Rfc6265CookieProcessor",
"className");
digester.addSetProperties(prefix + "Context/CookieProcessor");
digester.addSetNext(prefix + "Context/CookieProcessor",
"setCookieProcessor",
"org.apache.tomcat.util.http.CookieProcessor");
}
}

View File

@@ -0,0 +1,77 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import java.lang.reflect.Method;
import org.apache.catalina.Container;
import org.apache.tomcat.util.digester.Rule;
import org.xml.sax.Attributes;
/**
* <p>Rule that copies the <code>parentClassLoader</code> property from the
* next-to-top item on the stack (which must be a <code>Container</code>)
* to the top item on the stack (which must also be a
* <code>Container</code>).</p>
*
* @author Craig R. McClanahan
*/
public class CopyParentClassLoaderRule extends Rule {
// ----------------------------------------------------------- Constructors
/**
* Construct a new instance of this Rule.
*/
public CopyParentClassLoaderRule() {
}
// --------------------------------------------------------- Public Methods
/**
* Handle the beginning of an XML element.
*
* @param attributes The attributes of this element
*
* @exception Exception if a processing error occurs
*/
@Override
public void begin(String namespace, String name, Attributes attributes)
throws Exception {
if (digester.getLogger().isDebugEnabled())
digester.getLogger().debug("Copying parent class loader");
Container child = (Container) digester.peek(0);
Object parent = digester.peek(1);
Method method =
parent.getClass().getMethod("getParentClassLoader", new Class[0]);
ClassLoader classLoader =
(ClassLoader) method.invoke(parent, new Object[0]);
child.setParentClassLoader(classLoader);
}
}

View File

@@ -0,0 +1,100 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import org.apache.tomcat.util.digester.Digester;
import org.apache.tomcat.util.digester.RuleSetBase;
/**
* <p><strong>RuleSet</strong> for processing the contents of a
* CredentialHandler definition element. This <code>RuleSet</code> supports
* CredentialHandler such as the <code>NestedCredentialHandler</code> that used
* nested CredentialHandlers.</p>
*/
@SuppressWarnings("deprecation")
public class CredentialHandlerRuleSet extends RuleSetBase {
private static final int MAX_NESTED_LEVELS = Integer.getInteger(
"org.apache.catalina.startup.CredentialHandlerRuleSet.MAX_NESTED_LEVELS",
3).intValue();
// ----------------------------------------------------- Instance Variables
/**
* The matching pattern prefix to use for recognizing our elements.
*/
protected final String prefix;
// ------------------------------------------------------------ Constructor
/**
* Construct an instance of this <code>RuleSet</code> with the default
* matching pattern prefix.
*/
public CredentialHandlerRuleSet() {
this("");
}
/**
* Construct an instance of this <code>RuleSet</code> with the specified
* matching pattern prefix.
*
* @param prefix Prefix for matching pattern rules (including the
* trailing slash character)
*/
public CredentialHandlerRuleSet(String prefix) {
this.prefix = prefix;
}
// --------------------------------------------------------- Public Methods
/**
* <p>Add the set of Rule instances defined in this RuleSet to the
* specified <code>Digester</code> instance, associating them with
* our namespace URI (if any). This method should only be called
* by a Digester instance.</p>
*
* @param digester Digester instance to which the new Rule instances
* should be added.
*/
@Override
public void addRuleInstances(Digester digester) {
StringBuilder pattern = new StringBuilder(prefix);
for (int i = 0; i < MAX_NESTED_LEVELS; i++) {
if (i > 0) {
pattern.append('/');
}
pattern.append("CredentialHandler");
addRuleInstances(digester, pattern.toString(), i == 0 ? "setCredentialHandler"
: "addCredentialHandler");
}
}
private void addRuleInstances(Digester digester, String pattern, String methodName) {
digester.addObjectCreate(pattern, null /* MUST be specified in the element */,
"className");
digester.addSetProperties(pattern);
digester.addSetNext(pattern, methodName, "org.apache.catalina.CredentialHandler");
}
}

View File

@@ -0,0 +1,112 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import org.apache.catalina.Engine;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleListener;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.tomcat.util.res.StringManager;
/**
* Startup event listener for a <b>Engine</b> that configures the properties
* of that Engine, and the associated defined contexts.
*
* @author Craig R. McClanahan
*/
public class EngineConfig
implements LifecycleListener {
private static final Log log = LogFactory.getLog(EngineConfig.class);
// ----------------------------------------------------- Instance Variables
/**
* The Engine we are associated with.
*/
protected Engine engine = null;
/**
* The string resources for this package.
*/
protected static final StringManager sm =
StringManager.getManager(Constants.Package);
// --------------------------------------------------------- Public Methods
/**
* Process the START event for an associated Engine.
*
* @param event The lifecycle event that has occurred
*/
@Override
public void lifecycleEvent(LifecycleEvent event) {
// Identify the engine we are associated with
try {
engine = (Engine) event.getLifecycle();
} catch (ClassCastException e) {
log.error(sm.getString("engineConfig.cce", event.getLifecycle()), e);
return;
}
// Process the event that has occurred
if (event.getType().equals(Lifecycle.START_EVENT))
start();
else if (event.getType().equals(Lifecycle.STOP_EVENT))
stop();
}
// -------------------------------------------------------- Protected Methods
/**
* Process a "start" event for this Engine.
*/
protected void start() {
if (engine.getLogger().isDebugEnabled())
engine.getLogger().debug(sm.getString("engineConfig.start"));
}
/**
* Process a "stop" event for this Engine.
*/
protected void stop() {
if (engine.getLogger().isDebugEnabled())
engine.getLogger().debug(sm.getString("engineConfig.stop"));
}
}

View File

@@ -0,0 +1,130 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import org.apache.tomcat.util.digester.Digester;
import org.apache.tomcat.util.digester.RuleSetBase;
/**
* <p><strong>RuleSet</strong> for processing the contents of a
* Engine definition element. This <code>RuleSet</code> does NOT include
* any rules for nested Host elements, which should be added via instances of
* <code>HostRuleSet</code>.</p>
*
* @author Craig R. McClanahan
*/
@SuppressWarnings("deprecation")
public class EngineRuleSet extends RuleSetBase {
// ----------------------------------------------------- Instance Variables
/**
* The matching pattern prefix to use for recognizing our elements.
*/
protected final String prefix;
// ------------------------------------------------------------ Constructor
/**
* Construct an instance of this <code>RuleSet</code> with the default
* matching pattern prefix.
*/
public EngineRuleSet() {
this("");
}
/**
* Construct an instance of this <code>RuleSet</code> with the specified
* matching pattern prefix.
*
* @param prefix Prefix for matching pattern rules (including the
* trailing slash character)
*/
public EngineRuleSet(String prefix) {
this.prefix = prefix;
}
// --------------------------------------------------------- Public Methods
/**
* <p>Add the set of Rule instances defined in this RuleSet to the
* specified <code>Digester</code> instance, associating them with
* our namespace URI (if any). This method should only be called
* by a Digester instance.</p>
*
* @param digester Digester instance to which the new Rule instances
* should be added.
*/
@Override
public void addRuleInstances(Digester digester) {
digester.addObjectCreate(prefix + "Engine",
"org.apache.catalina.core.StandardEngine",
"className");
digester.addSetProperties(prefix + "Engine");
digester.addRule(prefix + "Engine",
new LifecycleListenerRule
("org.apache.catalina.startup.EngineConfig",
"engineConfigClass"));
digester.addSetNext(prefix + "Engine",
"setContainer",
"org.apache.catalina.Engine");
//Cluster configuration start
digester.addObjectCreate(prefix + "Engine/Cluster",
null, // MUST be specified in the element
"className");
digester.addSetProperties(prefix + "Engine/Cluster");
digester.addSetNext(prefix + "Engine/Cluster",
"setCluster",
"org.apache.catalina.Cluster");
//Cluster configuration end
digester.addObjectCreate(prefix + "Engine/Listener",
null, // MUST be specified in the element
"className");
digester.addSetProperties(prefix + "Engine/Listener");
digester.addSetNext(prefix + "Engine/Listener",
"addLifecycleListener",
"org.apache.catalina.LifecycleListener");
digester.addRuleSet(new RealmRuleSet(prefix + "Engine/"));
digester.addObjectCreate(prefix + "Engine/Valve",
null, // MUST be specified in the element
"className");
digester.addSetProperties(prefix + "Engine/Valve");
digester.addSetNext(prefix + "Engine/Valve",
"addValve",
"org.apache.catalina.Valve");
}
}

View File

@@ -0,0 +1,402 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.JarURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.nio.channels.FileChannel;
import java.util.Enumeration;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.zip.ZipException;
import org.apache.catalina.Host;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.tomcat.util.res.StringManager;
/**
* Expand out a WAR in a Host's appBase.
*
* @author Craig R. McClanahan
* @author Remy Maucherat
* @author Glenn L. Nielsen
*/
public class ExpandWar {
private static final Log log = LogFactory.getLog(ExpandWar.class);
/**
* The string resources for this package.
*/
protected static final StringManager sm =
StringManager.getManager(Constants.Package);
/**
* Expand the WAR file found at the specified URL into an unpacked
* directory structure.
*
* @param host Host war is being installed for
* @param war URL of the web application archive to be expanded
* (must start with "jar:")
* @param pathname Context path name for web application
*
* @exception IllegalArgumentException if this is not a "jar:" URL or if the
* WAR file is invalid
* @exception IOException if an input/output error was encountered
* during expansion
*
* @return The absolute path to the expanded directory foe the given WAR
*/
public static String expand(Host host, URL war, String pathname)
throws IOException {
/* Obtaining the last modified time opens an InputStream and there is no
* explicit close method. We have to obtain and then close the
* InputStream to avoid a file leak and the associated locked file.
*/
JarURLConnection juc = (JarURLConnection) war.openConnection();
juc.setUseCaches(false);
URL jarFileUrl = juc.getJarFileURL();
URLConnection jfuc = jarFileUrl.openConnection();
boolean success = false;
File docBase = new File(host.getAppBaseFile(), pathname);
File warTracker = new File(host.getAppBaseFile(), pathname + Constants.WarTracker);
long warLastModified = -1;
try (InputStream is = jfuc.getInputStream()) {
// Get the last modified time for the WAR
warLastModified = jfuc.getLastModified();
}
// Check to see of the WAR has been expanded previously
if (docBase.exists()) {
// A WAR was expanded. Tomcat will have set the last modified
// time of warTracker file to the last modified time of the WAR so
// changes to the WAR while Tomcat is stopped can be detected
if (!warTracker.exists() || warTracker.lastModified() == warLastModified) {
// No (detectable) changes to the WAR
success = true;
return docBase.getAbsolutePath();
}
// WAR must have been modified. Remove expanded directory.
log.info(sm.getString("expandWar.deleteOld", docBase));
if (!delete(docBase)) {
throw new IOException(sm.getString("expandWar.deleteFailed", docBase));
}
}
// Create the new document base directory
if(!docBase.mkdir() && !docBase.isDirectory()) {
throw new IOException(sm.getString("expandWar.createFailed", docBase));
}
// Expand the WAR into the new document base directory
String canonicalDocBasePrefix = docBase.getCanonicalPath();
if (!canonicalDocBasePrefix.endsWith(File.separator)) {
canonicalDocBasePrefix += File.separator;
}
// Creating war tracker parent (normally META-INF)
File warTrackerParent = warTracker.getParentFile();
if (!warTrackerParent.isDirectory() && !warTrackerParent.mkdirs()) {
throw new IOException(sm.getString("expandWar.createFailed", warTrackerParent.getAbsolutePath()));
}
try (JarFile jarFile = juc.getJarFile()) {
Enumeration<JarEntry> jarEntries = jarFile.entries();
while (jarEntries.hasMoreElements()) {
JarEntry jarEntry = jarEntries.nextElement();
String name = jarEntry.getName();
File expandedFile = new File(docBase, name);
if (!expandedFile.getCanonicalPath().startsWith(
canonicalDocBasePrefix)) {
// Trying to expand outside the docBase
// Throw an exception to stop the deployment
throw new IllegalArgumentException(
sm.getString("expandWar.illegalPath",war, name,
expandedFile.getCanonicalPath(),
canonicalDocBasePrefix));
}
int last = name.lastIndexOf('/');
if (last >= 0) {
File parent = new File(docBase,
name.substring(0, last));
if (!parent.mkdirs() && !parent.isDirectory()) {
throw new IOException(
sm.getString("expandWar.createFailed", parent));
}
}
if (name.endsWith("/")) {
continue;
}
try (InputStream input = jarFile.getInputStream(jarEntry)) {
if (null == input) {
throw new ZipException(sm.getString("expandWar.missingJarEntry",
jarEntry.getName()));
}
// Bugzilla 33636
expand(input, expandedFile);
long lastModified = jarEntry.getTime();
if ((lastModified != -1) && (lastModified != 0)) {
if (!expandedFile.setLastModified(lastModified)) {
throw new IOException(
sm.getString("expandWar.lastModifiedFailed", expandedFile));
}
}
}
}
// Create the warTracker file and align the last modified time
// with the last modified time of the WAR
if (!warTracker.createNewFile()) {
throw new IOException(sm.getString("expandWar.createFileFailed", warTracker));
}
if (!warTracker.setLastModified(warLastModified)) {
throw new IOException(sm.getString("expandWar.lastModifiedFailed", warTracker));
}
success = true;
} catch (IOException e) {
throw e;
} finally {
if (!success) {
// If something went wrong, delete expanded dir to keep things
// clean
deleteDir(docBase);
}
}
// Return the absolute path to our new document base directory
return docBase.getAbsolutePath();
}
/**
* Validate the WAR file found at the specified URL.
*
* @param host Host war is being installed for
* @param war URL of the web application archive to be validated
* (must start with "jar:")
* @param pathname Context path name for web application
*
* @exception IllegalArgumentException if this is not a "jar:" URL or if the
* WAR file is invalid
* @exception IOException if an input/output error was encountered
* during validation
*/
public static void validate(Host host, URL war, String pathname) throws IOException {
File docBase = new File(host.getAppBaseFile(), pathname);
// Calculate the document base directory
String canonicalDocBasePrefix = docBase.getCanonicalPath();
if (!canonicalDocBasePrefix.endsWith(File.separator)) {
canonicalDocBasePrefix += File.separator;
}
JarURLConnection juc = (JarURLConnection) war.openConnection();
juc.setUseCaches(false);
try (JarFile jarFile = juc.getJarFile()) {
Enumeration<JarEntry> jarEntries = jarFile.entries();
while (jarEntries.hasMoreElements()) {
JarEntry jarEntry = jarEntries.nextElement();
String name = jarEntry.getName();
File expandedFile = new File(docBase, name);
if (!expandedFile.getCanonicalPath().startsWith(
canonicalDocBasePrefix)) {
// Entry located outside the docBase
// Throw an exception to stop the deployment
throw new IllegalArgumentException(
sm.getString("expandWar.illegalPath",war, name,
expandedFile.getCanonicalPath(),
canonicalDocBasePrefix));
}
}
} catch (IOException e) {
throw e;
}
}
/**
* Copy the specified file or directory to the destination.
*
* @param src File object representing the source
* @param dest File object representing the destination
* @return <code>true</code> if the copy was successful
*/
public static boolean copy(File src, File dest) {
boolean result = true;
String files[] = null;
if (src.isDirectory()) {
files = src.list();
result = dest.mkdir();
} else {
files = new String[1];
files[0] = "";
}
if (files == null) {
files = new String[0];
}
for (int i = 0; (i < files.length) && result; i++) {
File fileSrc = new File(src, files[i]);
File fileDest = new File(dest, files[i]);
if (fileSrc.isDirectory()) {
result = copy(fileSrc, fileDest);
} else {
try (FileChannel ic = (new FileInputStream(fileSrc)).getChannel();
FileChannel oc = (new FileOutputStream(fileDest)).getChannel()) {
ic.transferTo(0, ic.size(), oc);
} catch (IOException e) {
log.error(sm.getString("expandWar.copy", fileSrc, fileDest), e);
result = false;
}
}
}
return result;
}
/**
* Delete the specified directory, including all of its contents and
* sub-directories recursively. Any failure will be logged.
*
* @param dir File object representing the directory to be deleted
* @return <code>true</code> if the deletion was successful
*/
public static boolean delete(File dir) {
// Log failure by default
return delete(dir, true);
}
/**
* Delete the specified directory, including all of its contents and
* sub-directories recursively.
*
* @param dir File object representing the directory to be deleted
* @param logFailure <code>true</code> if failure to delete the resource
* should be logged
* @return <code>true</code> if the deletion was successful
*/
public static boolean delete(File dir, boolean logFailure) {
boolean result;
if (dir.isDirectory()) {
result = deleteDir(dir, logFailure);
} else {
if (dir.exists()) {
result = dir.delete();
} else {
result = true;
}
}
if (logFailure && !result) {
log.error(sm.getString(
"expandWar.deleteFailed", dir.getAbsolutePath()));
}
return result;
}
/**
* Delete the specified directory, including all of its contents and
* sub-directories recursively. Any failure will be logged.
*
* @param dir File object representing the directory to be deleted
* @return <code>true</code> if the deletion was successful
*/
public static boolean deleteDir(File dir) {
return deleteDir(dir, true);
}
/**
* Delete the specified directory, including all of its contents and
* sub-directories recursively.
*
* @param dir File object representing the directory to be deleted
* @param logFailure <code>true</code> if failure to delete the resource
* should be logged
* @return <code>true</code> if the deletion was successful
*/
public static boolean deleteDir(File dir, boolean logFailure) {
String files[] = dir.list();
if (files == null) {
files = new String[0];
}
for (int i = 0; i < files.length; i++) {
File file = new File(dir, files[i]);
if (file.isDirectory()) {
deleteDir(file, logFailure);
} else {
file.delete();
}
}
boolean result;
if (dir.exists()) {
result = dir.delete();
} else {
result = true;
}
if (logFailure && !result) {
log.error(sm.getString(
"expandWar.deleteFailed", dir.getAbsolutePath()));
}
return result;
}
/**
* Expand the specified input stream into the specified file.
*
* @param input InputStream to be copied
* @param file The file to be created
*
* @exception IOException if an input/output error occurs
*/
private static void expand(InputStream input, File file) throws IOException {
try (BufferedOutputStream output =
new BufferedOutputStream(new FileOutputStream(file))) {
byte buffer[] = new byte[2048];
while (true) {
int n = input.read(buffer);
if (n <= 0)
break;
output.write(buffer, 0, n);
}
}
}
}

View File

@@ -0,0 +1,829 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.net.URL;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import javax.servlet.ServletContainerInitializer;
import javax.servlet.ServletContext;
import javax.servlet.ServletRegistration;
import javax.servlet.ServletRequest;
import javax.servlet.ServletSecurityElement;
import javax.servlet.descriptor.JspConfigDescriptor;
import org.apache.catalina.AccessLog;
import org.apache.catalina.Authenticator;
import org.apache.catalina.Cluster;
import org.apache.catalina.Container;
import org.apache.catalina.ContainerListener;
import org.apache.catalina.Context;
import org.apache.catalina.Engine;
import org.apache.catalina.Host;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.Loader;
import org.apache.catalina.Manager;
import org.apache.catalina.Pipeline;
import org.apache.catalina.Realm;
import org.apache.catalina.ThreadBindingListener;
import org.apache.catalina.Valve;
import org.apache.catalina.WebResourceRoot;
import org.apache.catalina.Wrapper;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
import org.apache.catalina.deploy.NamingResourcesImpl;
import org.apache.catalina.util.ContextName;
import org.apache.catalina.util.LifecycleMBeanBase;
import org.apache.juli.logging.Log;
import org.apache.tomcat.InstanceManager;
import org.apache.tomcat.JarScanner;
import org.apache.tomcat.util.descriptor.web.ApplicationParameter;
import org.apache.tomcat.util.descriptor.web.ErrorPage;
import org.apache.tomcat.util.descriptor.web.FilterDef;
import org.apache.tomcat.util.descriptor.web.FilterMap;
import org.apache.tomcat.util.descriptor.web.LoginConfig;
import org.apache.tomcat.util.descriptor.web.SecurityConstraint;
import org.apache.tomcat.util.http.CookieProcessor;
import org.apache.tomcat.util.res.StringManager;
/**
* An implementation of {@link Context} that is used as a place-holder for
* deployed applications when their deployment fails and a Context instance
* (usually {@link org.apache.catalina.core.StandardContext} but may be any
* Context implementation) cannot be created.
*/
public class FailedContext extends LifecycleMBeanBase implements Context {
protected static final StringManager sm =
StringManager.getManager(Constants.Package);
// --------------------- Methods that need to work even for a failed context
private URL configFile;
@Override
public URL getConfigFile() { return configFile; }
@Override
public void setConfigFile(URL configFile) { this.configFile = configFile; }
private String docBase;
@Override
public String getDocBase() { return docBase; }
@Override
public void setDocBase(String docBase) { this.docBase = docBase; }
private String name = null;
@Override
public String getName() { return name; }
@Override
public void setName(String name) { this.name = name; }
private Container parent;
@Override
public Container getParent() { return parent; }
@Override
public void setParent(Container parent) { this.parent = parent; }
private String path = null;
@Override
public String getPath() { return path; }
@Override
public void setPath(String path) { this.path = path; }
private String webappVersion = null;
@Override
public String getWebappVersion() { return webappVersion; }
@Override
public void setWebappVersion(String webappVersion) {
this.webappVersion = webappVersion;
}
@Override
protected String getDomainInternal() {
Container p = getParent();
if (p == null) {
return null;
} else {
return p.getDomain();
}
}
@Override
public String getMBeanKeyProperties() {
Container c = this;
StringBuilder keyProperties = new StringBuilder();
int containerCount = 0;
// Work up container hierarchy, add a component to the name for
// each container
while (!(c instanceof Engine)) {
if (c instanceof Context) {
keyProperties.append(",context=");
ContextName cn = new ContextName(c.getName(), false);
keyProperties.append(cn.getDisplayName());
} else if (c instanceof Host) {
keyProperties.append(",host=");
keyProperties.append(c.getName());
} else if (c == null) {
// May happen in unit testing and/or some embedding scenarios
keyProperties.append(",container");
keyProperties.append(containerCount++);
keyProperties.append("=null");
break;
} else {
// Should never happen...
keyProperties.append(",container");
keyProperties.append(containerCount++);
keyProperties.append('=');
keyProperties.append(c.getName());
}
c = c.getParent();
}
return keyProperties.toString();
}
@Override
protected String getObjectNameKeyProperties() {
StringBuilder keyProperties =
new StringBuilder("j2eeType=WebModule,name=//");
String hostname = getParent().getName();
if (hostname == null) {
keyProperties.append("DEFAULT");
} else {
keyProperties.append(hostname);
}
String contextName = getName();
if (!contextName.startsWith("/")) {
keyProperties.append('/');
}
keyProperties.append(contextName);
keyProperties.append(",J2EEApplication=none,J2EEServer=none");
return keyProperties.toString();
}
@Override
protected void startInternal() throws LifecycleException {
throw new LifecycleException(
sm.getString("failedContext.start", getName()));
}
@Override
protected void stopInternal() throws LifecycleException {
// NO-OP
// Allow stop to complete since it is used for clean-up
}
// Only need to read these
@Override
public void addWatchedResource(String name) { /* NO-OP */ }
@Override
public String[] findWatchedResources() { return new String[0]; }
@Override
public void removeWatchedResource(String name) { /* NO-OP */ }
@Override
public void addChild(Container child) { /* NO-OP */ }
@Override
public Container findChild(String name) { return null; }
@Override
public Container[] findChildren() { return new Container[0]; }
@Override
public void removeChild(Container child) { /* NO-OP */ }
@Override
public String toString() {
return getName();
}
// -------------------------------------------- All NO-OPs beyond this point
@Override
public Loader getLoader() { return null; }
@Override
public void setLoader(Loader loader) { /* NO-OP */ }
@Override
public Log getLogger() { return null; }
@Override
public String getLogName() { return null; }
@Override
public Manager getManager() { return null; }
@Override
public void setManager(Manager manager) { /* NO-OP */ }
@Override
public Pipeline getPipeline() { return null; }
@Override
public Cluster getCluster() { return null; }
@Override
public void setCluster(Cluster cluster) { /* NO-OP */ }
@Override
public int getBackgroundProcessorDelay() { return -1; }
@Override
public void setBackgroundProcessorDelay(int delay) { /* NO-OP */ }
@Override
public ClassLoader getParentClassLoader() { return null; }
@Override
public void setParentClassLoader(ClassLoader parent) { /* NO-OP */ }
@Override
public Realm getRealm() { return null; }
@Override
public void setRealm(Realm realm) { /* NO-OP */ }
@Override
public WebResourceRoot getResources() { return null; }
@Override
public void setResources(WebResourceRoot resources) { /* NO-OP */ }
@Override
public void backgroundProcess() { /* NO-OP */ }
@Override
public void addContainerListener(ContainerListener listener) { /* NO-OP */ }
@Override
public ContainerListener[] findContainerListeners() { return null; }
@Override
public void removeContainerListener(ContainerListener listener) { /* NO-OP */ }
@Override
public void addPropertyChangeListener(PropertyChangeListener listener) { /* NO-OP */ }
@Override
public void removePropertyChangeListener(PropertyChangeListener listener) { /* NO-OP */ }
@Override
public void fireContainerEvent(String type, Object data) { /* NO-OP */ }
@Override
public void logAccess(Request request, Response response, long time,
boolean useDefault) { /* NO-OP */ }
@Override
public AccessLog getAccessLog() { return null; }
@Override
public int getStartStopThreads() { return 0; }
@Override
public void setStartStopThreads(int startStopThreads) { /* NO-OP */ }
@Override
public boolean getAllowCasualMultipartParsing() { return false; }
@Override
public void setAllowCasualMultipartParsing(
boolean allowCasualMultipartParsing) { /* NO-OP */ }
@Override
public Object[] getApplicationEventListeners() { return null; }
@Override
public void setApplicationEventListeners(Object[] listeners) { /* NO-OP */ }
@Override
public Object[] getApplicationLifecycleListeners() { return null; }
@Override
public void setApplicationLifecycleListeners(Object[] listeners) { /* NO-OP */ }
@Override
public String getCharset(Locale locale) { return null; }
@Override
public boolean getConfigured() { return false; }
@Override
public void setConfigured(boolean configured) { /* NO-OP */ }
@Override
public boolean getCookies() { return false; }
@Override
public void setCookies(boolean cookies) { /* NO-OP */ }
@Override
public String getSessionCookieName() { return null; }
@Override
public void setSessionCookieName(String sessionCookieName) { /* NO-OP */ }
@Override
public boolean getUseHttpOnly() { return false; }
@Override
public void setUseHttpOnly(boolean useHttpOnly) { /* NO-OP */ }
@Override
public String getSessionCookieDomain() { return null; }
@Override
public void setSessionCookieDomain(String sessionCookieDomain) { /* NO-OP */ }
@Override
public String getSessionCookiePath() { return null; }
@Override
public void setSessionCookiePath(String sessionCookiePath) { /* NO-OP */ }
@Override
public boolean getSessionCookiePathUsesTrailingSlash() { return false; }
@Override
public void setSessionCookiePathUsesTrailingSlash(
boolean sessionCookiePathUsesTrailingSlash) { /* NO-OP */ }
@Override
public boolean getCrossContext() { return false; }
@Override
public void setCrossContext(boolean crossContext) { /* NO-OP */ }
@Override
public String getAltDDName() { return null; }
@Override
public void setAltDDName(String altDDName) { /* NO-OP */ }
@Override
public boolean getDenyUncoveredHttpMethods() { return false; }
@Override
public void setDenyUncoveredHttpMethods(boolean denyUncoveredHttpMethods) {
// NO-OP
}
@Override
public String getDisplayName() { return null; }
@Override
public void setDisplayName(String displayName) { /* NO-OP */ }
@Override
public boolean getDistributable() { return false; }
@Override
public void setDistributable(boolean distributable) { /* NO-OP */ }
@Override
public String getEncodedPath() { return null; }
@Override
public boolean getIgnoreAnnotations() { return false; }
@Override
public void setIgnoreAnnotations(boolean ignoreAnnotations) { /* NO-OP */ }
@Override
public LoginConfig getLoginConfig() { return null; }
@Override
public void setLoginConfig(LoginConfig config) { /* NO-OP */ }
@Override
public NamingResourcesImpl getNamingResources() { return null; }
@Override
public void setNamingResources(NamingResourcesImpl namingResources) { /* NO-OP */ }
@Override
public String getPublicId() { return null; }
@Override
public void setPublicId(String publicId) { /* NO-OP */ }
@Override
public boolean getReloadable() { return false; }
@Override
public void setReloadable(boolean reloadable) { /* NO-OP */ }
@Override
public boolean getOverride() { return false; }
@Override
public void setOverride(boolean override) { /* NO-OP */ }
@Override
public boolean getPrivileged() { return false; }
@Override
public void setPrivileged(boolean privileged) { /* NO-OP */ }
@Override
public ServletContext getServletContext() { return null; }
@Override
public int getSessionTimeout() { return 0; }
@Override
public void setSessionTimeout(int timeout) { /* NO-OP */ }
@Override
public boolean getSwallowAbortedUploads() { return false; }
@Override
public void setSwallowAbortedUploads(boolean swallowAbortedUploads) { /* NO-OP */ }
@Override
public boolean getSwallowOutput() { return false; }
@Override
public void setSwallowOutput(boolean swallowOutput) { /* NO-OP */ }
@Override
public String getWrapperClass() { return null; }
@Override
public void setWrapperClass(String wrapperClass) { /* NO-OP */ }
@Override
public boolean getXmlNamespaceAware() { return false; }
@Override
public void setXmlNamespaceAware(boolean xmlNamespaceAware) { /* NO-OP */ }
@Override
public boolean getXmlValidation() { return false; }
@Override
public void setXmlValidation(boolean xmlValidation) { /* NO-OP */ }
@Override
public boolean getXmlBlockExternal() { return true; }
@Override
public void setXmlBlockExternal(boolean xmlBlockExternal) { /* NO-OP */ }
@Override
public boolean getTldValidation() { return false; }
@Override
public void setTldValidation(boolean tldValidation){ /* NO-OP */ }
@Override
public JarScanner getJarScanner() { return null; }
@Override
public void setJarScanner(JarScanner jarScanner) { /* NO-OP */ }
@Override
public Authenticator getAuthenticator() { return null; }
@Override
public void setLogEffectiveWebXml(boolean logEffectiveWebXml) { /* NO-OP */ }
@Override
public boolean getLogEffectiveWebXml() { return false; }
@Override
public void addApplicationListener(String listener) { /* NO-OP */ }
@Override
public String[] findApplicationListeners() { return null; }
@Override
public void removeApplicationListener(String listener) { /* NO-OP */ }
@Override
public void addApplicationParameter(ApplicationParameter parameter) { /* NO-OP */ }
@Override
public ApplicationParameter[] findApplicationParameters() { return null; }
@Override
public void removeApplicationParameter(String name) { /* NO-OP */ }
@Override
public void addConstraint(SecurityConstraint constraint) { /* NO-OP */ }
@Override
public SecurityConstraint[] findConstraints() { return null; }
@Override
public void removeConstraint(SecurityConstraint constraint) { /* NO-OP */ }
@Override
public void addErrorPage(ErrorPage errorPage) { /* NO-OP */ }
@Override
public ErrorPage findErrorPage(int errorCode) { return null; }
@Override
public ErrorPage findErrorPage(String exceptionType) { return null; }
@Override
public ErrorPage findErrorPage(Throwable throwable) { return null; }
@Override
public ErrorPage[] findErrorPages() { return null; }
@Override
public void removeErrorPage(ErrorPage errorPage) { /* NO-OP */ }
@Override
public void addFilterDef(FilterDef filterDef) { /* NO-OP */ }
@Override
public FilterDef findFilterDef(String filterName) { return null; }
@Override
public FilterDef[] findFilterDefs() { return null; }
@Override
public void removeFilterDef(FilterDef filterDef) { /* NO-OP */ }
@Override
public void addFilterMap(FilterMap filterMap) { /* NO-OP */ }
@Override
public void addFilterMapBefore(FilterMap filterMap) { /* NO-OP */ }
@Override
public FilterMap[] findFilterMaps() { return null; }
@Override
public void removeFilterMap(FilterMap filterMap) { /* NO-OP */ }
@Override
public void addLocaleEncodingMappingParameter(String locale, String encoding) { /* NO-OP */ }
@Override
public void addMimeMapping(String extension, String mimeType) { /* NO-OP */ }
@Override
public String findMimeMapping(String extension) { return null; }
@Override
public String[] findMimeMappings() { return null; }
@Override
public void removeMimeMapping(String extension) { /* NO-OP */ }
@Override
public void addParameter(String name, String value) { /* NO-OP */ }
@Override
public String findParameter(String name) { return null; }
@Override
public String[] findParameters() { return null; }
@Override
public void removeParameter(String name) { /* NO-OP */ }
@Override
public void addRoleMapping(String role, String link) { /* NO-OP */ }
@Override
public String findRoleMapping(String role) { return null; }
@Override
public void removeRoleMapping(String role) { /* NO-OP */ }
@Override
public void addSecurityRole(String role) { /* NO-OP */ }
@Override
public boolean findSecurityRole(String role) { return false; }
@Override
public String[] findSecurityRoles() { return null; }
@Override
public void removeSecurityRole(String role) { /* NO-OP */ }
@Override
public void addServletMapping(String pattern, String name) { /* NO-OP */ }
@Override
public void addServletMapping(String pattern, String name,
boolean jspWildcard) { /* NO-OP */ }
@Override
public void addServletMappingDecoded(String pattern, String name) { /* NO-OP */ }
@Override
public void addServletMappingDecoded(String pattern, String name,
boolean jspWildcard) { /* NO-OP */ }
@Override
public String findServletMapping(String pattern) { return null; }
@Override
public String[] findServletMappings() { return null; }
@Override
public void removeServletMapping(String pattern) { /* NO-OP */ }
@Override
public void addWelcomeFile(String name) { /* NO-OP */ }
@Override
public boolean findWelcomeFile(String name) { return false; }
@Override
public String[] findWelcomeFiles() { return null; }
@Override
public void removeWelcomeFile(String name) { /* NO-OP */ }
@Override
public void addWrapperLifecycle(String listener) { /* NO-OP */ }
@Override
public String[] findWrapperLifecycles() { return null; }
@Override
public void removeWrapperLifecycle(String listener) { /* NO-OP */ }
@Override
public void addWrapperListener(String listener) { /* NO-OP */ }
@Override
public String[] findWrapperListeners() { return null; }
@Override
public void removeWrapperListener(String listener) { /* NO-OP */ }
@Override
public Wrapper createWrapper() { return null; }
@Override
public String findStatusPage(int status) { return null; }
@Override
public int[] findStatusPages() { return null; }
@Override
public boolean fireRequestInitEvent(ServletRequest request) { return false; }
@Override
public boolean fireRequestDestroyEvent(ServletRequest request) { return false; }
@Override
public void reload() { /* NO-OP */ }
@Override
public String getRealPath(String path) { return null; }
@Override
public int getEffectiveMajorVersion() { return 0; }
@Override
public void setEffectiveMajorVersion(int major) { /* NO-OP */ }
@Override
public int getEffectiveMinorVersion() { return 0; }
@Override
public void setEffectiveMinorVersion(int minor) { /* NO-OP */ }
@Override
public JspConfigDescriptor getJspConfigDescriptor() { return null; }
@Override
public void setJspConfigDescriptor(JspConfigDescriptor descriptor) { /* NO-OP */ }
@Override
public void addServletContainerInitializer(ServletContainerInitializer sci,
Set<Class<?>> classes) { /* NO-OP */ }
@Override
public boolean getPaused() { return false; }
@Override
public boolean isServlet22() { return false; }
@Override
public Set<String> addServletSecurity(
ServletRegistration.Dynamic registration,
ServletSecurityElement servletSecurityElement) { return null; }
@Override
public void setResourceOnlyServlets(String resourceOnlyServlets) { /* NO-OP */ }
@Override
public String getResourceOnlyServlets() { return null; }
@Override
public boolean isResourceOnlyServlet(String servletName) { return false; }
@Override
public String getBaseName() { return null; }
@Override
public void setFireRequestListenersOnForwards(boolean enable) { /* NO-OP */ }
@Override
public boolean getFireRequestListenersOnForwards() { return false; }
@Override
public void setPreemptiveAuthentication(boolean enable) { /* NO-OP */ }
@Override
public boolean getPreemptiveAuthentication() { return false; }
@Override
public void setSendRedirectBody(boolean enable) { /* NO-OP */ }
@Override
public boolean getSendRedirectBody() { return false; }
@SuppressWarnings("unused")
public synchronized void addValve(Valve valve) { /* NO-OP */ }
@Override
public File getCatalinaBase() { return null; }
@Override
public File getCatalinaHome() { return null; }
@Override
public void setAddWebinfClassesResources(boolean addWebinfClassesResources) {
// NO-OP
}
@Override
public boolean getAddWebinfClassesResources() { return false; }
@Override
public void addPostConstructMethod(String clazz, String method) { /* NO-OP */ }
@Override
public void addPreDestroyMethod(String clazz, String method) { /* NO-OP */ }
@Override
public void removePostConstructMethod(String clazz) { /* NO-OP */ }
@Override
public void removePreDestroyMethod(String clazz) { /* NO-OP */ }
@Override
public String findPostConstructMethod(String clazz) { return null; }
@Override
public String findPreDestroyMethod(String clazz) { return null; }
@Override
public Map<String, String> findPostConstructMethods() { return null; }
@Override
public Map<String, String> findPreDestroyMethods() { return null; }
@Override
public InstanceManager getInstanceManager() { return null; }
@Override
public void setInstanceManager(InstanceManager instanceManager) { /* NO-OP */ }
@Override
public void setContainerSciFilter(String containerSciFilter) { /* NO-OP */ }
@Override
public String getContainerSciFilter() { return null; }
@Override
public ThreadBindingListener getThreadBindingListener() { return null; }
@Override
public void setThreadBindingListener(ThreadBindingListener threadBindingListener) {
// NO-OP
}
@Override
public ClassLoader bind(boolean usePrivilegedAction, ClassLoader originalClassLoader) {
return null;
}
@Override
public void unbind(boolean usePrivilegedAction, ClassLoader originalClassLoader) {
// NO-OP
}
@Override
public Object getNamingToken() { return null; }
@Override
public void setCookieProcessor(CookieProcessor cookieProcessor) { /* NO-OP */ }
@Override
public CookieProcessor getCookieProcessor() { return null; }
@Override
public void setValidateClientProvidedNewSessionId(boolean validateClientProvidedNewSessionId) {
// NO-OP
}
@Override
public boolean getValidateClientProvidedNewSessionId() { return false; }
@Override
public void setMapperContextRootRedirectEnabled(boolean mapperContextRootRedirectEnabled) {
// NO-OP
}
@Override
public boolean getMapperContextRootRedirectEnabled() { return false; }
@Override
public void setMapperDirectoryRedirectEnabled(boolean mapperDirectoryRedirectEnabled) {
// NO-OP
}
@Override
public boolean getMapperDirectoryRedirectEnabled() { return false; }
@Override
public void setUseRelativeRedirects(boolean useRelativeRedirects) { /* NO-OP */ }
@Override
public boolean getUseRelativeRedirects() { return true; }
@Override
public void setDispatchersUseEncodedPaths(boolean dispatchersUseEncodedPaths) { /* NO-OP */ }
@Override
public boolean getDispatchersUseEncodedPaths() { return true; }
@Override
public void setRequestCharacterEncoding(String encoding) { /* NO-OP */ }
@Override
public String getRequestCharacterEncoding() { return null; }
@Override
public void setResponseCharacterEncoding(String encoding) { /* NO-OP */ }
@Override
public String getResponseCharacterEncoding() { return null; }
@Override
public void setAllowMultipleLeadingForwardSlashInPath(
boolean allowMultipleLeadingForwardSlashInPath) {
// NO-OP
}
@Override
public boolean getAllowMultipleLeadingForwardSlashInPath() { return false; }
@Override
public void incrementInProgressAsyncCount() { /* NO-OP */ }
@Override
public void decrementInProgressAsyncCount() { /* NO-OP */ }
@Override
public void setCreateUploadTargets(boolean createUploadTargets) { /* NO-OP */}
@Override
public boolean getCreateUploadTargets() { return false; }
}

View File

@@ -0,0 +1,137 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import java.io.File;
import java.util.Enumeration;
import java.util.Hashtable;
/**
* Concrete implementation of the <code>UserDatabase</code> interface
* considers all directories in a directory whose pathname is specified
* to our constructor to be "home" directories for those users.
*
* @author Craig R. McClanahan
*/
public final class HomesUserDatabase
implements UserDatabase {
// --------------------------------------------------------- Constructors
/**
* Initialize a new instance of this user database component.
*/
public HomesUserDatabase() {
super();
}
// --------------------------------------------------- Instance Variables
/**
* The set of home directories for all defined users, keyed by username.
*/
private final Hashtable<String,String> homes = new Hashtable<>();
/**
* The UserConfig listener with which we are associated.
*/
private UserConfig userConfig = null;
// ----------------------------------------------------------- Properties
/**
* Return the UserConfig listener with which we are associated.
*/
@Override
public UserConfig getUserConfig() {
return this.userConfig;
}
/**
* Set the UserConfig listener with which we are associated.
*
* @param userConfig The new UserConfig listener
*/
@Override
public void setUserConfig(UserConfig userConfig) {
this.userConfig = userConfig;
init();
}
// ------------------------------------------------------- Public Methods
/**
* Return an absolute pathname to the home directory for the specified user.
*
* @param user User for which a home directory should be retrieved
*/
@Override
public String getHome(String user) {
return homes.get(user);
}
/**
* Return an enumeration of the usernames defined on this server.
*/
@Override
public Enumeration<String> getUsers() {
return homes.keys();
}
// ------------------------------------------------------ Private Methods
/**
* Initialize our set of users and home directories.
*/
private void init() {
String homeBase = userConfig.getHomeBase();
File homeBaseDir = new File(homeBase);
if (!homeBaseDir.exists() || !homeBaseDir.isDirectory())
return;
String homeBaseFiles[] = homeBaseDir.list();
if (homeBaseFiles == null) {
return;
}
for (int i = 0; i < homeBaseFiles.length; i++) {
File homeDir = new File(homeBaseDir, homeBaseFiles[i]);
if (!homeDir.isDirectory() || !homeDir.canRead())
continue;
homes.put(homeBaseFiles[i], homeDir.toString());
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,134 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import org.apache.tomcat.util.digester.Digester;
import org.apache.tomcat.util.digester.RuleSetBase;
/**
* <p><strong>RuleSet</strong> for processing the contents of a
* Host definition element. This <code>RuleSet</code> does NOT include
* any rules for nested Context which should be added via instances of
* <code>ContextRuleSet</code>.</p>
*
* @author Craig R. McClanahan
*/
@SuppressWarnings("deprecation")
public class HostRuleSet extends RuleSetBase {
// ----------------------------------------------------- Instance Variables
/**
* The matching pattern prefix to use for recognizing our elements.
*/
protected final String prefix;
// ------------------------------------------------------------ Constructor
/**
* Construct an instance of this <code>RuleSet</code> with the default
* matching pattern prefix.
*/
public HostRuleSet() {
this("");
}
/**
* Construct an instance of this <code>RuleSet</code> with the specified
* matching pattern prefix.
*
* @param prefix Prefix for matching pattern rules (including the
* trailing slash character)
*/
public HostRuleSet(String prefix) {
this.prefix = prefix;
}
// --------------------------------------------------------- Public Methods
/**
* <p>Add the set of Rule instances defined in this RuleSet to the
* specified <code>Digester</code> instance, associating them with
* our namespace URI (if any). This method should only be called
* by a Digester instance.</p>
*
* @param digester Digester instance to which the new Rule instances
* should be added.
*/
@Override
public void addRuleInstances(Digester digester) {
digester.addObjectCreate(prefix + "Host",
"org.apache.catalina.core.StandardHost",
"className");
digester.addSetProperties(prefix + "Host");
digester.addRule(prefix + "Host",
new CopyParentClassLoaderRule());
digester.addRule(prefix + "Host",
new LifecycleListenerRule
("org.apache.catalina.startup.HostConfig",
"hostConfigClass"));
digester.addSetNext(prefix + "Host",
"addChild",
"org.apache.catalina.Container");
digester.addCallMethod(prefix + "Host/Alias",
"addAlias", 0);
//Cluster configuration start
digester.addObjectCreate(prefix + "Host/Cluster",
null, // MUST be specified in the element
"className");
digester.addSetProperties(prefix + "Host/Cluster");
digester.addSetNext(prefix + "Host/Cluster",
"setCluster",
"org.apache.catalina.Cluster");
//Cluster configuration end
digester.addObjectCreate(prefix + "Host/Listener",
null, // MUST be specified in the element
"className");
digester.addSetProperties(prefix + "Host/Listener");
digester.addSetNext(prefix + "Host/Listener",
"addLifecycleListener",
"org.apache.catalina.LifecycleListener");
digester.addRuleSet(new RealmRuleSet(prefix + "Host/"));
digester.addObjectCreate(prefix + "Host/Valve",
null, // MUST be specified in the element
"className");
digester.addSetProperties(prefix + "Host/Valve");
digester.addSetNext(prefix + "Host/Valve",
"addValve",
"org.apache.catalina.Valve");
}
}

View File

@@ -0,0 +1,134 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import org.apache.catalina.Container;
import org.apache.catalina.LifecycleListener;
import org.apache.tomcat.util.IntrospectionUtils;
import org.apache.tomcat.util.digester.Rule;
import org.xml.sax.Attributes;
/**
* Rule that creates a new {@link LifecycleListener} and associates it with the
* top object on the stack which must implement {@link Container}. The
* implementation class to be used is determined by:
* <ol>
* <li>Does the top element on the stack specify an implementation class using
* the attribute specified when this rule was created?</li>
* <li>Does the parent {@link Container} of the {@link Container} on the top of
* the stack specify an implementation class using the attribute specified
* when this rule was created?</li>
* <li>Use the default implementation class specified when this rule was
* created.</li>
* </ol>
*/
public class LifecycleListenerRule extends Rule {
// ----------------------------------------------------------- Constructors
/**
* Construct a new instance of this Rule.
*
* @param listenerClass Default name of the LifecycleListener
* implementation class to be created
* @param attributeName Name of the attribute that optionally
* includes an override name of the LifecycleListener class
*/
public LifecycleListenerRule(String listenerClass, String attributeName) {
this.listenerClass = listenerClass;
this.attributeName = attributeName;
}
// ----------------------------------------------------- Instance Variables
/**
* The attribute name of an attribute that can override the
* implementation class name.
*/
private final String attributeName;
/**
* The name of the <code>LifecycleListener</code> implementation class.
*/
private final String listenerClass;
// --------------------------------------------------------- Public Methods
/**
* Handle the beginning of an XML element.
*
* @param attributes The attributes of this element
*
* @exception Exception if a processing error occurs
*/
@Override
public void begin(String namespace, String name, Attributes attributes)
throws Exception {
Container c = (Container) digester.peek();
Container p = null;
Object obj = digester.peek(1);
if (obj instanceof Container) {
p = (Container) obj;
}
String className = null;
// Check the container for the specified attribute
if (attributeName != null) {
String value = attributes.getValue(attributeName);
if (value != null)
className = value;
}
// Check the container's parent for the specified attribute
if (p != null && className == null) {
String configClass =
(String) IntrospectionUtils.getProperty(p, attributeName);
if (configClass != null && configClass.length() > 0) {
className = configClass;
}
}
// Use the default
if (className == null) {
className = listenerClass;
}
// Instantiate a new LifecycleListener implementation object
Class<?> clazz = Class.forName(className);
LifecycleListener listener = (LifecycleListener) clazz.getConstructor().newInstance();
// Add this LifecycleListener to our associated component
c.addLifecycleListener(listener);
}
}

View File

@@ -0,0 +1,162 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
catalina.configFail=Unable to load server configuration from [{0}]
catalina.noCluster=Cluster RuleSet not found due to [{0}]. Cluster configuration disabled.
catalina.serverStartFail=The required Server component failed to start so Tomcat is unable to start.
catalina.shutdownHookFail=The shutdown hook experienced an error while trying to stop the server
catalina.stopServer=No shutdown port configured. Shut down server through OS signal. Server not shut down.
catalina.stopServer.connectException=Could not contact [{0}:{1}]. Tomcat may not be running.
connector.noSetExecutor=Connector [{0}] does not support external executors. Method setExecutor(java.util.concurrent.Executor) not found.
connector.noSetSSLImplementationName=Connector [{0}] does not support changing the SSL implementation. Method setSslImplementationName(String) not found.
contextConfig.altDDNotFound=alt-dd file [{0}] not found
contextConfig.annotationsStackOverflow=Unable to complete the scan for annotations for web application [{0}] due to a StackOverflowError. Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies. The class hierarchy being processed was [{1}]
contextConfig.applicationMissing=Missing application web.xml, using defaults only
contextConfig.applicationParse=Parse error in application web.xml file at [{0}]
contextConfig.applicationPosition=Occurred at line [{0}] column [{1}]
contextConfig.applicationStart=Parsing application web.xml file at [{0}]
contextConfig.applicationUrl=Unable to determine URL for application web.xml
contextConfig.authenticatorConfigured=Configured an authenticator for method [{0}]
contextConfig.authenticatorInstantiate=Cannot instantiate an authenticator of class [{0}]
contextConfig.authenticatorMissing=Cannot configure an authenticator for method [{0}]
contextConfig.authenticatorResources=Cannot load authenticators mapping list
contextConfig.badUrl=Unable to process context descriptor [{0}]
contextConfig.cce=Lifecycle event data object [{0}] is not a Context
contextConfig.contextClose=Error closing context.xml
contextConfig.contextMissing=Missing context.xml: [{0}]
contextConfig.contextParse=Parse error in context.xml for [{0}]
contextConfig.defaultError=Error processed default web.xml named [{0}] at [{1}]
contextConfig.defaultMissing=No global web.xml found
contextConfig.defaultPosition=Occurred at line [{0}] column [{1}]
contextConfig.destroy=ContextConfig: Destroying
contextConfig.fileUrl=Unable to create a File object from the URL [{0}]
contextConfig.fixDocBase=Exception fixing docBase for context [{0}]
contextConfig.init=ContextConfig: Initializing
contextConfig.inputStreamFile=Unable to process file [{0}] for annotations
contextConfig.inputStreamJar=Unable to process Jar entry [{0}] from Jar [{1}] for annotations
contextConfig.inputStreamJndi=Unable to process resource element [{0}] for annotations
contextConfig.inputStreamWebResource=Unable to process web resource [{0}] for annotations
contextConfig.invalidSciHandlesTypes=Unable to load class [{0}] to check against the @HandlesTypes annotation of one or more ServletContentInitializers.
contextConfig.jarFile=Unable to process Jar [{0}] for annotations
contextConfig.jndiUrl=Unable to process JNDI URL [{0}] for annotations
contextConfig.jndiUrlNotDirContextConn=The connection created for URL [{0}] was not a DirContextURLConnection
contextConfig.jspFile.error=JSP file [{0}] must start with a ''/''
contextConfig.jspFile.warning=WARNING: JSP file [{0}] must start with a ''/'' in Servlet 2.4
contextConfig.missingRealm=No Realm has been configured to authenticate against
contextConfig.processAnnotationsDir.debug=Scanning directory for class files with annotations [{0}]
contextConfig.processAnnotationsJar.debug=Scanning jar file for class files with annotations [{0}]
contextConfig.processAnnotationsWebDir.debug=Scanning web application directory for class files with annotations [{0}]
contextConfig.resourceJarFail=Failed to process JAR found at URL [{0}] for static resources to be included in context with name [{1}]
contextConfig.role.auth=Security role name [{0}] used in an <auth-constraint> without being defined in a <security-role>
contextConfig.role.link=Security role name [{0}] used in a <role-link> without being defined in a <security-role>
contextConfig.role.runas=Security role name [{0}] used in a <run-as> without being defined in a <security-role>
contextConfig.sci.debug=Unable to process ServletContainerInitializer for [{0}]. This is most likely due to a class defined in the @HandlesTypes annotation being missing
contextConfig.sci.info=Unable to process ServletContainerInitializer for [{0}]. This is most likely due to a class defined in the @HandlesTypes annotation being missing. Enable DEBUG level logging for the full stack trace.
contextConfig.servletContainerInitializerFail=Failed to detect ServletContainerInitializers for context with name [{0}]
contextConfig.start=ContextConfig: Processing START
contextConfig.stop=ContextConfig: Processing STOP
contextConfig.unavailable=Marking this application unavailable due to previous error(s)
contextConfig.unknownUrlProtocol=The URL protocol [{0}] was not recognised during annotation processing. URL [{1}] was ignored.
contextConfig.urlPatternValue=Both the urlPatterns and value attributes were set for the [{0}] annotation on class [{1}]
contextConfig.xmlSettings=Context [{0}] will parse web.xml and web-fragment.xml files with validation:[{1}] and namespaceAware:[{2}]
embedded.notmp=Cannot find specified temporary folder at [{0}]
engineConfig.cce=Lifecycle event data object [{0}] is not an Engine
engineConfig.start=EngineConfig: Processing START
engineConfig.stop=EngineConfig: Processing STOP
expandWar.copy=Error copying [{0}] to [{1}]
expandWar.createFailed=Unable to create the directory [{0}]
expandWar.createFileFailed=Unable to create the file [{0}]
expandWar.deleteFailed=[{0}] could not be completely deleted. The presence of the remaining files may cause problems
expandWar.deleteOld=An expanded directory [{0}] was found with a last modified time that did not match the associated WAR. It will be deleted.
expandWar.illegalPath=The archive [{0}] is malformed and will be ignored: an entry contains an illegal path [{1}] which was not expanded to [{2}] since that is outside of the defined docBase [{3}]
expandWar.lastModifiedFailed=Unable to set the last modified time for [{0}]
expandWar.missingJarEntry=Cannot get input stream for JarEntry [{0}] - broken WAR file?
failedContext.start=Failed to process either the global, per-host or context-specific context.xml file therefore the [{0}] Context cannot be started.
hostConfig.appBase=Application base [{1}] for host [{0}] does not exist or is not a directory. deployOnStartUp and autoDeploy have been set to false to prevent deployment errors. Other errors may still occur.
hostConfig.canonicalizing=Unable to determine canonical path for [{0}] while attempting to undeploy [{1}]
hostConfig.cce=Lifecycle event data object [{0}] is not a Host
hostConfig.context.remove=Error while removing context [{0}]
hostConfig.context.restart=Error during context [{0}] restart
hostConfig.createDirs=Unable to create directory for deployment: [{0}]
hostConfig.deploy.error=Exception while deploying web application directory [{0}]
hostConfig.deployDescriptor=Deploying deployment descriptor [{0}]
hostConfig.deployDescriptor.blocked=The web application with context path [{0}] was not deployed because it contained a deployment descriptor [{1}] which may include configuration necessary for the secure deployment of the application but processing of deployment descriptors is prevented by the deployXML setting of this host. An appropriate descriptor should be created at [{2}] to deploy this application.
hostConfig.deployDescriptor.error=Error deploying deployment descriptor [{0}]
hostConfig.deployDescriptor.finished=Deployment of deployment descriptor [{0}] has finished in [{1}] ms
hostConfig.deployDescriptor.localDocBaseSpecified=A docBase [{0}] inside the host appBase has been specified, and will be ignored
hostConfig.deployDescriptor.threaded.error=Error waiting for multi-thread deployment of deployment descriptors to complete
hostConfig.deployDir=Deploying web application directory [{0}]
hostConfig.deployDir.error=Error deploying web application directory [{0}]
hostConfig.deployDir.finished=Deployment of web application directory [{0}] has finished in [{1}] ms
hostConfig.deployDir.threaded.error=Error waiting for multi-thread deployment of directories to complete
hostConfig.deployWar=Deploying web application archive [{0}]
hostConfig.deployWar.error=Error deploying web application archive [{0}]
hostConfig.deployWar.finished=Deployment of web application archive [{0}] has finished in [{1}] ms
hostConfig.deployWar.hiddenDir=The directory [{0}] will be ignored because the WAR [{1}] takes priority and unpackWARs is false
hostConfig.deployWar.threaded.error=Error waiting for multi-thread deployment of WAR files to complete
hostConfig.deploying=Deploying discovered web applications
hostConfig.docBaseUrlInvalid=The provided docBase cannot be expressed as a URL
hostConfig.expand=Expanding web application archive [{0}]
hostConfig.expand.error=Exception while expanding web application archive [{0}]
hostConfig.ignorePath=Ignoring path [{0}] in appBase for automatic deployment
hostConfig.illegalWarName=The war name [{0}] is invalid. The archive will be ignored.
hostConfig.jmx.register=Register context [{0}] failed
hostConfig.jmx.unregister=Unregister context [{0}] failed
hostConfig.reload=Reloading context [{0}]
hostConfig.resourceNotAbsolute=Unable to remove resource from context [{0}] since [{1}] is not an absolute path
hostConfig.start=HostConfig: Processing START
hostConfig.stop=HostConfig: Processing STOP
hostConfig.undeploy=Undeploying context [{0}]
hostConfig.undeployVersion=Undeploying old version of context [{0}] which has no active session
passwdUserDatabase.readFail=Failed to obtain a complete set of users from /etc/passwd
tomcat.addWebapp.conflictChild=Unable to deploy WAR at [{0}] to context path [{1}] because of existing context [{2}]
tomcat.addWebapp.conflictFile=Unable to deploy WAR at [{0}] to context path [{1}] because of existing file [{2}]
tomcat.baseDirMakeFail=Unable to create the directory [{0}] to use as the base directory
tomcat.baseDirNotDir=The location [{0}] specified for the base directory is not a directory
tomcat.homeDirMakeFail=Unable to create the directory [{0}] to use as the home directory
userConfig.database=Exception loading user database
userConfig.deploy=Deploying web application for user [{0}]
userConfig.deploy.threaded.error=Error waiting for multi-thread deployment of user directories to complete
userConfig.deploying=Deploying user web applications
userConfig.error=Error deploying web application for user [{0}]
userConfig.start=UserConfig: Processing START
userConfig.stop=UserConfig: Processing STOP
versionLoggerListener.arg=Command line argument: {0}
versionLoggerListener.catalina.base=CATALINA_BASE: {0}
versionLoggerListener.catalina.home=CATALINA_HOME: {0}
versionLoggerListener.env=Environment variable: {0} = {1}
versionLoggerListener.java.home=Java Home: {0}
versionLoggerListener.os.arch=Architecture: {0}
versionLoggerListener.os.name=OS Name: {0}
versionLoggerListener.os.version=OS Version: {0}
versionLoggerListener.prop=System property: {0} = {1}
versionLoggerListener.serverInfo.server.built=Server built: {0}
versionLoggerListener.serverInfo.server.number=Server version number: {0}
versionLoggerListener.serverInfo.server.version=Server version name: {0}
versionLoggerListener.vm.vendor=JVM Vendor: {0}
versionLoggerListener.vm.version=JVM Version: {0}
webAnnotationSet.invalidInjection=Invalid method resource injection annotation.

View File

@@ -0,0 +1,47 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
catalina.serverStartFail=Tomcat kann nicht starten, da eine benötigte Server Komponente Startprobleme hat
contextConfig.altDDNotFound=alt-dd Datei [{0}] konnte nicht gefunden werden
contextConfig.applicationUrl=Kann die URL für web.xml der Applikation nicht ermitteln
contextConfig.authenticatorConfigured=Es wurde ein Authenticator für Methode [{0}] konfiguriert
contextConfig.contextMissing=Fehlende context.xml: [{0}]
contextConfig.defaultMissing=Keine globale web.xml gefunden
contextConfig.defaultPosition=Vorgekommen in Zeile [{0}] Spalte [{1}]
contextConfig.inputStreamWebResource=Kann Annotationen für Web Ressource [{0}] nicht verarbeiten
contextConfig.missingRealm=Es wurde kein Realm konfiguriert gegen den man sich authentifizieren kann
contextConfig.processAnnotationsDir.debug=Durchsuche Verzeichnis nach Klassen mit Annotationen [{0}]
engineConfig.start=EngineConfig: verarbeite START
engineConfig.stop=EngineConfig: verarbeite STOP
hostConfig.deployDir=Deploye Web-Applikations-Verzeichnis [{0}]
hostConfig.deployWar.error=Fehler beim deployen des Web-Applikationsarchivs [{0}]
hostConfig.docBaseUrlInvalid=Die angegebene docBase kann nicht als URL ausgedrückt werden
hostConfig.jmx.unregister=Unregistrierter Kontext [{0}] fehlgeschlagen
hostConfig.stop=HostConfig: Verarbeitung GESTOPPT
userConfig.database=Fehler beim Laden der Benutzer Datenbank.
userConfig.error=Fehler beim deployen einer Web-Applikation für den Benutzer [{0}]
userConfig.start=UserConfig: Verarbeite START
versionLoggerListener.catalina.base=\n\
\ CATALINA_BASE: {0}
versionLoggerListener.catalina.home=CATALINA_HOME: {0}
versionLoggerListener.os.arch=Architektur: {0}
versionLoggerListener.serverInfo.server.version=\n\
\ Server Version: {0}
versionLoggerListener.vm.vendor=JVM Hersteller: {0}

View File

@@ -0,0 +1,113 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
catalina.configFail=No pude cargar la configuración del servidor desde [{0}]
catalina.serverStartFail=Tomcat no puede iniciar porque el componente Server requerido fallo al iniciar.
catalina.shutdownHookFail=El gancho de apagado ha experimentado un error al intentar para el servidor
catalina.stopServer=No se ha configurado puerto de apagado. Apagando el servidor a través de señal de SO. Servidor no apagado.
contextConfig.altDDNotFound=fichero alt-dd [{0}] no hallado
contextConfig.applicationMissing=Falta el archivo web.xml de la aplicación. Utilizando los parámetros por defecto
contextConfig.applicationParse=Error de evaluación (parse) en el archivo web.xml de la aplicación a [{0}]
contextConfig.applicationPosition=Se ha producido en la línea [{0}] columna [{1}]
contextConfig.applicationStart=Analizando fichero de aplicación web.xml en [{0}]
contextConfig.applicationUrl=No pude determinar la URL para la aplicación web.xml
contextConfig.authenticatorConfigured=Configuración de un autentificador (authenticator) para el método [{0}]
contextConfig.authenticatorInstantiate=Imposible de instanciar un autenticador (authenticator) para la clase [{0}]
contextConfig.authenticatorMissing=Imposible de configurar un autentificador (authenticator) para el método [{0}]
contextConfig.authenticatorResources=Imposible de cargar la lista de correspondencia de autenticadores (authenticators)
contextConfig.badUrl=No pude procesar descriptor de contextor [{0}]
contextConfig.cce=El objeto de los datos de evento de ciclo de vida (Lifecycle event data object) [{0}] no es un Contexto
contextConfig.contextClose=Error cerrando context.xml: [{0}]
contextConfig.contextMissing=Falta context.xml: [{0}]
contextConfig.contextParse=Error de análisis en context.xml: [{0}]
contextConfig.defaultError=Error al procesar web.xml por defecto con nombre [{0}] en [{1}]
contextConfig.defaultMissing=No se ha hallado web.xml global
contextConfig.defaultPosition=Se ha producido en la línea [{0}] columna [{1}]
contextConfig.destroy=ContextConfig: Destruyendo
contextConfig.fileUrl=No puedo crear un objeto Fichero desde la URL [{0}]
contextConfig.fixDocBase=Excepción arreglando docBase: [{0}]
contextConfig.init=ContextConfig: Inicializando
contextConfig.inputStreamFile=No puedo procesar el fichero [{0}] para las anotaciones
contextConfig.inputStreamJar=No puedo procesar la entrada de Jar [{0}] desde el Jar [{1}] para las anotaciones
contextConfig.inputStreamJndi=No puedo procesar el elemento de recurso [{0}] para las anotaciones
contextConfig.inputStreamWebResource=Imposible procesar el recurso web [{0}] para anotaciones
contextConfig.invalidSciHandlesTypes=No puedo cargar la clase [{0}] para revisar contra la anotación @HandlesTypes de uno o más ServletContentInitializers.
contextConfig.jndiUrl=No puedo procesar la URL JNDI [{0}] para las anotaciones
contextConfig.jndiUrlNotDirContextConn=La conexión creada para la URL [{0}] no era una DirContextURLConnection
contextConfig.jspFile.error=El archivo JSP [{0}] debe de comenzar con ''/''
contextConfig.jspFile.warning=AVISO: El archivo JSP [{0}] debe de comenzar con ''/'' en Servlet 2.4
contextConfig.missingRealm=Algún reino (realm) no ha sido configurado para realizar la autenticación
contextConfig.processAnnotationsDir.debug=Escaneando el directorio por archivos de clase con anotaciones [{0}]\n
contextConfig.resourceJarFail=Hallado JAR fallido a los procesos en URL [{0}] para recursos estáticos a ser incluidos en contexto con nombre [{0}]
contextConfig.role.auth=El nombre de papel de seguridad [{0}] es usado en un <auth-constraint> sin haber sido definido en <security-role>
contextConfig.role.link=El nombre de papel de seguridad [{0}] es usado en un <role-link> sin haber sido definido en <security-role>
contextConfig.role.runas=El nombre de papel de seguridad [{0}] es usado en un <run-as> sin haber sido definido en <security-role>
contextConfig.servletContainerInitializerFail=Hallado JAR fallido a proceso en URL [{0}] para ServletContainerInitializers para el contexto con nombre [{1}]
contextConfig.start="ContextConfig": Procesando "START"
contextConfig.stop="ContextConfig": Procesando "STOP"
contextConfig.unavailable=Esta aplicación está marcada como no disponible debido a los errores precedentes
contextConfig.unknownUrlProtocol=El protocolo de URL [{0}] no fue reconocido durante el proceso de anotaciones. Se ignoró la URL [{1}].
contextConfig.urlPatternValue=Ambis valores de urlPatterns y atributo fuerno puestos para anotación de [{0}] de la clase [{1}]
contextConfig.xmlSettings=El contexto [{0}] analizará los ficheros web.xml y web-fragment.xml con validación:[{1}] y namespaceAware:[{2}]
embedded.notmp=No puedo hallar carpeta temporal especificada en [{0}]
engineConfig.cce=El objeto de los datos de evento de ciclo de vida (Lifecycle event data object) [{0}] no es un motor (engine)
engineConfig.start="EngineConfig": Procesando "START"
engineConfig.stop="EngineConfig": Procesando "STOP"
expandWar.copy=Error copiando [{0}] a [{1}]
expandWar.createFailed=No se pudo crear el directorio [{0}]
expandWar.deleteFailed=[{0}] no pudo ser completamente borrado. La presencia de los ficheros restantes puede causar problemas
expandWar.illegalPath=The archive [{0}] is malformed and will be ignored: an entry contains an illegal path [{1}] which was not expanded to [{2}] since that is outside of the defined docBase [{3}]
hostConfig.canonicalizing=Error al borrar redespliegue de recursos desde contexto [{0}]
hostConfig.cce=El objeto de los datos de evento de ciclo de vida (Lifecycle event data object) [{0}] no es una máquina (host)
hostConfig.context.remove=Error al quitar contexto [{0}]
hostConfig.context.restart=Error durante el arranque del contexto [{0}]
hostConfig.createDirs=No puedo crear directorio para despliegue: [{0}]
hostConfig.deployDescriptor=Desplieque del descriptor de configuración [{0}]
hostConfig.deployDescriptor.error=Error durante el despliegue del descriptor de configuración [{0}]
hostConfig.deployDescriptor.localDocBaseSpecified=Se ha especificado un docBase [{0}] dentro del appBase de la máquina y será ignorado
hostConfig.deployDir=Desplegando el directorio [{0}] de la aplicación web
hostConfig.deployDir.error=Error durante el despliegue del directorio [{0}] de la aplicación web
hostConfig.deployWar=Despliegue del archivo [{0}] de la aplicación web
hostConfig.deployWar.error=Error durante el despliegue del archivo [{0}] de la aplicación web
hostConfig.deployWar.hiddenDir=El directorio [{0}] será ignorado debido a que el WAR [{1}] tiene prioridad y unpackWARs es falso
hostConfig.docBaseUrlInvalid=El docBase proporcionado no puede ser expresado como una URL
hostConfig.ignorePath=Ignorando ruta [{0}] en appBase para despliegue automático
hostConfig.illegalWarName=El nombre de war [{0}] es inválido. El archivo será ignorado.
hostConfig.jmx.register=Falló el registro del contexto [{0}]
hostConfig.jmx.unregister=Falló el desregistro del contexto [{0}]
hostConfig.reload=Falló la recarga del contexto [{0}]
hostConfig.start="HostConfig": Procesando "START"
hostConfig.stop="HostConfig": Procesando "STOP"
hostConfig.undeploy=Repliegue (undeploy) de la aplicación web que tiene como trayectoria de contexto [{0}]
userConfig.database=Excepción durante la carga de base de datos de usuario
userConfig.deploy=Despliegue de la aplicación web para el usuario [{0}]
userConfig.deploying=Desplegando aplicaciones web para el usuario
userConfig.error=Error durante el despliegue de la aplicación web para el usario [{0}]
userConfig.start="UserConfig": Procesando "START"
userConfig.stop="UserConfig": Tratamiento del "STOP"
versionLoggerListener.os.arch=Arquitectura: {0}\n
versionLoggerListener.os.version=Versión de Systema Operativo: {0}\n
versionLoggerListener.serverInfo.server.number=Número de versión de servidor: {0}
versionLoggerListener.serverInfo.server.version=Nombre de la versión del servidor: {0}\n
versionLoggerListener.vm.vendor=Vededor JVM: {0}
webAnnotationSet.invalidInjection=El método de inyección de anotación no es un recurso válido

View File

@@ -0,0 +1,158 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
catalina.configFail=Impossible de charger la configuration du serveur depuis [{0}]
catalina.noCluster=le RuleSet du cluster n''a pas été trouvé à cause de [{0}], la configuration du cluster est désactivée
catalina.serverStartFail=Le composant Server requis n'a pas démarré, en conséquence Tomcat ne peut démarrer.
catalina.shutdownHookFail=Le crochet d'arrêt a rencontré une erreur en tentant d'arrêter le serveur
catalina.stopServer=Pas de port d'arrêt configuré, l'arrêt du serveur se fera via un signal du système d'exploitation; le serveur est en cours d'exécution
connector.noSetExecutor=Le connecteur [{0}] ne supporte pas les exécuteurs externes, la méthode setExecutor(java.util.concurrent.Executor) n''a pas été trouvée
connector.noSetSSLImplementationName=Le connecteur [{0}] ne supporte pas le changement de l''implémentation SSL, car la méthode setSslImplementationName(String) n''a pas été trouvée
contextConfig.altDDNotFound=fichier alt-dd [{0}] pas trouvé
contextConfig.annotationsStackOverflow=Impossible de finir l''analyse des annotations de l''application web [{0}] à cause d''une StackOverflowError, les causes possibles sont une valeur trop petite pour -Xss et des dépendances d''héritage cycliques; la hiérarchie de classe qui était traitée était [{1}]
contextConfig.applicationMissing=Le fichier web.xml de l'application est absent, utilisation des paramètres par défaut
contextConfig.applicationParse=Erreur d''évaluation (parse) dans le fichier web.xml de l''application à [{0}]
contextConfig.applicationPosition=S''est produite à la ligne [{0}] colonne [{1}]
contextConfig.applicationStart=Traitement du fichier web.xml de l''application à [{0}]
contextConfig.applicationUrl=Impossible de déterminer l'URL pour le fichier d'application web.xml
contextConfig.authenticatorConfigured=Configuration d''un authentificateur (authenticator) pour la méthode [{0}]
contextConfig.authenticatorInstantiate=Impossible d''instancier un authentificateur (authenticator) pour la classe [{0}]
contextConfig.authenticatorMissing=Impossible de configurer un authentificateur (authenticator) pour la méthode [{0}]
contextConfig.authenticatorResources=Impossible de charger la liste de correspondance des authentificateurs (authenticators)
contextConfig.badUrl=Impossible de traiter le descripteur de contexte [{0}]
contextConfig.cce=L''objet donnée évènement cycle de vie (Lifecycle event data object) [{0}] n''est pas un Contexte
contextConfig.contextClose=Erreur lors de la fermeture de context.xml
contextConfig.contextMissing=context.xml manquant: [{0}]
contextConfig.contextParse=Erreur de traitement de context.xml pour [{0}]
contextConfig.defaultError=Erreur de traitement du web.xml par défaut appelé [{0}] à [{1}]
contextConfig.defaultMissing=Fichier web.xml global non trouvé
contextConfig.defaultPosition=S''est produite à la ligne [{0}] colonne [{1}]
contextConfig.destroy=ContextConfig: Destruction
contextConfig.fileUrl=Impossible de créer un objet fichier à partir de l''URL [{0}]
contextConfig.fixDocBase=Exception durant la fixation du "docBase" pour le contexte [{0}]
contextConfig.init=ContextConfig: Initialisation
contextConfig.inputStreamFile=Impossible de traiter les annotations du fichier [{0}]
contextConfig.inputStreamJar=Impossible de traiter l''entrée [{0}] du JAR [{1}] pour les annotations
contextConfig.inputStreamWebResource=Incapable de traiter les annotations de la ressource web [{0}]
contextConfig.invalidSciHandlesTypes=Impossible de charger la classe [{0}] pour la vérifier avec l''annotation @HandlesTypes d''un ou plusieurs ServletContainerInitializer
contextConfig.jarFile=Impossible de traiter les annotations du JAR [{0}]
contextConfig.jspFile.error=Le fichier JSP [{0}] doit commencer par un ''/''
contextConfig.jspFile.warning=WARNING: Le fichier JSP [{0}] doit commencer par un ''/'' dans l''API Servlet 2.4
contextConfig.missingRealm=Aucun royaume (realm) n'a été configuré pour réaliser l'authentification
contextConfig.processAnnotationsDir.debug=Balayage du répertoire pour trouver des fichiers de classe avec annotations [{0}]
contextConfig.processAnnotationsJar.debug=Analyse du fichier jars pour des classes annotées avec [{0}]
contextConfig.processAnnotationsWebDir.debug=Balayage du répertoire d''applications web, pour fichiers de classe avec annotations [{0}]
contextConfig.resourceJarFail=Echec du traitement du JAR trouvé à l''URL [{0}] pour les ressources statiques qui devront être incluses dans le contexte avec le nom [{1}]
contextConfig.role.auth=Le nom de rôle de sécurité [{0}] est utilisé dans un <auth-constraint> sans avoir été défini dans <security-role>
contextConfig.role.link=Le nom de rôle de sécurité [{0}] est utilisé dans un <role-link> sans avoir été défini dans <security-role>
contextConfig.role.runas=Le nom de rôle de sécurité [{0}] est utilisé dans un <run-as> sans avoir été défini dans <security-role>
contextConfig.sci.debug=Impossible de traiter le ServletContainerInitializaer pour [{0}], c''est probablement dû au fait que la classe dans l''annotation @HandlesTypes est manquante
contextConfig.sci.info=Impossible de traiter le ServletContainerInitializaer pour [{0}], c''est probablement dû au fait que la classe dans l''annotation @HandlesTypes est manquante (activer le niveau de log DEBUG pour voir la trace complète)
contextConfig.servletContainerInitializerFail=Impossible de détecter les ServletContainerInitializers pour le contexte nommé [{0}]
contextConfig.start=ContextConfig: Traitement du "START"
contextConfig.stop="ContextConfig": Traitement du "STOP"
contextConfig.unavailable=Cette application est marquée comme non disponible suite aux erreurs précédentes
contextConfig.unknownUrlProtocol=Le protocole de l''URL [{0}] n''a pas été reconnu pendant le traitement des annotations, l''URL [{1}] a été ignorée
contextConfig.urlPatternValue=A la fois les attributs urlPatterns et la valeur ont été fixés pour l''annotation [{0}] de la classe [{1}]
contextConfig.xmlSettings=Le contexte [{0}] va traiter les fichiers web.xml et le web-fragment.xml avec la validation [{1}] et namespaceAware [{2}]
embedded.notmp=Impossible de trouver le répertoire temporaire à [{0}]
engineConfig.cce=L''objet donnée évènement cycle de vie (Lifecycle event data object) [{0}] n''est pas un moteur (engine)
engineConfig.start="EngineConfig": Traitement du "START"
engineConfig.stop="EngineConfig": Traitement du "STOP"
expandWar.copy=Erreur lors de la copie de [{0}] vers [{1}]
expandWar.createFailed=Impossible de créer le répertoire [{0}]
expandWar.createFileFailed=Impossible de créer le fichier [{0}]
expandWar.deleteFailed=[{0}] n''a pas pu être complètement effacé. La présence des fichiers résiduels peut causer des problèmes ultérieurs.
expandWar.deleteOld=Un répertoire décompressé [{0}] a été trouvé avec une date de dernière modification qui ne correspond pas au WAR associé, il sera effacé
expandWar.illegalPath=L''archive [{0}] est invalide est sera ignorée: une entrée contient un chemin invalide [{1}] qui n''a pas été extrait vers [{2}] puisque c''est en dehors du docBase [{3}] qui a été défini
expandWar.lastModifiedFailed=Impossible de fixer la date de dernière modification pour [{0}]
expandWar.missingJarEntry=Impossible d''obtenir un flux d''entrée pour le JarEntry [{0}], le WAR peut être invalide
failedContext.start=Impossible de traiter le context.xml soit global, par hôte ou spécifique au contexte, donc le contexte [{0}] ne peut pas être démarré
hostConfig.appBase=La base d''application [{1}] pour le hôte [{0}] n''existe pas ou n''est pas un répertoire. deployOnStartUp et autoDeploy ont été remis à "false" pour éviter des erreurs de déployement. D''autres erreurs peuvent suivre.
hostConfig.canonicalizing=Impossible de déterminer le chemin canonique pour [{0}] pendant qu''on essaie de retirer [{1}]
hostConfig.cce=L''objet donnée évènement cycle de vie (Lifecycle event data object) [{0}] n''est pas un hôte
hostConfig.context.remove=Erreur en enlevant le contexte [{0}]
hostConfig.context.restart=Erreur pendant le redémarrage du contexte [{0}]
hostConfig.createDirs=Impossible de créer un répertoire pour le déploiement: [{0}]
hostConfig.deploy.error=Exception lors du déploiement du répertoire [{0}] de l''application web
hostConfig.deployDescriptor=Déploiement du descripteur de configuration [{0}]
hostConfig.deployDescriptor.blocked=L''application web dont le chemin est [{0}] n''a pas été déployée car elle contenait un descripteur de déploiement [{1}] qui pourrait inclure de la configuration nécessaire pour le déploiement sécurisé de l''application mais ce traitement est empêché par le paramètre deployXML pour cet hôte, un descripteur approprié devrait être crée à [{2}] pour déployer cette application
hostConfig.deployDescriptor.error=Erreur lors du déploiement du descripteur de configuration [{0}]
hostConfig.deployDescriptor.finished=Le traitement du descripteur de déploiement [{0}] a pris [{1}] ms
hostConfig.deployDescriptor.localDocBaseSpecified=Un docBase [{0}] dans l''appBase de l''hôte a été spécifié et sera ignoré
hostConfig.deployDescriptor.threaded.error=Erreur en attendant la fin du déploiement de descripteurs en parallèle
hostConfig.deployDir=Déploiement du répertoire d''application web [{0}]
hostConfig.deployDir.error=Erreur lors du déploiement du répertoire [{0}] de l''application web
hostConfig.deployDir.finished=Le déploiement du répertoire [{0}] de l''application web s''est terminé en [{1}] ms
hostConfig.deployDir.threaded.error=Erreur en attendant la fin du déploiement de répertoires en parallèle
hostConfig.deployWar=Déploiement de l''archive [{0}] de l''application web
hostConfig.deployWar.error=Erreur lors du déploiement de l''archive [{0}] de l''application web
hostConfig.deployWar.finished=Le déploiement de l''archive de l''application web [{0}] s''est terminé en [{1}] ms
hostConfig.deployWar.hiddenDir=Le répertoire [{0}] sera ignoré parce que le WAR [{1}] a la priorité et que unpackWARs est faux
hostConfig.deployWar.threaded.error=Erreur en attendant la fin du déploiement de fichiers WAR en parallèle
hostConfig.deploying=Déploiement des applications web trouvées
hostConfig.docBaseUrlInvalid=La "docBase" fournie ne peut pas être exprimée comme URL
hostConfig.expand=Décompression de l''archive [{0}] de l''application web
hostConfig.expand.error=Exception lors de la décompression de l''archive d''application web [{0}]
hostConfig.ignorePath=Le chemin [{0}] est ignoré pour le déploiement automatique dans appBase
hostConfig.illegalWarName=Le nom du war [{0}] est invalide, l''archive sera ignorée
hostConfig.jmx.register=Echec d''enregistrement du contexte [{0}]
hostConfig.jmx.unregister=Le désenregistrement du contexte [{0}] a échoué
hostConfig.reload=Rechargement du contexte [{0}]
hostConfig.resourceNotAbsolute=Impossible d''enlever la ressource du contexte [{0}] car [{1}] n''est pas absolu
hostConfig.start="HostConfig": Traitement du "START"
hostConfig.stop="HostConfig": Traitement du "STOP"
hostConfig.undeploy=Retrait de l''application web ayant pour chemin de contexte [{0}]
hostConfig.undeployVersion=Retrait de l''ancienne version du contexte [{0}] car elle n''a pas de session active
passwdUserDatabase.readFail=Echec d'obtention de la liste complète des utilisateurs depuis /etc/passwd
tomcat.addWebapp.conflictChild=Impossible de déployer le WAR à [{0}] sur le chemin de contexte [{1}] à cause du contexte existant [{2}]
tomcat.addWebapp.conflictFile=Impossible de déployer le WAR à [{0}] sur le chemin de contexte [{1}] à cause du fichier existant [{2}]
tomcat.baseDirMakeFail=Impossible de créer le répertoire [{0}] pour utiliser comme répertoire de base
tomcat.baseDirNotDir=L''emplacement [{0}] spécifié comme répertoire de base n''est pas un répertoire
tomcat.homeDirMakeFail=Impossible de créer le répertoire [{0}] pour l''utiliser comme répertoire d''origine
userConfig.database=Exception lors du chargement de la base de données utilisateur
userConfig.deploy=Déploiement de l''application web pour l''utilisateur [{0}]
userConfig.deploy.threaded.error=Erreur en attendant la fin du déploiement de répertoires utilisateur en parallèle
userConfig.deploying=Déploiement des applications web utilisateur
userConfig.error=Erreur lors du déploiement de l''application web pour l''utilisateur [{0}]
userConfig.start="UserConfig": Traitement du "START"
userConfig.stop="UserConfig": Traitement du "STOP"
versionLoggerListener.arg=Argument de la ligne de commande: {0}
versionLoggerListener.catalina.base=CATALINA_BASE: {0}
versionLoggerListener.catalina.home=CATALINA_HOME: {0}
versionLoggerListener.env=Variable denvironnement: {0} = {1}
versionLoggerListener.java.home=Répertoire de Java: {0}
versionLoggerListener.os.arch=Architecture: {0}
versionLoggerListener.os.name=Nom de l''OS: {0}
versionLoggerListener.os.version=Version de l''OS: {0}
versionLoggerListener.prop=Propriété système: {0} = {1}
versionLoggerListener.serverInfo.server.built=Serveur compilé: {0}
versionLoggerListener.serverInfo.server.number=Version du serveur: {0}
versionLoggerListener.serverInfo.server.version=Version du serveur: {0}
versionLoggerListener.vm.vendor=Fournisseur de la JVM: {0}
versionLoggerListener.vm.version=Version de la JVM: {0}
webAnnotationSet.invalidInjection=L'annotation d'injection de ressource de la méthode est invalide

View File

@@ -0,0 +1,158 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
catalina.configFail=[{0}]からサーバー設定を読み込めません
catalina.noCluster=[{0}]のためにクラスタルールセットが見つかりません。 クラスタ構成が無効になっています。
catalina.serverStartFail=必要なサーバーコンポーネントを開始できなかったため、Tomcat を開始できませんでした。
catalina.shutdownHookFail=サーバーの停止中にシャットダウンフックでエラーが発生しました。
catalina.stopServer=シャットダウンポートが設定されていません。 OSシグナルでServerをシャットダウンします。 サーバはシャットダウンしません。
connector.noSetExecutor=Connector {0}]は外部エグゼキュータをサポートしていません。 メソッドsetExecutor(java.util.concurrent.Executor)が見つかりません。
connector.noSetSSLImplementationName=コネクター [{0}] は SSL 実装の変更に対応していません。setSslImplementationName(String) メソッドがありません。
contextConfig.altDDNotFound=代替デプロイメントデスクリプタファイル [{0}] が見つかりません。
contextConfig.annotationsStackOverflow=StackOverflowErrorのため、Webアプリケーション[{0}]のアノテーションのスキャンを完了できません。 考えられる根本的な原因には、-Xssおよび不正な循環継承の依存関係の設定が低すぎます。 処理されるクラス階層は[{1}]でした。
contextConfig.applicationMissing=アプリケーションのweb.xmlが見つかりません、デフォルトだけを使用します
contextConfig.applicationParse=アプリケーションのweb.xmlファイル [{0}] の解析エラーです
contextConfig.applicationPosition=[{0}]行の[{1}]列目で発生しました
contextConfig.applicationStart=アプリケーションのweb.xml [{0}] を解析します。
contextConfig.applicationUrl=アプリケーション web.xml の URL を取得できませんでした。
contextConfig.authenticatorConfigured=メソッド [{0}] のオーセンティケータを設定します
contextConfig.authenticatorInstantiate=クラス [{0}] のオーセンティケータをインスタンス化できません
contextConfig.authenticatorMissing=メソッド [{0}] のオーセンティケータを設定できません
contextConfig.authenticatorResources=Authenticators のマップリストをロードできません。
contextConfig.badUrl=コンテキスト記述子 [{0}] を処理できません。
contextConfig.cce=ライフサイクルイベントデータオブジェクト [{0}] はコンテキストではありません
contextConfig.contextClose=context.xmlを閉じる際のエラー
contextConfig.contextMissing=context.xml が見つかりません: [{0}]
contextConfig.contextParse=[{0}]のcontext.xmlの解析エラー
contextConfig.defaultError=[{1}]で[{0}]という名前のデフォルトweb.xmlの処理でエラーが発生しました
contextConfig.defaultMissing=共通 web.xml が見つかりません。
contextConfig.defaultPosition=[{0}]行の[{1}]列目で発生しました
contextConfig.destroy=ContextConfig破棄中
contextConfig.fileUrl=URL [{0}] のファイルオブジェクトを作成できません。
contextConfig.fixDocBase=コンテキスト [{0}] の docBase を修復中に例外が発生しました。
contextConfig.init=ContextConfig: 初期化中\n
contextConfig.inputStreamFile=アノテーションのファイル[{0}]を処理できません
contextConfig.inputStreamJar=テーションのJar [{1}]からJarエントリ[{0}]を処理できません。
contextConfig.inputStreamWebResource=テーションのWebリソース[{0}]を処理できません
contextConfig.invalidSciHandlesTypes=1つ以上のServletContentInitializersの@HandlesTypesアテーションに対してチェックするためにクラス[{0}]をロードできません。
contextConfig.jarFile=テーションのためにJar [{0}]を処理できません。
contextConfig.jspFile.error=JSPファイル [{0}] は''/''で始まらなければいけません
contextConfig.jspFile.warning=警告: Servlet 2.4ではJSPファイル [{0}] は''/''で始まらなければいけません
contextConfig.missingRealm=認証するためにレルムが設定されていません
contextConfig.processAnnotationsDir.debug=[{0}] 配下のディレクトリからクラスファイルをスキャンします。
contextConfig.processAnnotationsJar.debug=テーション付きのクラスファイルのjarファイルのスキャン[{0}]
contextConfig.processAnnotationsWebDir.debug=アノテーション[{0}]のクラスファイルのWebアプリケーションディレクトリのスキャン
contextConfig.resourceJarFail=コンテキスト [{1}] へ静的リソースとして含める URL [{0}] に配置された JAR ファイルを処理できませんでした。
contextConfig.role.auth=<security-role>に定義されていないセキュリティロール名 [{0}] が<auth-constraint>の中で使用されました
contextConfig.role.link=<security-role>に定義されていないセキュリティロール名 [{0}] が<role-link>の中で使用されました
contextConfig.role.runas=<security-role>に定義されていないセキュリティロール名 [{0}] が<run-as>の中で使用されました
contextConfig.sci.debug=[{0}]に対してServletContainerInitializerを処理できません。 @HandlesTypesアテーションで定義されているクラスが見つからないことが原因です。
contextConfig.sci.info=[{0}]に対してServletContainerInitializerを処理できません。 これは@HandlesTypesアテーションに定義されているクラスが見つからないことが原因です。 完全なスタックトレースのDEBUGレベルロギングを有効にします。
contextConfig.servletContainerInitializerFail=名前[{0}]のコンテキストのServletContainerInitializersの検出に失敗しました。
contextConfig.start=ContextConfig: 処理を開始します
contextConfig.stop=ContextConfig: 処理を停止します
contextConfig.unavailable=前のエラーのためにこのアプリケーションは利用できないようにマークします
contextConfig.unknownUrlProtocol=テーション処理中にURLプロトコル[{0}]が認識されませんでした。 URL [{1}]は無視されました。
contextConfig.urlPatternValue=urlPatterns属性とvalue属性の両方が、クラス[{1}]の[{0}]アノテーションに対して設定されています。
contextConfig.xmlSettings=Context[{0}]は、validation:[{1}]およびnamespaceAware[{2}]を使用してweb.xmlおよびweb-fragment.xmlファイルを解析します
embedded.notmp=[{0}]に指定された一時フォルダが見つかりません
engineConfig.cce=ライフサイクルイベントデータオブジェクト [{0}] はエンジンではありません
engineConfig.start=EngineConfig: 処理を開始します
engineConfig.stop=EngineConfig: 処理を停止します
expandWar.copy=[{0}] から [{1}] へのコピーエラー。
expandWar.createFailed=ディレクトリ [{0}] を作成できません。
expandWar.createFileFailed=ファイル[{0}]を作成できません。
expandWar.deleteFailed=[{0}] を削除できません。残ったファイルにより問題が生じるかもしれません。
expandWar.deleteOld=WAR ファイルと最終更新日時の異なる WAR ファイルを展開したディレクトリ [{0}] が見つかりました。削除します。
expandWar.illegalPath=アーカイブ[{0}]は形式が正しくないため無視されます定義されたdocBase [{3}]の外にあるので、[{2}]に拡張されていない不正なパス[{1}]がエントリに含まれています。
expandWar.lastModifiedFailed=[{0}] に最終更新時刻を設定できません。
expandWar.missingJarEntry=JarEntry [{0}] の入力ストリームを取得できません。WAR ファイルが破損している可能性があります。
failedContext.start=グローバル、ホスト単位またはコンテキスト固有のcontext.xmlファイルの処理に失敗しました。したがって、コンテキスト[{0}]を開始できません。
hostConfig.appBase=ホスト [{0}] のアプリケーション基本ディレクトリ [{1}] は存在しないかディレクトリではありません。デプロイメントエラーを防ぐため deployOnStartUp および autoDeploy は false に設定しました。他のエラーが発生するかもしれません。
hostConfig.canonicalizing=[{1}] の配置解除中に [{0}] の正規化パスを取得できませんでした。
hostConfig.cce=ライフサイクルイベントデータオブジェクト [{0}] はホストではありません
hostConfig.context.remove=コンテキスト [{0}] の削除中に異常が発生しました。
hostConfig.context.restart=コンテキスト [{0}] を再起動中のエラーです
hostConfig.createDirs=配備用のディレクトリを作成できません:[{0}]
hostConfig.deploy.error=Webアプリケーションディレクトリ[{0}]を展開中に例外が発生しました。
hostConfig.deployDescriptor=設定記述子 [{0}] を配備します
hostConfig.deployDescriptor.blocked=コンテキストパス[{0}]を持つWebアプリケーションは、アプリケーションのセキュアな配備に必要な設定が含まれている可能性があるが、このホストのdeployXML設定によって配備記述子の処理が妨げられる配備記述子[{1}]が含まれていたためデプロイされていません。このアプリケーションを配備するには、[{2}]に適切な記述子を作成する必要があります。\n
hostConfig.deployDescriptor.error=設定記述子 [{0}] を配備中のエラーです
hostConfig.deployDescriptor.finished=展開記述子[{0}]の展開が[{1}] msで終了しました。
hostConfig.deployDescriptor.localDocBaseSpecified=docBase [{0}] はホストの appBase に含まれるため無視します。
hostConfig.deployDescriptor.threaded.error=デプロイメント記述子のマルチスレッドデプロイメントが完了するのを待つエラー
hostConfig.deployDir=Webアプリケーションディレクトリ [{0}] を配備します
hostConfig.deployDir.error=Webアプリケーションディレクトリ [{0}] を配備中のエラーです
hostConfig.deployDir.finished=ディレクトリ [{0}] の Web アプリケーションの配置は [{1}] ms で完了しました。
hostConfig.deployDir.threaded.error=マルチスレッドで行っているディレクトリの配置完了を待機中に異常が発生しました。
hostConfig.deployWar=Webアプリケーションアーカイブ [{0}] を配備します
hostConfig.deployWar.error=Webアプリケーションアーカイブ [{0}] を配備中のエラーです
hostConfig.deployWar.finished=Web アプリケーションアーカイブ [{0}] の配置は [{1}] ms で完了しました。
hostConfig.deployWar.hiddenDir=WAR [{1}]が優先され、unpackWARsがfalseであるため、ディレクトリ[{0}]は無視されます。
hostConfig.deployWar.threaded.error=WARファイルのマルチスレッド・デプロイメントが完了するまでの待機中のエラー
hostConfig.deploying=発見されたWebアプリケーションの展開
hostConfig.docBaseUrlInvalid=docBase に指定された文字列は URL として解釈できません。
hostConfig.expand=Web アプリケーションアーカイブ [{0}] を展開します。
hostConfig.expand.error=Web アプリケーションアーカイヴ [{0}] の展開中に異常が発生しました。
hostConfig.ignorePath=自動デプロイでは appBase 内のパス [{0}] を無視します。
hostConfig.illegalWarName=War名[{0}]は無効です。 アーカイブは無視されます。
hostConfig.jmx.register=コンテキスト[{0}]を登録できませんでした
hostConfig.jmx.unregister=コンテキスト[{0}]の登録を解除できませんでした
hostConfig.reload=リロード中のコンテキスト [{0}]
hostConfig.resourceNotAbsolute=[{1}] は完全パスではないためコンテキスト [{0}] からリソースを削除できません。
hostConfig.start=HostConfig: 処理を停止します
hostConfig.stop=HostConfig: 処理を停止します
hostConfig.undeploy=コンテキストパス [{0}] のWebアプリケーションの配備を解除します
hostConfig.undeployVersion=コンテキスト [{0}] について有効なセッションの存在しない古いバージョンの配置を解除します。
passwdUserDatabase.readFail=/etc/passwd から全てのユーザーセットを取得できませんでした。
tomcat.addWebapp.conflictChild=コンテキスト [{2}] が存在するためWAR ファイル [{0}] をコンテキストパス [{1}] へ配備できません。
tomcat.addWebapp.conflictFile=[{2}] へファイルまたはディレクトリが存在するため WAR ファイル [{0}] をコンテキストパス [{1}] へ配備できません。
tomcat.baseDirMakeFail=基本ディレクトリとして使用する [{0}] を作成できません。
tomcat.baseDirNotDir=基本ディレクトリに指定された [{0}] はディレクトリではありません。
tomcat.homeDirMakeFail=ホームディレクトリとして使用する [{0}] を作成できません。
userConfig.database=ユーザデータベースのロード中の例外です
userConfig.deploy=ユーザ [{0}] のWebアプリケーションを配備します
userConfig.deploy.threaded.error=ユーザーディレクトリのマルチスレッド展開が完了するのを待つエラー
userConfig.deploying=ユーザのWebアプリケーションを配備します
userConfig.error=ユーザ [{0}] のWebアプリケーションを配備中のエラーです
userConfig.start=UserConfig: 処理を開始します
userConfig.stop=UserConfig: 処理を停止します
versionLoggerListener.arg=コマンドライン引数:{0}
versionLoggerListener.catalina.base=CATALINA_BASE: {0}
versionLoggerListener.catalina.home=CATALINA_HOME: {0}
versionLoggerListener.env=環境変数: {0} = {1}
versionLoggerListener.java.home=Java Home: {0}
versionLoggerListener.os.arch=アーキテクチャ: {0}
versionLoggerListener.os.name=OS 名: {0}
versionLoggerListener.os.version=OS バージョン: {0}
versionLoggerListener.prop=システムプロパティ:{0} = {1}
versionLoggerListener.serverInfo.server.built=Server ビルド: {0}
versionLoggerListener.serverInfo.server.number=サーバーのバージョン番号:{0}
versionLoggerListener.serverInfo.server.version=Serverのバージョン名{0}
versionLoggerListener.vm.vendor=JVM ベンダ: {0}
versionLoggerListener.vm.version=JVM バージョン: {0}
webAnnotationSet.invalidInjection=メソッドに不正なリソース注入アノテーションが指定されました。

View File

@@ -0,0 +1,158 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
catalina.configFail=[{0}](으)로부터 서버 설정을 로드할 수 없습니다.
catalina.noCluster=[{0}](으)로 인하여 클러스터 RuleSet을 찾을 수 없습니다. 클러스터 설정은 사용불능 상태입니다.
catalina.serverStartFail=필수 항목인 서버 구성요소가 제대로 시작되지 못하여, Tomcat이 시작될 수 없습니다.
catalina.shutdownHookFail=서버를 중지시키려는 과정에서, 셧다운 훅에서 오류가 발생했습니다.
catalina.stopServer=셧다운 포트가 설정되지 않았습니다. OS 시그널을 통해 서버를 셧다운합니다. 서버는 아직 셧다운되지 않았습니다.
connector.noSetExecutor=Connector [{0}]은(는) 외부 Executor들을 지원하지 않습니다. 메소드 setExecutor(java.util.concurrent.Executor)를 찾을 수 없습니다.
connector.noSetSSLImplementationName=Connector [{0}]은(는) SSL 구현을 변경하는 것을 지원하지 않습니다. setSslImplementationName(String) 메소드를 찾을 수 없습니다.
contextConfig.altDDNotFound=alt-dd 파일 [{0}]을(를) 찾을 수 없습니다.
contextConfig.annotationsStackOverflow=StackOverflowError로 인하여, 웹 애플리케이션 [{0}]에서 annotation 스캔을 완료하지 못했습니다. 가능성 있는 근본 원인(root cause)들 중의 하나는 -Xss가 너무 적게 설정되어 있거나 불허된 순환 상속 의존관계들일 수 있습니다. 처리되는 클래스의 상속 계층구조는 [{1}]입니다.
contextConfig.applicationMissing=애플리케이션 web.xml이 없습니다. 기본 설정들만을 사용할 것입니다.
contextConfig.applicationParse=[{0}]에 위치한 애플리케이션 web.xml에서 파싱 오류 발생
contextConfig.applicationPosition=[{0}]행 [{1}]열에서 발생했음
contextConfig.applicationStart=[{0}]에 위치한 애플리케이션 web.xml을 파싱합니다.
contextConfig.applicationUrl=애플리케이션 web.xml의 URL을 결정할 수 없습니다.
contextConfig.authenticatorConfigured=메소드 [{0}]을(를) 위한 Authenticator를 설정했습니다.
contextConfig.authenticatorInstantiate=클래스 [{0}]의 Authenticator 인스턴스를 생성할 수 없습니다,
contextConfig.authenticatorMissing=인증 메소드 [{0}]을(를) 위한 Authenticator를 설정할 수 없습니다.
contextConfig.authenticatorResources=Authenticator들의 매핑 목록을 로드할 수 없습니다.
contextConfig.badUrl=컨텍스트 descriptor [{0}]을(를) 처리할 수 없습니다.
contextConfig.cce=Lifecycle 이벤트 데이터 객체 [{0}]이(가) Context 객체가 아닙니다.
contextConfig.contextClose=context.xml을 닫는 중 오류 발생
contextConfig.contextMissing=context.xml이 존재하지 않습니다: [{0}]
contextConfig.contextParse=컨텍스트 [{0}]을(를) 위한 context.xml 내에서 파싱 오류 발생
contextConfig.defaultError=[{1}]에 위치하고 [{0}](이)라는 이름의 기본 web.xml을 처리하는 중 오류 발생
contextConfig.defaultMissing=글로벌 web.xml 파일을 찾을 수 없습니다.
contextConfig.defaultPosition=[{0}] 행, [{1}] 열에서 발생
contextConfig.destroy=ContextConfig: 소멸시키는 중
contextConfig.fileUrl=URL [{0}](으)로부터 File 객체를 생성할 수 없습니다.
contextConfig.fixDocBase=컨텍스트 [{0}]을(를) 위한 docBase를 조정하는 중 예외 발생
contextConfig.init=ContextConfig: 초기화 중
contextConfig.inputStreamFile=파일 [{0}]에 대하여 annotation들을 처리할 수 없습니다.
contextConfig.inputStreamJar=Annotation들을 스캔하기 위해, Jar [{1}](으)로부터의 Jar 엔트리 [{0}]을(를) 처리할 수 없습니다.
contextConfig.inputStreamWebResource=Annotation들을 위해 웹 리소스 [{0}]을(를) 처리할 수 없습니다.
contextConfig.invalidSciHandlesTypes=하나 이상의 ServletContentInitializer들의 @HandlesTypes annotation에 대한 점검을 위해, 클래스 [{0}]을(를) 로드할 수 없습니다.
contextConfig.jarFile=Annotation들을 위해 Jar [{0}]을(를) 처리할 수 없습니다.
contextConfig.jspFile.error=JSP 파일 [{0}]은(는) 반드시 ''/''로 시작해야 합니다.
contextConfig.jspFile.warning=경고: Servlet 2.4에서 JSP 파일 [{0}]은(는) 반드시 ''/''로 시작해야 합니다.
contextConfig.missingRealm=인증 처리 시 사용할 Realm이 설정되지 않았습니다.
contextConfig.processAnnotationsDir.debug=Annotation들을 가진 클래스 파일들을 찾기 위해 디렉토리 [{0}]을(를) 스캔합니다.
contextConfig.processAnnotationsJar.debug=Annotation들, [{0}]을(를) 가진 클래스 파일들을 찾기 위해, JAR 파일을 스캔합니다.
contextConfig.processAnnotationsWebDir.debug=Annotation들인 [{0}]을(를) 가진 클래스 파일들을 찾기 위해, 웹 애플리케이션 디렉토리를 스캔합니다.
contextConfig.resourceJarFail=정적 리소스들이, [{1}](이)라는 이름의 컨텍스트에 포함되게 하기 위하여, URL [{0}]에서 발견된 JAR를 처리하지 못했습니다.
contextConfig.role.auth=보안 역할 이름 [{0}]이(가), <security-role>에서 정의되지 않은 채로, <auth-constraint>에서 사용되었습니다.
contextConfig.role.link=보안 역할 이름 [{0}]이(가) <security-role>에서 정의된 적이 없는데, <role-link>에서 사용되었습니다.
contextConfig.role.runas=<security-role> 내에 정의되지 않고, 보안 역할 이름 [{0}]이(가) <run-as>에서 사용되었습니다.
contextConfig.sci.debug=[{0}]을(를) 위해 ServletContainerInitializer를 처리할 수 없습니다. 이는 필시 @HandlesTypes annotation 내에 정의된 클래스가 존재하지 않기 때문일 것입니다.
contextConfig.sci.info=[{0}]을(를) 위한 ServletContainerInitializer를 처리할 수 없습니다. 이는 필시 @HandlesTypes annotation에 정의된 클래스가 존재하지 않기 때문일 것입니다. 전체 스택 트레이스를 보시려면, 로그 레벨을 디버그 레벨로 설정하십시오.
contextConfig.servletContainerInitializerFail=이름이 [{0}]인 컨텍스트를 위한 ServletContainerInitializer들을 탐지하지 못했습니다.
contextConfig.start=ContextConfig: 시작 처리 중
contextConfig.stop=ContextConfig: STOP 처리 중
contextConfig.unavailable=이전 오류(들)로 인하여, 이 애플리케이션이 가용하지 않은 것으로 표시합니다.
contextConfig.unknownUrlProtocol=Annotation 처리 중, 인식되지 않는 프로토콜 [{0}]을(를) 포함하여, URL [{1}]이(가) 무시되었습니다.
contextConfig.urlPatternValue=클래스 [{1}]의 [{0}] annotation을 위해, urlPatterns와 value 속성, 둘 다 설정되었습니다.
contextConfig.xmlSettings=컨텍스트 [{0}]이(가), validation:[{1}]와(과) namespaceAware:[{2}]을 사용하여, web.xml과 web-fragment.xml 파일들을 파싱합니다.
embedded.notmp=[{0}] 위치로 지정된 임시 폴더를 찾을 수 없습니다.
engineConfig.cce=Lifecycle 이벤트 데이터 객체 [{0}]이(가) Engine 객체가 아닙니다.
engineConfig.start=EngineConfig: START 처리 중
engineConfig.stop=EngineConfig: STOP 처리 중
expandWar.copy=[{0}]을(를) [{1}]에 복사하는 중 오류 발생
expandWar.createFailed=디렉토리 [{0}]을(를) 생성할 수 없습니다.
expandWar.createFileFailed=파일 [{0}]을(를) 생성할 수 없습니다.
expandWar.deleteFailed=[{0}]이(가) 완전히 삭제될 수 없었습니다. 남아있는 파일들의 존재는 문제들을 일으킬 수 있습니다.
expandWar.deleteOld=압축이 풀려진 디렉토리 [{0}]의 최종 변경 시간이, 연관된 WAR의 최종 변경 시간과 부합하지 않습니다. 해당 디렉토리는 삭제될 것입니다.
expandWar.illegalPath=아카이브 [{0}]에 문제가 있어 무시될 것입니다: 엔트리가 불허되는 경로 [{1}]을(를) 포함하고 있고, 그 경로가 정의된 docBase [{3}] 외부에 존재하기 때문에, [{2}]에 압축을 풀지 않았습니다.
expandWar.lastModifiedFailed=[{0}]을(를) 위해, 최종 변경 시간을 설정할 수 없습니다.
expandWar.missingJarEntry=JarEntry [{0}]을(를) 위한 입력 스트림을 얻을 수 없습니다 - WAR 파일이 깨졌나요?
failedContext.start=글로벌, 또는 호스트 별, 또는 해당 컨텍스트의 context.xml 파일을 처리하지 못하였으므로, 컨텍스트 [{0}]은(는) 시작될 수 없습니다.
hostConfig.appBase=호스트 [{0}]을(를) 위한 애플리케이션 base [{1}]이(가), 존재하지 않거나 디렉토리가 아닙니다. 배치 오류들을 방지하기 위하여, deployOnStartUp과 autoDeploy가 false로 설정되어 있었습니다. 다른 오류들이 여전히 발생할 수 있습니다.
hostConfig.canonicalizing=[{1}]의 배치를 제거하려 시도하는 동안, [{0}]을(를) 위한 canonical 경로를 결정할 수 없습니다.
hostConfig.cce=Lifecycle 이벤트 데이터 객체 [{0}]이(가) 호스트 객체가 아닙니다.
hostConfig.context.remove=컨텍스트 [{0}]을(를) 제거하는 중 오류 발생
hostConfig.context.restart=컨텍스트 [{0}]이(가) 다시 시작하는 동안 오류 발생
hostConfig.createDirs=배치를 위한 디렉토리 [{0}]을(를) 생성할 수 없습니다.
hostConfig.deploy.error=웹 애플리케이션 디렉토리 [{0}]을(를) 배치하는 중 예외 발생
hostConfig.deployDescriptor=배치 descriptor [{0}]을(를) 배치합니다.
hostConfig.deployDescriptor.blocked=컨텍스트 경로 [{0}]의 웹 애플리케이션이 배치되지 않았습니다. 왜냐하면 해당 애플리케이션의 안전한 배치에 필요한 설정들이 배치 descriptor [{1}]에 포함되어 있으나, 이 호스트의 deployXML 설정에 의해 배치 descriptor들이 처리 되지 않았기 때문입니다. 이 애플리케이션을 배치하기 위해서는 적절한 descriptor가 [{2}]에 생성되어야 합니다.
hostConfig.deployDescriptor.error=배치 descriptor [{0}]을(를) 배치하는 중 오류 발생
hostConfig.deployDescriptor.finished=배치 descriptor [{0}]의 배치가 [{1}] 밀리초 내에 완료되었습니다.
hostConfig.deployDescriptor.localDocBaseSpecified=호스트 appBase 내의 docBase [{0}]이(가) 지정되었으나, 이는 무시될 것입니다.
hostConfig.deployDescriptor.threaded.error=배치 descriptor들을 배치하려는 멀티 쓰레드 작업이 완료되기를 기다리는 중 오류 발생
hostConfig.deployDir=웹 애플리케이션 디렉토리 [{0}]을(를) 배치합니다.
hostConfig.deployDir.error=웹 애플리케이션 디렉토리 [{0}]을(를) 배치하는 중 오류 발생
hostConfig.deployDir.finished=웹 애플리케이션 디렉토리 [{0}]에 대한 배치가 [{1}] 밀리초에 완료되었습니다.
hostConfig.deployDir.threaded.error=디렉토리들의 멀티 쓰레드 배치 작업이 완료되기를 기다리는 중 오류 발생
hostConfig.deployWar=웹 애플리케이션 아카이브 [{0}]을(를) 배치합니다.
hostConfig.deployWar.error=웹 애플리케이션 아카이브 [{0}]을(를) 배치하는 중 오류 발생
hostConfig.deployWar.finished=웹 애플리케이션 아카이브 [{0}]의 배치가 [{1}] 밀리초에 완료되었습니다.
hostConfig.deployWar.hiddenDir=WAR [{1}]은(는) 우선순위가 높게 처리되어야 하고, unpackWARs가 false이기 때문에, 디렉토리 [{0}]은(는) 무시될 것입니다.
hostConfig.deployWar.threaded.error=WAR 파일들에 대해 멀티 쓰레드 배치 작업들이 완료되기까지 기다리는 중 오류 발생
hostConfig.deploying=발견된 웹 애플리케이션들을 배치합니다.
hostConfig.docBaseUrlInvalid=제공된 docBase는 URL로서 표현될 수 없습니다.
hostConfig.expand=웹 애플리케이션 아카이브 [{0}]의 압축을 풉니다.
hostConfig.expand.error=웹 애플리케이션 아카이브 [{0}]의 압축을 푸는 중 예외 발생
hostConfig.ignorePath=자동 배치를 위해 appBase내의 [{0}] 경로를 무시합니다.
hostConfig.illegalWarName=War 이름[{0}]이(가) 유효하지 않습니다. 이 아카이브는 무시될 것입니다.
hostConfig.jmx.register=컨텍스트 [{0}]을(를) 등록하지 못했습니다.
hostConfig.jmx.unregister=컨텍스트 [{0}]에 대한 등록을 제거하지 못했습니다.
hostConfig.reload=컨텍스트 [{0}]을(를) 다시 로드합니다.
hostConfig.resourceNotAbsolute=[{1}]이(가) 절대 경로가 아니기 때문에, 컨텍스트 [{0}](으)로부터 리소스를 제거할 수 없습니다.
hostConfig.start=HostConfig: 시작 처리 중
hostConfig.stop=HostConfig.stop() 오퍼레이션 처리 중
hostConfig.undeploy=컨텍스트 [{0}]의 배치를 제거합니다.
hostConfig.undeployVersion=활성화된 세션이 없는, 컨텍스트 [{0}]의 이전 버전의 배치를 제거합니다.
passwdUserDatabase.readFail=/etc/passwd로부터 사용자들의 전체 집합을 구하지 못했습니다.
tomcat.addWebapp.conflictChild=이미 존재하는 컨텍스트 [{2}](으)로 인하여, [{0}]에 위치한 WAR를 컨텍스트 경로 [{1}](으)로 배치할 수 없습니다.
tomcat.addWebapp.conflictFile=이미 존재하는 파일 [{2}](으)로 인하여, [{0}]에 위치한 WAR를 컨텍스트 경로 [{1}](으)로 배치할 수 없습니다.
tomcat.baseDirMakeFail=Base 디렉토리로서 사용하기 위한, 디렉토리 [{0}]을(를) 생성할 수 없습니다.
tomcat.baseDirNotDir=base 디렉토리를 위해 지정된 위치 [{0}]은(는) 디렉토리가 아닙니다.
tomcat.homeDirMakeFail=홈 디렉토리로 사용할 디렉토리 [{0}]을(를) 생성할 수 없습니다.
userConfig.database=사용자 데이터베이스를 로드하는 중 예외 발생
userConfig.deploy=사용자 [{0}]을(를) 위해 웹 애플리케이션을 배치합니다.
userConfig.deploy.threaded.error=사용자 디렉토리들의 멀티 쓰레드 배치 작업이 완료되기를 기다리는 중 오류 발생
userConfig.deploying=사용자 웹 애플리케이션들을 배치합니다.
userConfig.error=사용자 [{0}]을(를) 위한 웹 애플리케이션을 배치 중 오류 발생
userConfig.start=UserConfig: START 처리 중
userConfig.stop=UserConfig: STOP 처리 중
versionLoggerListener.arg=명령 행 아규먼트: {0}
versionLoggerListener.catalina.base=CATALINA_BASE: {0}
versionLoggerListener.catalina.home=CATALINA_HOME: {0}
versionLoggerListener.env=환경 변수: {0} = {1}
versionLoggerListener.java.home=자바 홈: {0}
versionLoggerListener.os.arch=아키텍처: {0}
versionLoggerListener.os.name=운영체제 이름: {0}
versionLoggerListener.os.version=운영체제 버전: {0}
versionLoggerListener.prop=시스템 프로퍼티: {0} = {1}
versionLoggerListener.serverInfo.server.built=Server 빌드 시각: {0}
versionLoggerListener.serverInfo.server.number=Server 버전 번호: {0}
versionLoggerListener.serverInfo.server.version=서버 버전 이름: {0}
versionLoggerListener.vm.vendor=JVM 벤더: {0}
versionLoggerListener.vm.version=JVM 버전: {0}
webAnnotationSet.invalidInjection=유효하지 않은 메소드 리소스 injection annotation입니다.

View File

@@ -0,0 +1,22 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
catalina.serverStartFail=Томкат не смог запуститься из-за того что обязательный компонент не смог запуститься
contextConfig.defaultPosition=Произошло в строке [{0}] столбце [{1}]
hostConfig.deployDir=Установка веб приложения в папку [{0}]
userConfig.database=Ошибка при загрузке базы данных пользователей

View File

@@ -0,0 +1,115 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
catalina.noCluster=由于[{0}]未找到群集Ruleset。已禁用群集配置。
catalina.serverStartFail=所必需的服务组件启动失败所以无法启动Tomcat
contextConfig.altDDNotFound=未找到 alt-dd 文件 [{0}]
contextConfig.applicationMissing=web.xml文件丢失只使用默认。
contextConfig.applicationParse=解析应用程序的web.xml错误位置[{0}]
contextConfig.applicationPosition=发生在第[{0}]行,属性[{1}]
contextConfig.applicationStart=正在解析应用程序 web.xml 文件 [{0}]
contextConfig.applicationUrl=无法确定应用程序 web.xml 的URL
contextConfig.authenticatorConfigured=为方法 [{0}] 配置了验证器
contextConfig.authenticatorInstantiate=无法实例化认证类[{0}]
contextConfig.authenticatorMissing=不能配置一个认证为方法[{0}]
contextConfig.authenticatorResources=无法加载认证者映射列表
contextConfig.badUrl=不能处理上下文描述符[{0}]
contextConfig.cce=生命周期事件数据对象[{0}] 不是一个上下文
contextConfig.contextClose=关闭context.xml错误
contextConfig.contextMissing=缺少 context.xml[{0}]
contextConfig.contextParse=解析context.xml错误[{0}]
contextConfig.defaultError=处理默认web.xml错误名称[{0}],位置:[{1}]
contextConfig.defaultMissing=未找到全局 web.xml
contextConfig.defaultPosition=发生在 [{0}] 行 [{1}] 列
contextConfig.destroy=ContextConfig正在销毁
contextConfig.fileUrl=无法从URL[{0}]创建文件对象
contextConfig.fixDocBase=上下文[{0}]的异常修复docBase
contextConfig.init=上下文配置: 正在初始化
contextConfig.inputStreamFile=无法为注解处理文件[{0}]
contextConfig.inputStreamJar=无法处理Jar实体[{0}]的注解Jar[{1}]
contextConfig.inputStreamWebResource=不能处理注释的Web资源[{0}]
contextConfig.invalidSciHandlesTypes=无法为核对一个或多个ServletContentInitializers的注解@HandlesTypes而加载类[{0}]
contextConfig.jarFile=无法处理Jar[{0}]的注解
contextConfig.jspFile.error=JSP文件[{0}]必须以''/''开头。
contextConfig.jspFile.warning=警告在Servlet 2.4 中JSP文件[{0}]必须以‘/’开头
contextConfig.missingRealm=对应的认证领域未配置
contextConfig.processAnnotationsDir.debug=使用注解 [{0}]扫描目录中的类文件
contextConfig.processAnnotationsJar.debug=扫描jar文件中注解[{0}]的类文件
contextConfig.processAnnotationsWebDir.debug=扫描 web 应用程序目录下含有 [{0}] 注解的 class 文件
contextConfig.role.auth=在标签<auth-constraint>的子标签<security-role>中没有定义角色名[{0}]
contextConfig.role.link=<role-link>中使用的安全角色[{0}]未被定义在<security-role>中
contextConfig.role.runas=<run-as> 中使用的安全角色名 [{0}],未在 <security-role> 中定义
contextConfig.servletContainerInitializerFail=无法检测到上下文名称为[{0}]的ServletContainerInitializers
contextConfig.start=ContextConfig开始处理
contextConfig.stop=ContextConfig停止处理
contextConfig.unavailable=由于之前的错误,标记当前应用程序不可用
contextConfig.unknownUrlProtocol=注解解析过程中URL协议[{0}]未识别。忽略URL[{1}]。
contextConfig.urlPatternValue=类文件[{1}]的urlPatterns和值属性上同时设置了注解[{0}]
contextConfig.xmlSettings=上下文[{0}]将解析web.xml和web-fragment.xml文件验证为[{1}],命名空间感知为([{2}]
embedded.notmp=在[{0}]找不到指定的临时文件夹
engineConfig.cce=生命周期事件数据对象[{0}]不是一个引擎(Engine)
engineConfig.stop=配置引擎,处理进程停止。
expandWar.copy=错误的拷贝[{0}] to [{1}]
expandWar.createFailed=无法创建文件夹[{0}]。
expandWar.deleteFailed=[{0}] 无法被彻底删除。其余残留文件可能会导致问题
expandWar.deleteOld=发现一个展开的目录[{0}],它的最后修改时间与关联的WAR不一致.它将被删除.
expandWar.illegalPath=归档[{0}]格式错误,将被忽略:条目包含非扩展到[{2}]的非法路径[{1}]因为它超出了定义的docBase [{3}]
expandWar.missingJarEntry=无法获得 JarEntry [{0}] 的输入流 - WAR 文件是否已损坏?
hostConfig.appBase=主机[{0}]的应用程序基础[{1}]不存在或不是目录。deployOnStartUp和autoDebug已设置为false以防止部署错误。其他错误仍然可能发生。
hostConfig.context.remove=移除上下文[{0}]错误
hostConfig.deployDescriptor.blocked=(:未部署上下文路径为[{0}]的Web应用程序因为它包含一个部署描述符[{1}]该描述符可能包含安全部署应用程序所需的配置但此主机的DeployXML设置阻止了部署描述符的处理。应该在[{2}]创建适当的描述符来部署此应用程序。
hostConfig.deployDescriptor.error=部署描述符[{0}]时出错
hostConfig.deployDescriptor.finished=部署描述符[{0}]的部署已在[{1}]ms内完成
hostConfig.deployDescriptor.localDocBaseSpecified=(:在主机appBase 中指定了docBase [{0}],将被忽略
hostConfig.deployDir=把web 应用程序部署到目录 [{0}]
hostConfig.deployDir.error=无法部署应用目录 [{0}]
hostConfig.deployWar.error=部署 Web 应用程序 archive [{0}] 时出错
hostConfig.deployWar.hiddenDir=将忽略目录[{0}]因为WAR [{1}]优先unpackWAR为false
hostConfig.deployWar.threaded.error=等待WAR文件的多线程部署完成时出错
hostConfig.docBaseUrlInvalid=所提供的部署目录无法用URL来表示
hostConfig.expand.error=解压WEB应用程序文件[{0}]时异常
hostConfig.ignorePath=忽略appBase中的路径[{0}]以进行自动部署
hostConfig.jmx.unregister=移除注册上下文[{0}]失败
hostConfig.start=HostConfig: 开始处理
hostConfig.stop=:)Host配置:停止处理
tomcat.addWebapp.conflictChild=无法在[{0}]处部署到上下文路径[{1}],因为存在上下文[{2}]
tomcat.addWebapp.conflictFile=由于现有文件[{2}]的存在,无法在[{0}]将战争部署到上下文路径[{1}]
tomcat.baseDirNotDir=基本目录指定的位置[{0}]不是一个目录
tomcat.homeDirMakeFail=无法创建用作主目录的目录 [{0}]
userConfig.database=加载用户数据库异常
userConfig.deploy.threaded.error=等待用户目录的多线程部署完成时出错
userConfig.deploying=正在部署用户 web 应用程序
userConfig.error=为用户 [{0}]部署web应用发生错误
userConfig.start=用户配置:处理开始
versionLoggerListener.catalina.home=CATALINA_HOME: {0}
versionLoggerListener.java.home=Java 环境变量: {0}
versionLoggerListener.os.arch=架构: {0}
versionLoggerListener.os.version=OS.版本: {0}
versionLoggerListener.prop=系统属性: {0} = {1}
versionLoggerListener.serverInfo.server.built=服务器构建: {0}
versionLoggerListener.serverInfo.server.number=服务器版本号({0}
versionLoggerListener.serverInfo.server.version=Server.服务器版本: {0}
versionLoggerListener.vm.vendor=JVM.供应商: {0}
versionLoggerListener.vm.version=JVM 版本: {0}
webAnnotationSet.invalidInjection=方法资源注入注解无效。

View File

@@ -0,0 +1,137 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import org.apache.tomcat.util.digester.Digester;
import org.apache.tomcat.util.digester.RuleSetBase;
/**
* <p><strong>RuleSet</strong> for processing the JNDI Enterprise Naming
* Context resource declaration elements.</p>
*
* @author Craig R. McClanahan
* @author Remy Maucherat
*/
@SuppressWarnings("deprecation")
public class NamingRuleSet extends RuleSetBase {
// ----------------------------------------------------- Instance Variables
/**
* The matching pattern prefix to use for recognizing our elements.
*/
protected final String prefix;
// ------------------------------------------------------------ Constructor
/**
* Construct an instance of this <code>RuleSet</code> with the default
* matching pattern prefix.
*/
public NamingRuleSet() {
this("");
}
/**
* Construct an instance of this <code>RuleSet</code> with the specified
* matching pattern prefix.
*
* @param prefix Prefix for matching pattern rules (including the
* trailing slash character)
*/
public NamingRuleSet(String prefix) {
this.prefix = prefix;
}
// --------------------------------------------------------- Public Methods
/**
* <p>Add the set of Rule instances defined in this RuleSet to the
* specified <code>Digester</code> instance, associating them with
* our namespace URI (if any). This method should only be called
* by a Digester instance.</p>
*
* @param digester Digester instance to which the new Rule instances
* should be added.
*/
@Override
public void addRuleInstances(Digester digester) {
digester.addObjectCreate(prefix + "Ejb",
"org.apache.tomcat.util.descriptor.web.ContextEjb");
digester.addRule(prefix + "Ejb", new SetAllPropertiesRule());
digester.addRule(prefix + "Ejb",
new SetNextNamingRule("addEjb",
"org.apache.tomcat.util.descriptor.web.ContextEjb"));
digester.addObjectCreate(prefix + "Environment",
"org.apache.tomcat.util.descriptor.web.ContextEnvironment");
digester.addSetProperties(prefix + "Environment");
digester.addRule(prefix + "Environment",
new SetNextNamingRule("addEnvironment",
"org.apache.tomcat.util.descriptor.web.ContextEnvironment"));
digester.addObjectCreate(prefix + "LocalEjb",
"org.apache.tomcat.util.descriptor.web.ContextLocalEjb");
digester.addRule(prefix + "LocalEjb", new SetAllPropertiesRule());
digester.addRule(prefix + "LocalEjb",
new SetNextNamingRule("addLocalEjb",
"org.apache.tomcat.util.descriptor.web.ContextLocalEjb"));
digester.addObjectCreate(prefix + "Resource",
"org.apache.tomcat.util.descriptor.web.ContextResource");
digester.addRule(prefix + "Resource", new SetAllPropertiesRule());
digester.addRule(prefix + "Resource",
new SetNextNamingRule("addResource",
"org.apache.tomcat.util.descriptor.web.ContextResource"));
digester.addObjectCreate(prefix + "ResourceEnvRef",
"org.apache.tomcat.util.descriptor.web.ContextResourceEnvRef");
digester.addRule(prefix + "ResourceEnvRef", new SetAllPropertiesRule());
digester.addRule(prefix + "ResourceEnvRef",
new SetNextNamingRule("addResourceEnvRef",
"org.apache.tomcat.util.descriptor.web.ContextResourceEnvRef"));
digester.addObjectCreate(prefix + "ServiceRef",
"org.apache.tomcat.util.descriptor.web.ContextService");
digester.addRule(prefix + "ServiceRef", new SetAllPropertiesRule());
digester.addRule(prefix + "ServiceRef",
new SetNextNamingRule("addService",
"org.apache.tomcat.util.descriptor.web.ContextService"));
digester.addObjectCreate(prefix + "Transaction",
"org.apache.tomcat.util.descriptor.web.ContextTransaction");
digester.addRule(prefix + "Transaction", new SetAllPropertiesRule());
digester.addRule(prefix + "Transaction",
new SetNextNamingRule("setTransaction",
"org.apache.tomcat.util.descriptor.web.ContextTransaction"));
}
}

View File

@@ -0,0 +1,117 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.Enumeration;
import java.util.Hashtable;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.naming.StringManager;
/**
* Concrete implementation of the <code>UserDatabase</code> interface
* that processes the <code>/etc/passwd</code> file on a Unix system.
*
* @author Craig R. McClanahan
*/
public final class PasswdUserDatabase implements UserDatabase {
private static final Log log = LogFactory.getLog(PasswdUserDatabase.class);
private static final StringManager sm = StringManager.getManager(PasswdUserDatabase.class);
/**
* The pathname of the Unix password file.
*/
private static final String PASSWORD_FILE = "/etc/passwd";
/**
* The set of home directories for all defined users, keyed by username.
*/
private final Hashtable<String,String> homes = new Hashtable<>();
/**
* The UserConfig listener with which we are associated.
*/
private UserConfig userConfig = null;
/**
* Return the UserConfig listener with which we are associated.
*/
@Override
public UserConfig getUserConfig() {
return userConfig;
}
/**
* Set the UserConfig listener with which we are associated.
*
* @param userConfig The new UserConfig listener
*/
@Override
public void setUserConfig(UserConfig userConfig) {
this.userConfig = userConfig;
init();
}
/**
* Return an absolute pathname to the home directory for the specified user.
*
* @param user User for which a home directory should be retrieved
*/
@Override
public String getHome(String user) {
return homes.get(user);
}
/**
* Return an enumeration of the usernames defined on this server.
*/
@Override
public Enumeration<String> getUsers() {
return homes.keys();
}
/**
* Initialize our set of users and home directories.
*/
private void init() {
try (BufferedReader reader = new BufferedReader(new FileReader(PASSWORD_FILE))) {
String line = reader.readLine();
while (line != null) {
String tokens[] = line.split(":");
// Need non-zero 1st and 6th tokens
if (tokens.length > 5 && tokens[0].length() > 0 && tokens[5].length() > 0) {
// Add this user and corresponding directory
homes.put(tokens[0], tokens[5]);
}
line = reader.readLine();
}
} catch (Exception e) {
log.warn(sm.getString("passwdUserDatabase.readFail"), e);
}
}
}

View File

@@ -0,0 +1,103 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import org.apache.tomcat.util.digester.Digester;
import org.apache.tomcat.util.digester.RuleSetBase;
/**
* <p><strong>RuleSet</strong> for processing the contents of a Realm definition
* element. This <code>RuleSet</code> supports Realms such as the
* <code>CombinedRealm</code> that used nested Realms.</p>
*/
@SuppressWarnings("deprecation")
public class RealmRuleSet extends RuleSetBase {
private static final int MAX_NESTED_REALM_LEVELS = Integer.getInteger(
"org.apache.catalina.startup.RealmRuleSet.MAX_NESTED_REALM_LEVELS",
3).intValue();
// ----------------------------------------------------- Instance Variables
/**
* The matching pattern prefix to use for recognizing our elements.
*/
protected final String prefix;
// ------------------------------------------------------------ Constructor
/**
* Construct an instance of this <code>RuleSet</code> with the default
* matching pattern prefix.
*/
public RealmRuleSet() {
this("");
}
/**
* Construct an instance of this <code>RuleSet</code> with the specified
* matching pattern prefix.
*
* @param prefix Prefix for matching pattern rules (including the
* trailing slash character)
*/
public RealmRuleSet(String prefix) {
this.prefix = prefix;
}
// --------------------------------------------------------- Public Methods
/**
* <p>Add the set of Rule instances defined in this RuleSet to the
* specified <code>Digester</code> instance, associating them with
* our namespace URI (if any). This method should only be called
* by a Digester instance.</p>
*
* @param digester Digester instance to which the new Rule instances
* should be added.
*/
@Override
public void addRuleInstances(Digester digester) {
StringBuilder pattern = new StringBuilder(prefix);
for (int i = 0; i < MAX_NESTED_REALM_LEVELS; i++) {
if (i > 0) {
pattern.append('/');
}
pattern.append("Realm");
addRuleInstances(digester, pattern.toString(), i == 0 ? "setRealm" : "addRealm");
}
}
private void addRuleInstances(Digester digester, String pattern, String methodName) {
digester.addObjectCreate(pattern, null /* MUST be specified in the element */,
"className");
digester.addSetProperties(pattern);
digester.addSetNext(pattern, methodName, "org.apache.catalina.Realm");
digester.addRuleSet(new CredentialHandlerRuleSet(pattern + "/"));
}
}

View File

@@ -0,0 +1,46 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.ForkJoinPool.ForkJoinWorkerThreadFactory;
import java.util.concurrent.ForkJoinWorkerThread;
/**
* Provides a {@link ForkJoinWorkerThreadFactory} that provides {@link
* ForkJoinWorkerThread}s that won't trigger memory leaks due to retained
* references to web application class loaders.
* <p>
* Note: This class must be available on the boot strap class path for it to be
* visible to {@link ForkJoinPool}.
*/
public class SafeForkJoinWorkerThreadFactory implements ForkJoinWorkerThreadFactory {
@Override
public ForkJoinWorkerThread newThread(ForkJoinPool pool) {
return new SafeForkJoinWorkerThread(pool);
}
private static class SafeForkJoinWorkerThread extends ForkJoinWorkerThread {
protected SafeForkJoinWorkerThread(ForkJoinPool pool) {
super(pool);
setContextClassLoader(ForkJoinPool.class.getClassLoader());
}
}
}

View File

@@ -0,0 +1,79 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import java.util.HashMap;
import org.apache.tomcat.util.IntrospectionUtils;
import org.apache.tomcat.util.digester.Rule;
import org.xml.sax.Attributes;
/**
* Rule that uses the introspection utils to set properties.
*
* @author Remy Maucherat
*/
public class SetAllPropertiesRule extends Rule {
// ----------------------------------------------------------- Constructors
public SetAllPropertiesRule() {}
public SetAllPropertiesRule(String[] exclude) {
for (int i=0; i<exclude.length; i++ ) if (exclude[i]!=null) this.excludes.put(exclude[i],exclude[i]);
}
// ----------------------------------------------------- Instance Variables
protected final HashMap<String,String> excludes = new HashMap<>();
// --------------------------------------------------------- Public Methods
/**
* Handle the beginning of an XML element.
*
* @param attributes The attributes of this element
*
* @exception Exception if a processing error occurs
*/
@Override
public void begin(String namespace, String nameX, Attributes attributes)
throws Exception {
for (int i = 0; i < attributes.getLength(); i++) {
String name = attributes.getLocalName(i);
if ("".equals(name)) {
name = attributes.getQName(i);
}
String value = attributes.getValue(i);
if ( !excludes.containsKey(name)) {
if (!digester.isFakeAttribute(digester.peek(), name)
&& !IntrospectionUtils.setProperty(digester.peek(), name, value)
&& digester.getRulesValidation()) {
digester.getLogger().warn("[SetAllPropertiesRule]{" + digester.getMatch() +
"} Setting property '" + name + "' to '" +
value + "' did not find a matching property.");
}
}
}
}
}

View File

@@ -0,0 +1,75 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import org.apache.tomcat.util.IntrospectionUtils;
import org.apache.tomcat.util.digester.Rule;
import org.xml.sax.Attributes;
/**
* Rule that uses the introspection utils to set properties of a context
* (everything except "path").
*
* @author Remy Maucherat
*/
public class SetContextPropertiesRule extends Rule {
// ----------------------------------------------------------- Constructors
// ----------------------------------------------------- Instance Variables
// --------------------------------------------------------- Public Methods
/**
* Handle the beginning of an XML element.
*
* @param attributes The attributes of this element
*
* @exception Exception if a processing error occurs
*/
@Override
public void begin(String namespace, String nameX, Attributes attributes)
throws Exception {
for (int i = 0; i < attributes.getLength(); i++) {
String name = attributes.getLocalName(i);
if ("".equals(name)) {
name = attributes.getQName(i);
}
if ("path".equals(name) || "docBase".equals(name)) {
continue;
}
String value = attributes.getValue(i);
if (!digester.isFakeAttribute(digester.peek(), name)
&& !IntrospectionUtils.setProperty(digester.peek(), name, value)
&& digester.getRulesValidation()) {
digester.getLogger().warn("[SetContextPropertiesRule]{" + digester.getMatch() +
"} Setting property '" + name + "' to '" +
value + "' did not find a matching property.");
}
}
}
}

View File

@@ -0,0 +1,125 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import org.apache.catalina.Context;
import org.apache.catalina.deploy.NamingResourcesImpl;
import org.apache.tomcat.util.IntrospectionUtils;
import org.apache.tomcat.util.digester.Rule;
/**
* <p>Rule implementation that calls a method on the (top-1) (parent)
* object, passing the top object (child) as an argument. It is
* commonly used to establish parent-child relationships.</p>
*
* <p>This rule now supports more flexible method matching by default.
* It is possible that this may break (some) code
* written against release 1.1.1 or earlier.
* </p>
*/
public class SetNextNamingRule extends Rule {
// ----------------------------------------------------------- Constructors
/**
* Construct a "set next" rule with the specified method name.
*
* @param methodName Method name of the parent method to call
* @param paramType Java class of the parent method's argument
* (if you wish to use a primitive type, specify the corresponding
* Java wrapper class instead, such as <code>java.lang.Boolean</code>
* for a <code>boolean</code> parameter)
*/
public SetNextNamingRule(String methodName,
String paramType) {
this.methodName = methodName;
this.paramType = paramType;
}
// ----------------------------------------------------- Instance Variables
/**
* The method name to call on the parent object.
*/
protected final String methodName;
/**
* The Java class name of the parameter type expected by the method.
*/
protected final String paramType;
// --------------------------------------------------------- Public Methods
/**
* Process the end of this element.
*
* @param namespace the namespace URI of the matching element, or an
* empty string if the parser is not namespace aware or the element has
* no namespace
* @param name the local name if the parser is namespace aware, or just
* the element name otherwise
*/
@Override
public void end(String namespace, String name) throws Exception {
// Identify the objects to be used
Object child = digester.peek(0);
Object parent = digester.peek(1);
NamingResourcesImpl namingResources = null;
if (parent instanceof Context) {
namingResources = ((Context) parent).getNamingResources();
} else {
namingResources = (NamingResourcesImpl) parent;
}
// Call the specified method
IntrospectionUtils.callMethod1(namingResources, methodName,
child, paramType, digester.getClassLoader());
}
/**
* Render a printable version of this Rule.
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder("SetNextRule[");
sb.append("methodName=");
sb.append(methodName);
sb.append(", paramType=");
sb.append(paramType);
sb.append("]");
return sb.toString();
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,250 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import java.io.File;
import java.lang.reflect.Method;
import java.util.ArrayList;
import org.apache.catalina.Globals;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.tomcat.util.ExceptionUtils;
/**
* <p>General purpose wrapper for command line tools that should execute in an
* environment with the common class loader environment set up by Catalina.
* This should be executed from a command line script that conforms to
* the following requirements:</p>
* <ul>
* <li>Passes the <code>catalina.home</code> system property configured with
* the pathname of the Tomcat installation directory.</li>
* <li>Sets the system classpath to include <code>bootstrap.jar</code> and
* <code>$JAVA_HOME/lib/tools.jar</code>.</li>
* </ul>
*
* <p>The command line to execute the tool looks like:</p>
* <pre>
* java -classpath $CLASSPATH org.apache.catalina.startup.Tool \
* ${options} ${classname} ${arguments}
* </pre>
*
* <p>with the following replacement contents:
* <ul>
* <li><strong>${options}</strong> - Command line options for this Tool wrapper.
* The following options are supported:
* <ul>
* <li><em>-ant</em> : Set the <code>ant.home</code> system property
* to corresponding to the value of <code>catalina.home</code>
* (useful when your command line tool runs Ant).</li>
* <li><em>-common</em> : Add <code>common/classes</code> and
* <code>common/lib</code> to the class loader repositories.</li>
* <li><em>-server</em> : Add <code>server/classes</code> and
* <code>server/lib</code> to the class loader repositories.</li>
* <li><em>-shared</em> : Add <code>shared/classes</code> and
* <code>shared/lib</code> to the class loader repositories.</li>
* </ul>
* <li><strong>${classname}</strong> - Fully qualified Java class name of the
* application's main class.</li>
* <li><strong>${arguments}</strong> - Command line arguments to be passed to
* the application's <code>main()</code> method.</li>
* </ul>
*
* @author Craig R. McClanahan
*/
public final class Tool {
private static final Log log = LogFactory.getLog(Tool.class);
// ------------------------------------------------------- Static Variables
/**
* Set <code>ant.home</code> system property?
*/
private static boolean ant = false;
/**
* The pathname of our installation base directory.
*/
private static final String catalinaHome =
System.getProperty(Globals.CATALINA_HOME_PROP);
/**
* Include common classes in the repositories?
*/
private static boolean common = false;
/**
* Include server classes in the repositories?
*/
private static boolean server = false;
/**
* Include shared classes in the repositories?
*/
private static boolean shared = false;
// ----------------------------------------------------------- Main Program
/**
* The main program for the bootstrap.
*
* @param args Command line arguments to be processed
*/
@SuppressWarnings("null")
public static void main(String args[]) {
// Verify that "catalina.home" was passed.
if (catalinaHome == null) {
log.error("Must set '" + Globals.CATALINA_HOME_PROP + "' system property");
System.exit(1);
}
// Process command line options
int index = 0;
while (true) {
if (index == args.length) {
usage();
System.exit(1);
}
if ("-ant".equals(args[index]))
ant = true;
else if ("-common".equals(args[index]))
common = true;
else if ("-server".equals(args[index]))
server = true;
else if ("-shared".equals(args[index]))
shared = true;
else
break;
index++;
}
if (index > args.length) {
usage();
System.exit(1);
}
// Set "ant.home" if requested
if (ant)
System.setProperty("ant.home", catalinaHome);
// Construct the class loader we will be using
ClassLoader classLoader = null;
try {
ArrayList<File> packed = new ArrayList<>();
ArrayList<File> unpacked = new ArrayList<>();
unpacked.add(new File(catalinaHome, "classes"));
packed.add(new File(catalinaHome, "lib"));
if (common) {
unpacked.add(new File(catalinaHome,
"common" + File.separator + "classes"));
packed.add(new File(catalinaHome,
"common" + File.separator + "lib"));
}
if (server) {
unpacked.add(new File(catalinaHome,
"server" + File.separator + "classes"));
packed.add(new File(catalinaHome,
"server" + File.separator + "lib"));
}
if (shared) {
unpacked.add(new File(catalinaHome,
"shared" + File.separator + "classes"));
packed.add(new File(catalinaHome,
"shared" + File.separator + "lib"));
}
classLoader =
ClassLoaderFactory.createClassLoader
(unpacked.toArray(new File[0]),
packed.toArray(new File[0]),
null);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.error("Class loader creation threw exception", t);
System.exit(1);
}
Thread.currentThread().setContextClassLoader(classLoader);
// Load our application class
Class<?> clazz = null;
String className = args[index++];
try {
if (log.isDebugEnabled())
log.debug("Loading application class " + className);
clazz = classLoader.loadClass(className);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.error("Exception creating instance of " + className, t);
System.exit(1);
}
Method method = null;
String params[] = new String[args.length - index];
System.arraycopy(args, index, params, 0, params.length);
try {
if (log.isDebugEnabled())
log.debug("Identifying main() method");
String methodName = "main";
Class<?> paramTypes[] = new Class[1];
paramTypes[0] = params.getClass();
method = clazz.getMethod(methodName, paramTypes);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.error("Exception locating main() method", t);
System.exit(1);
}
// Invoke the main method of the application class
try {
if (log.isDebugEnabled())
log.debug("Calling main() method");
Object paramValues[] = new Object[1];
paramValues[0] = params;
method.invoke(null, paramValues);
} catch (Throwable t) {
t = ExceptionUtils.unwrapInvocationTargetException(t);
ExceptionUtils.handleThrowable(t);
log.error("Exception calling main() method", t);
System.exit(1);
}
}
/**
* Display usage information about this tool.
*/
private static void usage() {
log.info("Usage: java org.apache.catalina.startup.Tool [<options>] <class> [<arguments>]");
}
}

View File

@@ -0,0 +1,418 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import java.io.File;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.regex.Pattern;
import org.apache.catalina.Context;
import org.apache.catalina.Host;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleListener;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.tomcat.util.res.StringManager;
/**
* Startup event listener for a <b>Host</b> that configures Contexts (web
* applications) for all defined "users" who have a web application in a
* directory with the specified name in their home directories. The context
* path of each deployed application will be set to <code>~xxxxx</code>, where
* xxxxx is the username of the owning user for that web application
*
* @author Craig R. McClanahan
*/
public final class UserConfig
implements LifecycleListener {
private static final Log log = LogFactory.getLog(UserConfig.class);
// ----------------------------------------------------- Instance Variables
/**
* The Java class name of the Context configuration class we should use.
*/
private String configClass = "org.apache.catalina.startup.ContextConfig";
/**
* The Java class name of the Context implementation we should use.
*/
private String contextClass = "org.apache.catalina.core.StandardContext";
/**
* The directory name to be searched for within each user home directory.
*/
private String directoryName = "public_html";
/**
* The base directory containing user home directories.
*/
private String homeBase = null;
/**
* The Host we are associated with.
*/
private Host host = null;
/**
* The string resources for this package.
*/
private static final StringManager sm =
StringManager.getManager(Constants.Package);
/**
* The Java class name of the user database class we should use.
*/
private String userClass =
"org.apache.catalina.startup.PasswdUserDatabase";
/**
* A regular expression defining user who deployment is allowed.
*/
Pattern allow = null;
/**
* A regular expression defining user who deployment is denied.
*/
Pattern deny = null;
// ------------------------------------------------------------- Properties
/**
* @return the Context configuration class name.
*/
public String getConfigClass() {
return this.configClass;
}
/**
* Set the Context configuration class name.
*
* @param configClass The new Context configuration class name.
*/
public void setConfigClass(String configClass) {
this.configClass = configClass;
}
/**
* @return the Context implementation class name.
*/
public String getContextClass() {
return this.contextClass;
}
/**
* Set the Context implementation class name.
*
* @param contextClass The new Context implementation class name.
*/
public void setContextClass(String contextClass) {
this.contextClass = contextClass;
}
/**
* @return the directory name for user web applications.
*/
public String getDirectoryName() {
return this.directoryName;
}
/**
* Set the directory name for user web applications.
*
* @param directoryName The new directory name
*/
public void setDirectoryName(String directoryName) {
this.directoryName = directoryName;
}
/**
* @return the base directory containing user home directories.
*/
public String getHomeBase() {
return this.homeBase;
}
/**
* Set the base directory containing user home directories.
*
* @param homeBase The new base directory
*/
public void setHomeBase(String homeBase) {
this.homeBase = homeBase;
}
/**
* @return the user database class name for this component.
*/
public String getUserClass() {
return this.userClass;
}
/**
* Set the user database class name for this component.
* @param userClass The user database class name
*/
public void setUserClass(String userClass) {
this.userClass = userClass;
}
/**
* @return the regular expression used to test for user who deployment is allowed.
*/
public String getAllow() {
if (allow == null) return null;
return allow.toString();
}
/**
* Set the regular expression used to test for user who deployment is allowed.
*
* @param allow The new allow expression
*/
public void setAllow(String allow) {
if (allow == null || allow.length() == 0) {
this.allow = null;
} else {
this.allow = Pattern.compile(allow);
}
}
/**
* @return the regular expression used to test for user who deployment is denied.
*/
public String getDeny() {
if (deny == null) return null;
return deny.toString();
}
/**
* Set the regular expression used to test for user who deployment is denied.
*
* @param deny The new deny expression
*/
public void setDeny(String deny) {
if (deny == null || deny.length() == 0) {
this.deny = null;
} else {
this.deny = Pattern.compile(deny);
}
}
// --------------------------------------------------------- Public Methods
/**
* Process the START event for an associated Host.
*
* @param event The lifecycle event that has occurred
*/
@Override
public void lifecycleEvent(LifecycleEvent event) {
// Identify the host we are associated with
try {
host = (Host) event.getLifecycle();
} catch (ClassCastException e) {
log.error(sm.getString("hostConfig.cce", event.getLifecycle()), e);
return;
}
// Process the event that has occurred
if (event.getType().equals(Lifecycle.START_EVENT))
start();
else if (event.getType().equals(Lifecycle.STOP_EVENT))
stop();
}
// -------------------------------------------------------- Private Methods
/**
* Deploy a web application for any user who has a web application present
* in a directory with a specified name within their home directory.
*/
private void deploy() {
if (host.getLogger().isDebugEnabled())
host.getLogger().debug(sm.getString("userConfig.deploying"));
// Load the user database object for this host
UserDatabase database = null;
try {
Class<?> clazz = Class.forName(userClass);
database = (UserDatabase) clazz.getConstructor().newInstance();
database.setUserConfig(this);
} catch (Exception e) {
host.getLogger().error(sm.getString("userConfig.database"), e);
return;
}
ExecutorService executor = host.getStartStopExecutor();
List<Future<?>> results = new ArrayList<>();
// Deploy the web application (if any) for each defined user
Enumeration<String> users = database.getUsers();
while (users.hasMoreElements()) {
String user = users.nextElement();
if (!isDeployAllowed(user)) continue;
String home = database.getHome(user);
results.add(executor.submit(new DeployUserDirectory(this, user, home)));
}
for (Future<?> result : results) {
try {
result.get();
} catch (Exception e) {
host.getLogger().error(sm.getString("userConfig.deploy.threaded.error"), e);
}
}
}
/**
* Deploy a web application for the specified user if they have such an
* application in the defined directory within their home directory.
*
* @param user Username owning the application to be deployed
* @param home Home directory of this user
*/
private void deploy(String user, String home) {
// Does this user have a web application to be deployed?
String contextPath = "/~" + user;
if (host.findChild(contextPath) != null)
return;
File app = new File(home, directoryName);
if (!app.exists() || !app.isDirectory())
return;
host.getLogger().info(sm.getString("userConfig.deploy", user));
// Deploy the web application for this user
try {
Class<?> clazz = Class.forName(contextClass);
Context context = (Context) clazz.getConstructor().newInstance();
context.setPath(contextPath);
context.setDocBase(app.toString());
clazz = Class.forName(configClass);
LifecycleListener listener = (LifecycleListener) clazz.getConstructor().newInstance();
context.addLifecycleListener(listener);
host.addChild(context);
} catch (Exception e) {
host.getLogger().error(sm.getString("userConfig.error", user), e);
}
}
/**
* Process a "start" event for this Host.
*/
private void start() {
if (host.getLogger().isDebugEnabled())
host.getLogger().debug(sm.getString("userConfig.start"));
deploy();
}
/**
* Process a "stop" event for this Host.
*/
private void stop() {
if (host.getLogger().isDebugEnabled())
host.getLogger().debug(sm.getString("userConfig.stop"));
}
/**
* Test allow and deny rules for the provided user.
*
* @return <code>true</code> if this user is allowed to deploy,
* <code>false</code> otherwise
*/
private boolean isDeployAllowed(String user) {
if (deny != null && deny.matcher(user).matches()) {
return false;
}
if (allow != null) {
if (allow.matcher(user).matches()) {
return true;
} else {
return false;
}
}
return true;
}
private static class DeployUserDirectory implements Runnable {
private UserConfig config;
private String user;
private String home;
public DeployUserDirectory(UserConfig config, String user, String home) {
this.config = config;
this.user = user;
this.home= home;
}
@Override
public void run() {
config.deploy(user, home);
}
}
}

View File

@@ -0,0 +1,68 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import java.util.Enumeration;
/**
* Abstraction of the set of users defined by the operating system on the
* current server platform.
*
* @author Craig R. McClanahan
*/
public interface UserDatabase {
// ----------------------------------------------------------- Properties
/**
* @return the UserConfig listener with which we are associated.
*/
public UserConfig getUserConfig();
/**
* Set the UserConfig listener with which we are associated.
*
* @param userConfig The new UserConfig listener
*/
public void setUserConfig(UserConfig userConfig);
// ------------------------------------------------------- Public Methods
/**
* @return an absolute pathname to the home directory for the specified user.
*
* @param user User for which a home directory should be retrieved
*/
public String getHome(String user);
/**
* @return an enumeration of the usernames defined on this server.
*/
public Enumeration<String> getUsers();
}

View File

@@ -0,0 +1,136 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import java.lang.management.ManagementFactory;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.util.ServerInfo;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.tomcat.util.res.StringManager;
/**
* Logs version information on startup.
*/
public class VersionLoggerListener implements LifecycleListener {
private static final Log log = LogFactory.getLog(VersionLoggerListener.class);
/**
* The string manager for this package.
*/
protected static final StringManager sm = StringManager.getManager(Constants.Package);
private boolean logArgs = true;
private boolean logEnv = false;
private boolean logProps = false;
public boolean getLogArgs() {
return logArgs;
}
public void setLogArgs(boolean logArgs) {
this.logArgs = logArgs;
}
public boolean getLogEnv() {
return logEnv;
}
public void setLogEnv(boolean logEnv) {
this.logEnv = logEnv;
}
public boolean getLogProps() {
return logProps;
}
public void setLogProps(boolean logProps) {
this.logProps = logProps;
}
@Override
public void lifecycleEvent(LifecycleEvent event) {
if (Lifecycle.BEFORE_INIT_EVENT.equals(event.getType())) {
log();
}
}
private void log() {
log.info(sm.getString("versionLoggerListener.serverInfo.server.version",
ServerInfo.getServerInfo()));
log.info(sm.getString("versionLoggerListener.serverInfo.server.built",
ServerInfo.getServerBuilt()));
log.info(sm.getString("versionLoggerListener.serverInfo.server.number",
ServerInfo.getServerNumber()));
log.info(sm.getString("versionLoggerListener.os.name",
System.getProperty("os.name")));
log.info(sm.getString("versionLoggerListener.os.version",
System.getProperty("os.version")));
log.info(sm.getString("versionLoggerListener.os.arch",
System.getProperty("os.arch")));
log.info(sm.getString("versionLoggerListener.java.home",
System.getProperty("java.home")));
log.info(sm.getString("versionLoggerListener.vm.version",
System.getProperty("java.runtime.version")));
log.info(sm.getString("versionLoggerListener.vm.vendor",
System.getProperty("java.vm.vendor")));
log.info(sm.getString("versionLoggerListener.catalina.base",
System.getProperty("catalina.base")));
log.info(sm.getString("versionLoggerListener.catalina.home",
System.getProperty("catalina.home")));
if (logArgs) {
List<String> args = ManagementFactory.getRuntimeMXBean().getInputArguments();
for (String arg : args) {
log.info(sm.getString("versionLoggerListener.arg", arg));
}
}
if (logEnv) {
SortedMap<String, String> sortedMap = new TreeMap<>(System.getenv());
for (Map.Entry<String, String> e : sortedMap.entrySet()) {
log.info(sm.getString("versionLoggerListener.env", e.getKey(), e.getValue()));
}
}
if (logProps) {
SortedMap<String, String> sortedMap = new TreeMap<>();
for (Map.Entry<Object, Object> e : System.getProperties().entrySet()) {
sortedMap.put(String.valueOf(e.getKey()), String.valueOf(e.getValue()));
}
for (Map.Entry<String, String> e : sortedMap.entrySet()) {
log.info(sm.getString("versionLoggerListener.prop", e.getKey(), e.getValue()));
}
}
}
}

View File

@@ -0,0 +1,442 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import javax.annotation.Resource;
import javax.annotation.Resources;
import javax.annotation.security.DeclareRoles;
import javax.annotation.security.RunAs;
import javax.servlet.ServletSecurityElement;
import javax.servlet.annotation.ServletSecurity;
import org.apache.catalina.Container;
import org.apache.catalina.Context;
import org.apache.catalina.Wrapper;
import org.apache.catalina.core.ApplicationServletRegistration;
import org.apache.catalina.util.Introspection;
import org.apache.tomcat.util.descriptor.web.ContextEnvironment;
import org.apache.tomcat.util.descriptor.web.ContextResource;
import org.apache.tomcat.util.descriptor.web.ContextResourceEnvRef;
import org.apache.tomcat.util.descriptor.web.ContextService;
import org.apache.tomcat.util.descriptor.web.FilterDef;
import org.apache.tomcat.util.descriptor.web.MessageDestinationRef;
import org.apache.tomcat.util.res.StringManager;
/**
* <strong>AnnotationSet</strong> for processing the annotations of the web
* application classes (<code>/WEB-INF/classes</code> and
* <code>/WEB-INF/lib</code>).
*/
public class WebAnnotationSet {
private static final String SEPARATOR = "/";
private static final String MAPPED_NAME_PROPERTY = "mappedName";
/**
* The string resources for this package.
*/
protected static final StringManager sm = StringManager.getManager(Constants.Package);
// ---------------------------------------------------------- Public Methods
/**
* Process the annotations on a context.
*
* @param context The context which will have its annotations processed
*/
public static void loadApplicationAnnotations(Context context) {
loadApplicationListenerAnnotations(context);
loadApplicationFilterAnnotations(context);
loadApplicationServletAnnotations(context);
}
// ------------------------------------------------------- Protected Methods
/**
* Process the annotations for the listeners.
*
* @param context The context which will have its annotations processed
*/
protected static void loadApplicationListenerAnnotations(Context context) {
String[] applicationListeners = context.findApplicationListeners();
for (String className : applicationListeners) {
Class<?> clazz = Introspection.loadClass(context, className);
if (clazz == null) {
continue;
}
loadClassAnnotation(context, clazz);
loadFieldsAnnotation(context, clazz);
loadMethodsAnnotation(context, clazz);
}
}
/**
* Process the annotations for the filters.
*
* @param context The context which will have its annotations processed
*/
protected static void loadApplicationFilterAnnotations(Context context) {
FilterDef[] filterDefs = context.findFilterDefs();
for (FilterDef filterDef : filterDefs) {
Class<?> clazz = Introspection.loadClass(context, filterDef.getFilterClass());
if (clazz == null) {
continue;
}
loadClassAnnotation(context, clazz);
loadFieldsAnnotation(context, clazz);
loadMethodsAnnotation(context, clazz);
}
}
/**
* Process the annotations for the servlets.
*
* @param context The context which will have its annotations processed
*/
protected static void loadApplicationServletAnnotations(Context context) {
Container[] children = context.findChildren();
for (Container child : children) {
if (child instanceof Wrapper) {
Wrapper wrapper = (Wrapper) child;
if (wrapper.getServletClass() == null) {
continue;
}
Class<?> clazz = Introspection.loadClass(context, wrapper.getServletClass());
if (clazz == null) {
continue;
}
loadClassAnnotation(context, clazz);
loadFieldsAnnotation(context, clazz);
loadMethodsAnnotation(context, clazz);
/* Process RunAs annotation which can be only on servlets.
* Ref JSR 250, equivalent to the run-as element in
* the deployment descriptor
*/
RunAs runAs = clazz.getAnnotation(RunAs.class);
if (runAs != null) {
wrapper.setRunAs(runAs.value());
}
// Process ServletSecurity annotation
ServletSecurity servletSecurity = clazz.getAnnotation(ServletSecurity.class);
if (servletSecurity != null) {
context.addServletSecurity(
new ApplicationServletRegistration(wrapper, context),
new ServletSecurityElement(servletSecurity));
}
}
}
}
/**
* Process the annotations on a context for a given className.
*
* @param context The context which will have its annotations processed
* @param clazz The class to examine for Servlet annotations
*/
protected static void loadClassAnnotation(Context context,
Class<?> clazz) {
/* Process Resource annotation.
* Ref JSR 250
*/
Resource resourceAnnotation = clazz.getAnnotation(Resource.class);
if (resourceAnnotation != null) {
addResource(context, resourceAnnotation);
}
/* Process Resources annotation.
* Ref JSR 250
*/
Resources resourcesAnnotation = clazz.getAnnotation(Resources.class);
if (resourcesAnnotation != null && resourcesAnnotation.value() != null) {
for (Resource resource : resourcesAnnotation.value()) {
addResource(context, resource);
}
}
/* Process EJB annotation.
* Ref JSR 224, equivalent to the ejb-ref or ejb-local-ref
* element in the deployment descriptor.
{
EJB annotation = clazz.getAnnotation(EJB.class);
if (annotation != null) {
if ((annotation.mappedName().length() == 0)
|| annotation.mappedName().equals("Local")) {
ContextLocalEjb ejb = new ContextLocalEjb();
ejb.setName(annotation.name());
ejb.setType(annotation.beanInterface().getCanonicalName());
ejb.setDescription(annotation.description());
ejb.setHome(annotation.beanName());
context.getNamingResources().addLocalEjb(ejb);
} else if (annotation.mappedName().equals("Remote")) {
ContextEjb ejb = new ContextEjb();
ejb.setName(annotation.name());
ejb.setType(annotation.beanInterface().getCanonicalName());
ejb.setDescription(annotation.description());
ejb.setHome(annotation.beanName());
context.getNamingResources().addEjb(ejb);
}
}
}
*/
/* Process WebServiceRef annotation.
* Ref JSR 224, equivalent to the service-ref element in
* the deployment descriptor.
* The service-ref registration is not implemented
{
WebServiceRef annotation = clazz
.getAnnotation(WebServiceRef.class);
if (annotation != null) {
ContextService service = new ContextService();
service.setName(annotation.name());
service.setWsdlfile(annotation.wsdlLocation());
service.setType(annotation.type().getCanonicalName());
if (annotation.value() == null)
service.setServiceinterface(annotation.type()
.getCanonicalName());
if (annotation.type().getCanonicalName().equals("Service"))
service.setServiceinterface(annotation.type()
.getCanonicalName());
if (annotation.value().getCanonicalName().equals("Endpoint"))
service.setServiceendpoint(annotation.type()
.getCanonicalName());
service.setPortlink(annotation.type().getCanonicalName());
context.getNamingResources().addService(service);
}
}
*/
/* Process DeclareRoles annotation.
* Ref JSR 250, equivalent to the security-role element in
* the deployment descriptor
*/
DeclareRoles declareRolesAnnotation = clazz.getAnnotation(DeclareRoles.class);
if (declareRolesAnnotation != null && declareRolesAnnotation.value() != null) {
for (String role : declareRolesAnnotation.value()) {
context.addSecurityRole(role);
}
}
}
protected static void loadFieldsAnnotation(Context context, Class<?> clazz) {
// Initialize the annotations
Field[] fields = Introspection.getDeclaredFields(clazz);
if (fields != null && fields.length > 0) {
for (Field field : fields) {
Resource annotation = field.getAnnotation(Resource.class);
if (annotation != null) {
String defaultName = clazz.getName() + SEPARATOR + field.getName();
Class<?> defaultType = field.getType();
addResource(context, annotation, defaultName, defaultType);
}
}
}
}
protected static void loadMethodsAnnotation(Context context, Class<?> clazz) {
// Initialize the annotations
Method[] methods = Introspection.getDeclaredMethods(clazz);
if (methods != null && methods.length > 0) {
for (Method method : methods) {
Resource annotation = method.getAnnotation(Resource.class);
if (annotation != null) {
if (!Introspection.isValidSetter(method)) {
throw new IllegalArgumentException(sm.getString(
"webAnnotationSet.invalidInjection"));
}
String defaultName = clazz.getName() + SEPARATOR +
Introspection.getPropertyName(method);
Class<?> defaultType = (method.getParameterTypes()[0]);
addResource(context, annotation, defaultName, defaultType);
}
}
}
}
/**
* Process a Resource annotation to set up a Resource.
* Ref JSR 250, equivalent to the resource-ref,
* message-destination-ref, env-ref, resource-env-ref
* or service-ref element in the deployment descriptor.
* @param context The context which will have its annotations processed
* @param annotation The annotation that was found
*/
protected static void addResource(Context context, Resource annotation) {
addResource(context, annotation, null, null);
}
protected static void addResource(Context context, Resource annotation, String defaultName,
Class<?> defaultType) {
String name = getName(annotation, defaultName);
String type = getType(annotation, defaultType);
if (type.equals("java.lang.String") ||
type.equals("java.lang.Character") ||
type.equals("java.lang.Integer") ||
type.equals("java.lang.Boolean") ||
type.equals("java.lang.Double") ||
type.equals("java.lang.Byte") ||
type.equals("java.lang.Short") ||
type.equals("java.lang.Long") ||
type.equals("java.lang.Float")) {
// env-entry element
ContextEnvironment resource = new ContextEnvironment();
resource.setName(name);
resource.setType(type);
resource.setDescription(annotation.description());
resource.setProperty(MAPPED_NAME_PROPERTY, annotation.mappedName());
resource.setLookupName(annotation.lookup());
context.getNamingResources().addEnvironment(resource);
} else if (type.equals("javax.xml.rpc.Service")) {
// service-ref element
ContextService service = new ContextService();
service.setName(name);
service.setWsdlfile(annotation.mappedName());
service.setType(type);
service.setDescription(annotation.description());
service.setLookupName(annotation.lookup());
context.getNamingResources().addService(service);
} else if (type.equals("javax.sql.DataSource") ||
type.equals("javax.jms.ConnectionFactory") ||
type.equals("javax.jms.QueueConnectionFactory") ||
type.equals("javax.jms.TopicConnectionFactory") ||
type.equals("javax.mail.Session") ||
type.equals("java.net.URL") ||
type.equals("javax.resource.cci.ConnectionFactory") ||
type.equals("org.omg.CORBA_2_3.ORB") ||
type.endsWith("ConnectionFactory")) {
// resource-ref element
ContextResource resource = new ContextResource();
resource.setName(name);
resource.setType(type);
if (annotation.authenticationType() == Resource.AuthenticationType.CONTAINER) {
resource.setAuth("Container");
} else if (annotation.authenticationType() == Resource.AuthenticationType.APPLICATION) {
resource.setAuth("Application");
}
resource.setScope(annotation.shareable() ? "Shareable" : "Unshareable");
resource.setProperty(MAPPED_NAME_PROPERTY, annotation.mappedName());
resource.setDescription(annotation.description());
resource.setLookupName(annotation.lookup());
context.getNamingResources().addResource(resource);
} else if (type.equals("javax.jms.Queue") ||
type.equals("javax.jms.Topic")) {
// message-destination-ref
MessageDestinationRef resource = new MessageDestinationRef();
resource.setName(name);
resource.setType(type);
resource.setUsage(annotation.mappedName());
resource.setDescription(annotation.description());
resource.setLookupName(annotation.lookup());
context.getNamingResources().addMessageDestinationRef(resource);
} else {
/*
* General case. Also used for:
* - javax.resource.cci.InteractionSpec
* - javax.transaction.UserTransaction
*/
// resource-env-ref
ContextResourceEnvRef resource = new ContextResourceEnvRef();
resource.setName(name);
resource.setType(type);
resource.setProperty(MAPPED_NAME_PROPERTY, annotation.mappedName());
resource.setDescription(annotation.description());
resource.setLookupName(annotation.lookup());
context.getNamingResources().addResourceEnvRef(resource);
}
}
private static String getType(Resource annotation, Class<?> defaultType) {
Class<?> type = annotation.type();
if (type == null || type.equals(Object.class)) {
if (defaultType != null) {
type = defaultType;
}
}
return Introspection.convertPrimitiveType(type).getCanonicalName();
}
private static String getName(Resource annotation, String defaultName) {
String name = annotation.name();
if (name == null || name.equals("")) {
if (defaultName != null) {
name = defaultName;
}
}
return name;
}
}

View File

@@ -0,0 +1,211 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.startup;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.regex.Pattern;
import javax.servlet.ServletContext;
import org.apache.catalina.Context;
import org.apache.catalina.WebResource;
import org.apache.tomcat.util.scan.JarFactory;
/**
* A variation of Java's JAR ServiceLoader that respects exclusion rules for
* web applications.
* <p>
* Primarily intended for use loading ServletContainerInitializers as defined
* by Servlet 8.2.4. This implementation does not attempt lazy loading as the
* container is required to introspect all implementations discovered.
* <p>
* If the ServletContext defines ORDERED_LIBS, then only JARs in WEB-INF/lib
* that are named in that set will be included in the search for
* provider configuration files; if ORDERED_LIBS is not defined then
* all JARs will be searched for provider configuration files. Providers
* defined by resources in the parent ClassLoader will always be returned.
* <p>
* Provider classes will be loaded using the context's ClassLoader.
*
* @param <T> The type of service to load
*
* @see javax.servlet.ServletContainerInitializer
* @see java.util.ServiceLoader
*/
public class WebappServiceLoader<T> {
private static final String CLASSES = "/WEB-INF/classes/";
private static final String LIB = "/WEB-INF/lib/";
private static final String SERVICES = "META-INF/services/";
private final Context context;
private final ServletContext servletContext;
private final Pattern containerSciFilterPattern;
/**
* Construct a loader to load services from a ServletContext.
*
* @param context the context to use
*/
public WebappServiceLoader(Context context) {
this.context = context;
this.servletContext = context.getServletContext();
String containerSciFilter = context.getContainerSciFilter();
if (containerSciFilter != null && containerSciFilter.length() > 0) {
containerSciFilterPattern = Pattern.compile(containerSciFilter);
} else {
containerSciFilterPattern = null;
}
}
/**
* Load the providers for a service type.
*
* @param serviceType the type of service to load
* @return an unmodifiable collection of service providers
* @throws IOException if there was a problem loading any service
*/
public List<T> load(Class<T> serviceType) throws IOException {
String configFile = SERVICES + serviceType.getName();
LinkedHashSet<String> applicationServicesFound = new LinkedHashSet<>();
LinkedHashSet<String> containerServicesFound = new LinkedHashSet<>();
// if the ServletContext has ORDERED_LIBS, then use that to specify the
// set of JARs from WEB-INF/lib that should be used for loading services
@SuppressWarnings("unchecked")
List<String> orderedLibs = (List<String>) servletContext.getAttribute(ServletContext.ORDERED_LIBS);
// Handle application SCIs directly...
if (orderedLibs == null) {
// No ordered libs, so use every service definition we can find
WebResource[] resources = context.getResources().getClassLoaderResources("/" + configFile);
for (WebResource resource : resources) {
if (resource.isFile()) {
parseConfigFile(applicationServicesFound, resource.getURL());
}
}
} else {
// Ordered libs so only use services defined in those libs and any
// in WEB-INF/classes
URL unpacked = servletContext.getResource(CLASSES + configFile);
if (unpacked != null) {
parseConfigFile(applicationServicesFound, unpacked);
}
for (String lib : orderedLibs) {
URL jarUrl = servletContext.getResource(LIB + lib);
if (jarUrl == null) {
// should not happen, just ignore
continue;
}
String base = jarUrl.toExternalForm();
URL url;
if (base.endsWith("/")) {
url = new URL(base + configFile);
} else {
url = JarFactory.getJarEntryURL(jarUrl, configFile);
}
try {
parseConfigFile(applicationServicesFound, url);
} catch (FileNotFoundException e) {
// no provider file found, this is OK
}
}
}
// and use the parent ClassLoader for all other SCIs
ClassLoader loader = context.getParentClassLoader();
Enumeration<URL> resources;
if (loader == null) {
resources = ClassLoader.getSystemResources(configFile);
} else {
resources = loader.getResources(configFile);
}
while (resources.hasMoreElements()) {
parseConfigFile(containerServicesFound, resources.nextElement());
}
// Filter the discovered container SCIs if required
if (containerSciFilterPattern != null) {
Iterator<String> iter = containerServicesFound.iterator();
while (iter.hasNext()) {
if (containerSciFilterPattern.matcher(iter.next()).find()) {
iter.remove();
}
}
}
// Add the application services after the container services to ensure
// that the container services are loaded first
containerServicesFound.addAll(applicationServicesFound);
// load the discovered services
if (containerServicesFound.isEmpty()) {
return Collections.emptyList();
}
return loadServices(serviceType, containerServicesFound);
}
void parseConfigFile(LinkedHashSet<String> servicesFound, URL url)
throws IOException {
try (InputStream is = url.openStream();
InputStreamReader in = new InputStreamReader(is, StandardCharsets.UTF_8);
BufferedReader reader = new BufferedReader(in)) {
String line;
while ((line = reader.readLine()) != null) {
int i = line.indexOf('#');
if (i >= 0) {
line = line.substring(0, i);
}
line = line.trim();
if (line.length() == 0) {
continue;
}
servicesFound.add(line);
}
}
}
List<T> loadServices(Class<T> serviceType, LinkedHashSet<String> servicesFound)
throws IOException {
ClassLoader loader = servletContext.getClassLoader();
List<T> services = new ArrayList<>(servicesFound.size());
for (String serviceClass : servicesFound) {
try {
Class<?> clazz = Class.forName(serviceClass, true, loader);
services.add(serviceType.cast(clazz.getConstructor().newInstance()));
} catch (ReflectiveOperationException | ClassCastException e) {
throw new IOException(e);
}
}
return Collections.unmodifiableList(services);
}
}

View File

@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<mbeans-descriptors>
<mbean name="ContextConfig"
description="Startup event listener for a Context that configures the properties of that Context, and the associated defined servlets"
domain="Catalina"
group="Listener"
type="org.apache.catalina.startup.ContextConfig">
<attribute name="className"
description="Fully qualified class name of the managed object"
type="java.lang.String"
writeable="false"/>
<attribute name="defaultContextXml"
description="The location of the default context file"
type="java.lang.String"/>
<attribute name="defaultWebXml"
description="The location of the default deployment descriptor"
type="java.lang.String"/>
</mbean>
<mbean name="EngineConfig"
description="Startup event listener for a Engine that configures the properties of that Engine, and the associated defined contexts"
domain="Catalina"
group="Listener"
type="org.apache.catalina.startup.EngineConfig">
<attribute name="className"
description="Fully qualified class name of the managed object"
type="java.lang.String"
writeable="false"/>
</mbean>
<mbean name="HostConfig"
description="Startup event listener for a Host that configures the properties of that Host, and the associated defined contexts"
domain="Catalina"
group="Listener"
type="org.apache.catalina.startup.HostConfig">
<attribute name="className"
description="Fully qualified class name of the managed object"
type="java.lang.String"
writeable="false"/>
<attribute name="configBaseName"
description="The base directory for Context configuration files"
type="java.lang.String"
writeable="false" />
<attribute name="contextClass"
description="The Java class name of the Context implementation we should use"
type="java.lang.String"/>
<attribute name="copyXML"
description="The copy XML config file flag for this component"
is="true"
type="boolean"/>
<attribute name="deployXML"
description="The deploy XML config file flag for this component"
is="true"
type="boolean"/>
<attribute name="unpackWARs"
description="The unpack WARs flag"
is="true"
type="boolean"/>
<operation name="addServiced"
description="Add a web application to the serviced list to show it gets serviced by another component"
impact="ACTION"
returnType="void">
<parameter name="name"
description="Application name"
type="java.lang.String"/>
</operation>
<operation name="check"
description="Check a web application name for updates"
impact="ACTION"
returnType="void">
<parameter name="name"
description="Application name"
type="java.lang.String"/>
</operation>
<operation name="checkUndeploy"
description="Undeploy any old versions of applications deployed using parallel deployment that have no active sessions"
impact="ACTION"
returnType="void">
</operation>
<operation name="getDeploymentTime"
description="Get the instant where an application was deployed"
impact="ACTION"
returnType="long">
<parameter name="name"
description="Application name"
type="java.lang.String"/>
</operation>
<operation name="isDeployed"
description="Was this web application deployed by this component"
impact="ACTION"
returnType="boolean">
<parameter name="name"
description="Application name"
type="java.lang.String"/>
</operation>
<operation name="isServiced"
description="Is a web application serviced by another component"
impact="ACTION"
returnType="boolean">
<parameter name="name"
description="Application name"
type="java.lang.String"/>
</operation>
<operation name="manageApp"
description="Add a web application managed externally"
impact="ACTION"
returnType="void">
<parameter name="context"
description="Context to add"
type="org.apache.catalina.Context" />
</operation>
<operation name="removeServiced"
description="Remove a web application from the serviced list to show it isn't serviced by another component"
impact="ACTION"
returnType="void">
<parameter name="name"
description="Application name"
type="java.lang.String"/>
</operation>
<operation name="unmanageApp"
description="Remove a web application from checks"
impact="ACTION"
returnType="void">
<parameter name="contextPath"
description="The application path"
type="java.lang.String" />
</operation>
</mbean>
</mbeans-descriptors>