From: rjung Date: Fri, 23 Apr 2010 12:16:56 +0000 (+0000) Subject: Context aliases: X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=9bdcddac03068c7c70731f540b8dd8095617d06b;p=tomcat7.0 Context aliases: - add a little to the docs - disallow an alias for "/" git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@937264 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/naming/resources/BaseDirContext.java b/java/org/apache/naming/resources/BaseDirContext.java index 89e50b3c5..f28412b9d 100644 --- a/java/org/apache/naming/resources/BaseDirContext.java +++ b/java/org/apache/naming/resources/BaseDirContext.java @@ -57,6 +57,8 @@ import org.apache.naming.StringManager; public abstract class BaseDirContext implements DirContext { + private static final org.apache.juli.logging.Log log= + org.apache.juli.logging.LogFactory.getLog( BaseDirContext.class ); // -------------------------------------------------------------- Constants @@ -239,6 +241,10 @@ public abstract class BaseDirContext implements DirContext { throw new IllegalArgumentException( sm.getString("resources.invalidAliasMapping", kvp)); + if (kv[0].equals("/")) { + throw new IllegalArgumentException( + sm.getString("resources.invalidAliasNotAllowed", kv[0])); + } File aliasLoc = new File(kv[1]); if (!aliasLoc.exists()) { throw new IllegalArgumentException( @@ -1524,4 +1530,3 @@ public abstract class BaseDirContext implements DirContext { String aliasName; } } - diff --git a/java/org/apache/naming/resources/LocalStrings.properties b/java/org/apache/naming/resources/LocalStrings.properties index a58644193..a3c0d13cf 100644 --- a/java/org/apache/naming/resources/LocalStrings.properties +++ b/java/org/apache/naming/resources/LocalStrings.properties @@ -30,6 +30,7 @@ resources.bindFailed=Bind failed: {0} resources.unbindFailed=Unbind failed: {0} resources.invalidAliasPath=The alias path ''{0}'' must start with ''/'' resources.invalidAliasMapping=The alias mapping ''{0}'' is not valid +resources.invalidAliasNotAllowed=The alias location ''{0}'' is not allowed resources.invalidAliasNotExist=The alias location ''{0}'' does not exist resources.invalidAliasFile=The alias location ''{0}'' points to a file that is not a WAR file standardResources.alreadyStarted=Resources has already been started diff --git a/webapps/docs/config/context.xml b/webapps/docs/config/context.xml index 679d253d6..2254253d6 100644 --- a/webapps/docs/config/context.xml +++ b/webapps/docs/config/context.xml @@ -284,12 +284,19 @@

This attribute provides a list of external locations from which to - load resources for this context. These external locations will not be - emptied if the context is un-deployed. The list of aliases should be of + load resources for this context. The list of aliases should be of the form "/aliasPath1=docBase1,/aliasPath2=docBase2" where aliasPathN must include a leading '/' and docBaseN must be an absolute path to either a .war file or a directory.

+

A resource will be searched for in the first docBaseN + for which aliasPathN is a leading path segment of the + resource. If there is no such alias, then the resource will be searched + in the usual way.

+

Using '/' as an aliasPath is not allowed. Consider using + docBase instead.

+

These external locations will not be emptied if the context + is un-deployed.