Author: rjung
Date: Fri Apr 23 12:16:56 2010
New Revision: 937264

URL: http://svn.apache.org/viewvc?rev=937264&view=rev
Log:
Context aliases:
- add a little to the docs
- disallow an alias for "/"

Modified:
    tomcat/trunk/java/org/apache/naming/resources/BaseDirContext.java
    tomcat/trunk/java/org/apache/naming/resources/LocalStrings.properties
    tomcat/trunk/webapps/docs/config/context.xml

Modified: tomcat/trunk/java/org/apache/naming/resources/BaseDirContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/BaseDirContext.java?rev=937264&r1=937263&r2=937264&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/BaseDirContext.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/BaseDirContext.java Fri Apr 
23 12:16:56 2010
@@ -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 imp
                 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 imp
         String aliasName;
     }
 }
-

Modified: tomcat/trunk/java/org/apache/naming/resources/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/LocalStrings.properties?rev=937264&r1=937263&r2=937264&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/LocalStrings.properties 
(original)
+++ tomcat/trunk/java/org/apache/naming/resources/LocalStrings.properties Fri 
Apr 23 12:16:56 2010
@@ -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

Modified: tomcat/trunk/webapps/docs/config/context.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/context.xml?rev=937264&r1=937263&r2=937264&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/config/context.xml (original)
+++ tomcat/trunk/webapps/docs/config/context.xml Fri Apr 23 12:16:56 2010
@@ -284,12 +284,19 @@
 
       <attribute name="aliases" required="false">
         <p>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 <code>"/aliasPath1=docBase1,/aliasPath2=docBase2"</code> where
         <code>aliasPathN</code> must include a leading '/' and
         <code>docBaseN</code> must be an absolute path to either a .war file or
         a directory.</p>
+        <p>A resource will be searched for in the first <code>docBaseN</code>
+        for which <code>aliasPathN</code> is a leading path segment of the
+        resource. If there is no such alias, then the resource will be searched
+        in the usual way.</p>
+        <p>Using '/' as an aliasPath is not allowed. Consider using
+        <code>docBase</code> instead.</p>
+        <p>These external locations will not be emptied if the context
+        is un-deployed.</p>
       </attribute>
 
       <attribute name="allowLinking" required="false">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to