tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1382553 [3/3] - in /tomcat/sandbox/trunk-resources: java/org/apache/catalina/ java/org/apache/catalina/core/ java/org/apache/catalina/loader/ java/org/apache/catalina/mapper/ java/org/apache/catalina/servlets/ java/org/apache/catalina/star...
Date Sun, 09 Sep 2012 18:18:46 GMT
Modified: tomcat/sandbox/trunk-resources/java/org/apache/catalina/servlets/WebdavServlet.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/catalina/servlets/WebdavServlet.java?rev=1382553&r1=1382552&r2=1382553&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/catalina/servlets/WebdavServlet.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/catalina/servlets/WebdavServlet.java Sun Sep  9 18:18:45 2012
@@ -14,12 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-
 package org.apache.catalina.servlets;
 
-
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.StringReader;
 import java.io.StringWriter;
@@ -34,10 +30,6 @@ import java.util.Stack;
 import java.util.TimeZone;
 import java.util.Vector;
 
-import javax.naming.NameClassPair;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.DirContext;
 import javax.servlet.RequestDispatcher;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
@@ -48,13 +40,11 @@ import javax.xml.parsers.DocumentBuilder
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
+import org.apache.catalina.WebResource;
 import org.apache.catalina.util.ConcurrentDateFormat;
 import org.apache.catalina.util.DOMWriter;
 import org.apache.catalina.util.MD5Encoder;
 import org.apache.catalina.util.XMLWriter;
-import org.apache.naming.resources.CacheEntry;
-import org.apache.naming.resources.Resource;
-import org.apache.naming.resources.ResourceAttributes;
 import org.apache.tomcat.util.buf.B2CConverter;
 import org.apache.tomcat.util.http.FastHttpDateFormat;
 import org.apache.tomcat.util.http.RequestUtil;
@@ -66,8 +56,6 @@ import org.xml.sax.EntityResolver;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
-
-
 /**
  * Servlet which adds support for WebDAV level 2. All the basic HTTP requests
  * are handled by the DefaultServlet. The WebDAVServlet must not be used as the
@@ -380,29 +368,17 @@ public class WebdavServlet
     }
 
 
-    /**
-     * Check if the conditions specified in the optional If headers are
-     * satisfied.
-     *
-     * @param request The servlet request we are processing
-     * @param response The servlet response we are creating
-     * @param resourceAttributes The resource information
-     * @return boolean true if the resource meets all the specified conditions,
-     * and false if any of the conditions is not satisfied, in which case
-     * request processing is stopped
-     */
     @Override
     protected boolean checkIfHeaders(HttpServletRequest request,
                                      HttpServletResponse response,
-                                     ResourceAttributes resourceAttributes)
+                                     WebResource resource)
         throws IOException {
 
-        if (!super.checkIfHeaders(request, response, resourceAttributes))
+        if (!super.checkIfHeaders(request, response, resource))
             return false;
 
         // TODO : Checking the WebDAV If header
         return true;
-
     }
 
 
@@ -464,12 +440,10 @@ public class WebdavServlet
 
         resp.addHeader("DAV", "1,2");
 
-        StringBuilder methodsAllowed = determineMethodsAllowed(resources,
-                                                              req);
+        StringBuilder methodsAllowed = determineMethodsAllowed(req);
 
         resp.addHeader("Allow", methodsAllowed.toString());
         resp.addHeader("MS-Author-Via", "DAV");
-
     }
 
 
@@ -481,8 +455,7 @@ public class WebdavServlet
 
         if (!listings) {
             // Get allowed methods
-            StringBuilder methodsAllowed = determineMethodsAllowed(resources,
-                                                                  req);
+            StringBuilder methodsAllowed = determineMethodsAllowed(req);
 
             resp.addHeader("Allow", methodsAllowed.toString());
             resp.sendError(WebdavStatus.SC_METHOD_NOT_ALLOWED);
@@ -583,12 +556,9 @@ public class WebdavServlet
 
         }
 
-        boolean exists = true;
-        Object object = null;
-        try {
-            object = resources.lookup(path);
-        } catch (NamingException e) {
-            exists = false;
+        WebResource resource = resources.getResource(path);
+
+        if (!resource.exists()) {
             int slash = path.lastIndexOf('/');
             if (slash != -1) {
                 String parentPath = path.substring(0, slash);
@@ -622,7 +592,7 @@ public class WebdavServlet
             }
         }
 
-        if (!exists) {
+        if (!resource.exists()) {
             resp.sendError(HttpServletResponse.SC_NOT_FOUND, path);
             return;
         }
@@ -655,30 +625,17 @@ public class WebdavServlet
                 parseProperties(req, generatedXML, currentPath,
                                 type, properties);
 
-                try {
-                    object = resources.lookup(currentPath);
-                } catch (NamingException e) {
-                    continue;
-                }
+                resource = resources.getResource(currentPath);
 
-                if ((object instanceof DirContext) && (depth > 0)) {
+                if (resource.isDirectory() && (depth > 0)) {
 
-                    try {
-                        NamingEnumeration<NameClassPair> enumeration =
-                            resources.list(currentPath);
-                        while (enumeration.hasMoreElements()) {
-                            NameClassPair ncPair = enumeration.nextElement();
-                            String newPath = currentPath;
-                            if (!(newPath.endsWith("/")))
+                    String[] entries = resources.list(currentPath);
+                    for (String entry : entries) {
+                        String newPath = currentPath;
+                        if (!(newPath.endsWith("/")))
                                 newPath += "/";
-                            newPath += ncPair.getName();
-                            stackBelow.push(newPath);
-                        }
-                    } catch (NamingException e) {
-                        resp.sendError
-                            (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
-                             path);
-                        return;
+                        newPath += entry;
+                        stackBelow.push(newPath);
                     }
 
                     // Displaying the lock-null resources present in that
@@ -760,19 +717,13 @@ public class WebdavServlet
 
         String path = getRelativePath(req);
 
-        boolean exists = true;
-        try {
-            resources.lookup(path);
-        } catch (NamingException e) {
-            exists = false;
-        }
+        WebResource resource = resources.getResource(path);
 
         // Can't create a collection if a resource already exists at the given
         // path
-        if (exists) {
+        if (resource.exists()) {
             // Get allowed methods
-            StringBuilder methodsAllowed = determineMethodsAllowed(resources,
-                                                                  req);
+            StringBuilder methodsAllowed = determineMethodsAllowed(req);
 
             resp.addHeader("Allow", methodsAllowed.toString());
 
@@ -796,23 +747,15 @@ public class WebdavServlet
             }
         }
 
-        boolean result = true;
-        try {
-            resources.createSubcontext(path);
-        } catch (NamingException e) {
-            result = false;
-        }
-
-        if (!result) {
-            resp.sendError(WebdavStatus.SC_CONFLICT,
-                           WebdavStatus.getStatusText
-                           (WebdavStatus.SC_CONFLICT));
-        } else {
+        if (resources.mkdir(path)) {
             resp.setStatus(WebdavStatus.SC_CREATED);
             // Removing any lock-null resource which would be present
             lockNullResources.remove(path);
+        } else {
+            resp.sendError(WebdavStatus.SC_CONFLICT,
+                           WebdavStatus.getStatusText
+                           (WebdavStatus.SC_CONFLICT));
         }
-
     }
 
 
@@ -1120,13 +1063,7 @@ public class WebdavServlet
 
         lock.path = path;
 
-        boolean exists = true;
-        Object object = null;
-        try {
-            object = resources.lookup(path);
-        } catch (NamingException e) {
-            exists = false;
-        }
+        WebResource resource = resources.getResource(path);
 
         Enumeration<LockInfo> locksList = null;
 
@@ -1141,8 +1078,7 @@ public class WebdavServlet
             String lockToken = MD5Encoder.encode(md5Helper.digest(
                     lockTokenStr.getBytes(B2CConverter.ISO_8859_1)));
 
-            if ( (exists) && (object instanceof DirContext) &&
-                 (lock.depth == maxDepth) ) {
+            if (resource.isDirectory() && lock.depth == maxDepth) {
 
                 // Locking a collection (and all its member resources)
 
@@ -1281,13 +1217,7 @@ public class WebdavServlet
                     resourceLocks.put(lock.path, lock);
 
                     // Checking if a resource exists at this path
-                    exists = true;
-                    try {
-                        object = resources.lookup(path);
-                    } catch (NamingException e) {
-                        exists = false;
-                    }
-                    if (!exists) {
+                    if (!resource.exists()) {
 
                         // "Creating" a lock-null resource
                         int slash = lock.path.lastIndexOf('/');
@@ -1653,40 +1583,30 @@ public class WebdavServlet
 
         // Overwriting the destination
 
-        boolean exists = true;
-        try {
-            resources.lookup(destinationPath);
-        } catch (NamingException e) {
-            exists = false;
-        }
+        WebResource destination = resources.getResource(destinationPath);
 
         if (overwrite) {
-
             // Delete destination resource, if it exists
-            if (exists) {
+            if (destination.exists()) {
                 if (!deleteResource(destinationPath, req, resp, true)) {
                     return false;
                 }
             } else {
                 resp.setStatus(WebdavStatus.SC_CREATED);
             }
-
         } else {
-
             // If the destination exists, then it's a conflict
-            if (exists) {
+            if (destination.exists()) {
                 resp.sendError(WebdavStatus.SC_PRECONDITION_FAILED);
                 return false;
             }
-
         }
 
         // Copying source to destination
 
         Hashtable<String,Integer> errorList = new Hashtable<>();
 
-        boolean result = copyResource(resources, errorList,
-                                      path, destinationPath);
+        boolean result = copyResource(errorList, path, destinationPath);
 
         if ((!result) || (!errorList.isEmpty())) {
             if (errorList.size() == 1) {
@@ -1698,7 +1618,7 @@ public class WebdavServlet
         }
 
         // Copy was successful
-        if (exists) {
+        if (destination.exists()) {
             resp.setStatus(WebdavStatus.SC_NO_CONTENT);
         } else {
             resp.setStatus(WebdavStatus.SC_CREATED);
@@ -1709,91 +1629,60 @@ public class WebdavServlet
         lockNullResources.remove(destinationPath);
 
         return true;
-
     }
 
 
     /**
      * Copy a collection.
      *
-     * @param dirContext Resources implementation to be used
      * @param errorList Hashtable containing the list of errors which occurred
      * during the copy operation
      * @param source Path of the resource to be copied
      * @param dest Destination path
      */
-    private boolean copyResource(DirContext dirContext,
-            Hashtable<String,Integer> errorList, String source, String dest) {
+    private boolean copyResource(Hashtable<String,Integer> errorList,
+            String source, String dest) {
 
         if (debug > 1)
             log("Copy: " + source + " To: " + dest);
 
-        Object object = null;
-        try {
-            object = dirContext.lookup(source);
-        } catch (NamingException e) {
-            // Ignore
-        }
-
-        if (object instanceof DirContext) {
+        WebResource sourceResource = resources.getResource(source);
 
-            try {
-                dirContext.createSubcontext(dest);
-            } catch (NamingException e) {
-                errorList.put
-                    (dest, new Integer(WebdavStatus.SC_CONFLICT));
-                return false;
+        if (sourceResource.isDirectory()) {
+            if (!resources.mkdir(dest)) {
+                WebResource destResource = resources.getResource(dest);
+                if (!destResource.isDirectory()) {
+                    errorList.put(dest, new Integer(WebdavStatus.SC_CONFLICT));
+                    return false;
+                }
             }
 
-            try {
-                NamingEnumeration<NameClassPair> enumeration =
-                    dirContext.list(source);
-                while (enumeration.hasMoreElements()) {
-                    NameClassPair ncPair = enumeration.nextElement();
-                    String childDest = dest;
-                    if (!childDest.equals("/"))
-                        childDest += "/";
-                    childDest += ncPair.getName();
-                    String childSrc = source;
-                    if (!childSrc.equals("/"))
-                        childSrc += "/";
-                    childSrc += ncPair.getName();
-                    copyResource(dirContext, errorList, childSrc, childDest);
-                }
-            } catch (NamingException e) {
-                errorList.put
-                    (dest, new Integer(WebdavStatus.SC_INTERNAL_SERVER_ERROR));
+            String[] entries = resources.list(source);
+            for (String entry : entries) {
+                String childDest = dest;
+                if (!childDest.equals("/")) {
+                    childDest += "/";
+                }
+                childDest += entry;
+                String childSrc = source;
+                if (!childSrc.equals("/")) {
+                    childSrc += "/";
+                }
+                childSrc += entry;
+                copyResource(errorList, childSrc, childDest);
+            }
+        } else if (sourceResource.isFile()) {
+            if (!resources.write(dest, sourceResource.getInputStream())) {
+                errorList.put(source,
+                        new Integer(WebdavStatus.SC_INTERNAL_SERVER_ERROR));
                 return false;
             }
-
         } else {
-
-            if (object instanceof Resource) {
-                try {
-                    dirContext.bind(dest, object);
-                } catch (NamingException e) {
-                    if (e.getCause() instanceof FileNotFoundException) {
-                        // We know the source exists so it must be the
-                        // destination dir that can't be found
-                        errorList.put(source,
-                                new Integer(WebdavStatus.SC_CONFLICT));
-                    } else {
-                        errorList.put(source,
-                                new Integer(WebdavStatus.SC_INTERNAL_SERVER_ERROR));
-                    }
-                    return false;
-                }
-            } else {
-                errorList.put
-                    (source,
-                     new Integer(WebdavStatus.SC_INTERNAL_SERVER_ERROR));
-                return false;
-            }
-
+            errorList.put(source,
+                    new Integer(WebdavStatus.SC_INTERNAL_SERVER_ERROR));
+            return false;
         }
-
         return true;
-
     }
 
 
@@ -1841,25 +1730,15 @@ public class WebdavServlet
             return false;
         }
 
-        boolean exists = true;
-        Object object = null;
-        try {
-            object = resources.lookup(path);
-        } catch (NamingException e) {
-            exists = false;
-        }
+        WebResource resource = resources.getResource(path);
 
-        if (!exists) {
+        if (!resource.exists()) {
             resp.sendError(WebdavStatus.SC_NOT_FOUND);
             return false;
         }
 
-        boolean collection = (object instanceof DirContext);
-
-        if (!collection) {
-            try {
-                resources.unbind(path);
-            } catch (NamingException e) {
+        if (!resource.isDirectory()) {
+            if (!resource.delete()) {
                 resp.sendError(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
                 return false;
             }
@@ -1867,39 +1746,31 @@ public class WebdavServlet
 
             Hashtable<String,Integer> errorList = new Hashtable<>();
 
-            deleteCollection(req, resources, path, errorList);
-            try {
-                resources.unbind(path);
-            } catch (NamingException e) {
+            deleteCollection(req, path, errorList);
+            if (!resource.delete()) {
                 errorList.put(path, new Integer
                     (WebdavStatus.SC_INTERNAL_SERVER_ERROR));
             }
 
             if (!errorList.isEmpty()) {
-
                 sendReport(req, resp, errorList);
                 return false;
-
             }
-
         }
         if (setStatus) {
             resp.setStatus(WebdavStatus.SC_NO_CONTENT);
         }
         return true;
-
     }
 
 
     /**
      * Deletes a collection.
      *
-     * @param dirContext Resources implementation associated with the context
      * @param path Path to the collection to be deleted
      * @param errorList Contains the list of the errors which occurred
      */
     private void deleteCollection(HttpServletRequest req,
-                                  DirContext dirContext,
                                   String path,
                                   Hashtable<String,Integer> errorList) {
 
@@ -1920,54 +1791,34 @@ public class WebdavServlet
         if (lockTokenHeader == null)
             lockTokenHeader = "";
 
-        Enumeration<NameClassPair> enumeration = null;
-        try {
-            enumeration = dirContext.list(path);
-        } catch (NamingException e) {
-            errorList.put(path, new Integer
-                (WebdavStatus.SC_INTERNAL_SERVER_ERROR));
-            return;
-        }
+        String[] entries = resources.list(path);
 
-        while (enumeration.hasMoreElements()) {
-            NameClassPair ncPair = enumeration.nextElement();
+        for (String entry : entries) {
             String childName = path;
             if (!childName.equals("/"))
                 childName += "/";
-            childName += ncPair.getName();
+            childName += entry;
 
             if (isLocked(childName, ifHeader + lockTokenHeader)) {
 
                 errorList.put(childName, new Integer(WebdavStatus.SC_LOCKED));
 
             } else {
+                WebResource childResource = resources.getResource(childName);
+                if (childResource.isDirectory()) {
+                    deleteCollection(req, childName, errorList);
+                }
 
-                try {
-                    Object object = dirContext.lookup(childName);
-                    if (object instanceof DirContext) {
-                        deleteCollection(req, dirContext, childName, errorList);
-                    }
-
-                    try {
-                        dirContext.unbind(childName);
-                    } catch (NamingException e) {
-                        if (!(object instanceof DirContext)) {
-                            // If it's not a collection, then it's an unknown
-                            // error
-                            errorList.put
-                                (childName, new Integer
-                                    (WebdavStatus.SC_INTERNAL_SERVER_ERROR));
-                        }
+                if (!childResource.delete()) {
+                    if (!childResource.isDirectory()) {
+                        // If it's not a collection, then it's an unknown
+                        // error
+                        errorList.put(childName, new Integer(
+                                WebdavStatus.SC_INTERNAL_SERVER_ERROR));
                     }
-                } catch (NamingException e) {
-                    errorList.put
-                        (childName, new Integer
-                            (WebdavStatus.SC_INTERNAL_SERVER_ERROR));
                 }
             }
-
         }
-
     }
 
 
@@ -2046,8 +1897,8 @@ public class WebdavServlet
         if (isSpecialPath(path))
             return;
 
-        CacheEntry cacheEntry = resources.lookupCache(path);
-        if (!cacheEntry.exists) {
+        WebResource resource = resources.getResource(path);
+        if (!resource.exists()) {
             // File is in directory listing but doesn't appear to exist
             // Broken symlink or odd permission settings?
             return;
@@ -2065,7 +1916,7 @@ public class WebdavServlet
             href += path.substring(1);
         else
             href += path;
-        if ((cacheEntry.context != null) && (!href.endsWith("/")))
+        if (resource.isDirectory() && (!href.endsWith("/")))
             href += "/";
 
         generatedXML.writeText(rewriteUrl(href));
@@ -2085,25 +1936,24 @@ public class WebdavServlet
             generatedXML.writeElement("D", "prop", XMLWriter.OPENING);
 
             generatedXML.writeProperty("D", "creationdate",
-                    getISOCreationDate(cacheEntry.attributes.getCreation()));
+                    getISOCreationDate(resource.getCreation()));
             generatedXML.writeElement("D", "displayname", XMLWriter.OPENING);
             generatedXML.writeData(resourceName);
             generatedXML.writeElement("D", "displayname", XMLWriter.CLOSING);
-            if (cacheEntry.resource != null) {
+            if (resource.isFile()) {
                 generatedXML.writeProperty
                     ("D", "getlastmodified", FastHttpDateFormat.formatDate
-                           (cacheEntry.attributes.getLastModified(), null));
+                           (resource.getLastModified(), null));
                 generatedXML.writeProperty
                     ("D", "getcontentlength",
-                     String.valueOf(cacheEntry.attributes.getContentLength()));
-                String contentType = getServletContext().getMimeType
-                    (cacheEntry.name);
+                     String.valueOf(resource.getContentLength()));
+                String contentType = getServletContext().getMimeType(
+                        resource.getName());
                 if (contentType != null) {
                     generatedXML.writeProperty("D", "getcontenttype",
                             contentType);
                 }
-                generatedXML.writeProperty("D", "getetag",
-                        cacheEntry.attributes.getETag());
+                generatedXML.writeProperty("D", "getetag",resource.getETag());
                 generatedXML.writeElement("D", "resourcetype",
                         XMLWriter.NO_CONTENT);
             } else {
@@ -2146,7 +1996,7 @@ public class WebdavServlet
             generatedXML.writeElement("D", "creationdate",
                                       XMLWriter.NO_CONTENT);
             generatedXML.writeElement("D", "displayname", XMLWriter.NO_CONTENT);
-            if (cacheEntry.resource != null) {
+            if (resource.isFile()) {
                 generatedXML.writeElement("D", "getcontentlanguage",
                         XMLWriter.NO_CONTENT);
                 generatedXML.writeElement("D", "getcontentlength",
@@ -2189,7 +2039,7 @@ public class WebdavServlet
                 if (property.equals("creationdate")) {
                     generatedXML.writeProperty
                         ("D", "creationdate",
-                         getISOCreationDate(cacheEntry.attributes.getCreation()));
+                         getISOCreationDate(resource.getCreation()));
                 } else if (property.equals("displayname")) {
                     generatedXML.writeElement
                         ("D", "displayname", XMLWriter.OPENING);
@@ -2197,46 +2047,46 @@ public class WebdavServlet
                     generatedXML.writeElement
                         ("D", "displayname", XMLWriter.CLOSING);
                 } else if (property.equals("getcontentlanguage")) {
-                    if (cacheEntry.context != null) {
+                    if (resource.isDirectory()) {
                         propertiesNotFound.addElement(property);
                     } else {
                         generatedXML.writeElement("D", "getcontentlanguage",
                                                   XMLWriter.NO_CONTENT);
                     }
                 } else if (property.equals("getcontentlength")) {
-                    if (cacheEntry.context != null) {
+                    if (resource.isDirectory()) {
                         propertiesNotFound.addElement(property);
                     } else {
                         generatedXML.writeProperty
                             ("D", "getcontentlength",
-                             (String.valueOf(cacheEntry.attributes.getContentLength())));
+                             (String.valueOf(resource.getContentLength())));
                     }
                 } else if (property.equals("getcontenttype")) {
-                    if (cacheEntry.context != null) {
+                    if (resource.isDirectory()) {
                         propertiesNotFound.addElement(property);
                     } else {
                         generatedXML.writeProperty
                             ("D", "getcontenttype",
                              getServletContext().getMimeType
-                             (cacheEntry.name));
+                             (resource.getName()));
                     }
                 } else if (property.equals("getetag")) {
-                    if (cacheEntry.context != null) {
+                    if (resource.isDirectory()) {
                         propertiesNotFound.addElement(property);
                     } else {
                         generatedXML.writeProperty
-                            ("D", "getetag", cacheEntry.attributes.getETag());
+                            ("D", "getetag", resource.getETag());
                     }
                 } else if (property.equals("getlastmodified")) {
-                    if (cacheEntry.context != null) {
+                    if (resource.isDirectory()) {
                         propertiesNotFound.addElement(property);
                     } else {
                         generatedXML.writeProperty
                             ("D", "getlastmodified", FastHttpDateFormat.formatDate
-                                    (cacheEntry.attributes.getLastModified(), null));
+                                    (resource.getLastModified(), null));
                     }
                 } else if (property.equals("resourcetype")) {
-                    if (cacheEntry.context != null) {
+                    if (resource.isDirectory()) {
                         generatedXML.writeElement("D", "resourcetype",
                                 XMLWriter.OPENING);
                         generatedXML.writeElement("D", "collection",
@@ -2600,21 +2450,13 @@ public class WebdavServlet
      * Determines the methods normally allowed for the resource.
      *
      */
-    private StringBuilder determineMethodsAllowed(DirContext dirContext,
-                                                 HttpServletRequest req) {
+    private StringBuilder determineMethodsAllowed(HttpServletRequest req) {
 
         StringBuilder methodsAllowed = new StringBuilder();
-        boolean exists = true;
-        Object object = null;
-        try {
-            String path = getRelativePath(req);
 
-            object = dirContext.lookup(path);
-        } catch (NamingException e) {
-            exists = false;
-        }
+        WebResource resource = resources.getResource(getRelativePath(req));
 
-        if (!exists) {
+        if (!resource.exists()) {
             methodsAllowed.append("OPTIONS, MKCOL, PUT, LOCK");
             return methodsAllowed;
         }
@@ -2626,7 +2468,7 @@ public class WebdavServlet
             methodsAllowed.append(", PROPFIND");
         }
 
-        if (!(object instanceof DirContext)) {
+        if (resource.isFile()) {
             methodsAllowed.append(", PUT");
         }
 

Modified: tomcat/sandbox/trunk-resources/java/org/apache/catalina/startup/ContextConfig.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/catalina/startup/ContextConfig.java?rev=1382553&r1=1382552&r2=1382553&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/catalina/startup/ContextConfig.java Sun Sep  9 18:18:45 2012
@@ -28,10 +28,8 @@ import java.net.JarURLConnection;
 import java.net.MalformedURLException;
 import java.net.URISyntaxException;
 import java.net.URL;
-import java.net.URLConnection;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
@@ -44,10 +42,6 @@ import java.util.Set;
 import java.util.StringTokenizer;
 import java.util.concurrent.ConcurrentHashMap;
 
-import javax.naming.Binding;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
 import javax.servlet.ServletContainerInitializer;
 import javax.servlet.ServletContext;
 import javax.servlet.annotation.HandlesTypes;
@@ -65,6 +59,8 @@ import org.apache.catalina.Pipeline;
 import org.apache.catalina.Server;
 import org.apache.catalina.Service;
 import org.apache.catalina.Valve;
+import org.apache.catalina.WebResource;
+import org.apache.catalina.WebResourceRoot;
 import org.apache.catalina.Wrapper;
 import org.apache.catalina.core.StandardContext;
 import org.apache.catalina.core.StandardHost;
@@ -79,9 +75,6 @@ import org.apache.catalina.util.ContextN
 import org.apache.catalina.util.Introspection;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
-import org.apache.naming.resources.DirContextURLConnection;
-import org.apache.naming.resources.FileDirContext;
-import org.apache.naming.resources.ResourceAttributes;
 import org.apache.tomcat.JarScanner;
 import org.apache.tomcat.JarScannerCallback;
 import org.apache.tomcat.util.ExceptionUtils;
@@ -1181,43 +1174,12 @@ public class ContextConfig implements Li
         if  (!webXml.isMetadataComplete() || typeInitializerMap.size() > 0) {
             // Step 4. Process /WEB-INF/classes for annotations
             if (ok) {
-                // Hack required by Eclipse's "serve modules without
-                // publishing" feature since this backs WEB-INF/classes by
-                // multiple locations rather than one.
-                NamingEnumeration<Binding> listBindings = null;
-                try {
-                    try {
-                        listBindings = context.getResources().listBindings(
-                                "/WEB-INF/classes");
-                    } catch (NameNotFoundException ignore) {
-                        // Safe to ignore
-                    }
-                    while (listBindings != null &&
-                            listBindings.hasMoreElements()) {
-                        Binding binding = listBindings.nextElement();
-                        if (binding.getObject() instanceof FileDirContext) {
-                            File webInfClassDir = new File(
-                                    ((FileDirContext) binding.getObject()).getDocBase());
-                            processAnnotationsFile(webInfClassDir, webXml,
-                                    webXml.isMetadataComplete());
-                        } else {
-                            String resource =
-                                    "/WEB-INF/classes/" + binding.getName();
-                            try {
-                                URL url = sContext.getResource(resource);
-                                processAnnotationsUrl(url, webXml,
-                                        webXml.isMetadataComplete());
-                            } catch (MalformedURLException e) {
-                                log.error(sm.getString(
-                                        "contextConfig.webinfClassesUrl",
-                                        resource), e);
-                            }
-                        }
-                    }
-                } catch (NamingException e) {
-                    log.error(sm.getString(
-                            "contextConfig.webinfClassesUrl",
-                            "/WEB-INF/classes"), e);
+                WebResource[] webResources =
+                        context.getResources().listResources("/WEB-INF/classes");
+
+                for (WebResource webResource : webResources) {
+                    processAnnotationsWebResource(webResource, webXml,
+                            webXml.isMetadataComplete());
                 }
             }
 
@@ -1594,23 +1556,21 @@ public class ContextConfig implements Li
                     String entryName = jar.getEntryName();
                     while (entryName != null) {
                         if (entryName.startsWith("META-INF/resources/")) {
-                            context.addResourceJarUrl(url);
+                            context.getResources().createWebResourceSet(
+                                    WebResourceRoot.ResourceSetType.RESOURCE_JAR,
+                                    url, "", "META-INF/resources");
                             break;
                         }
                         jar.nextEntry();
                         entryName = jar.getEntryName();
                     }
                 } else if ("file".equals(url.getProtocol())) {
-                    FileDirContext fileDirContext = new FileDirContext();
-                    fileDirContext.setDocBase(new File(url.toURI()).getAbsolutePath());
-                    try {
-                        fileDirContext.lookup("META-INF/resources/");
-                        //lookup succeeded
-                        if(context instanceof StandardContext){
-                            ((StandardContext)context).addResourcesDirContext(fileDirContext);
-                        }
-                    } catch (NamingException e) {
-                        //not found, ignore
+                    File file = new File(url.toURI());
+                    File resources = new File(file, "META-INF/resources/");
+                    if (resources.isDirectory()) {
+                        context.getResources().createWebResourceSet(
+                                WebResourceRoot.ResourceSetType.RESOURCE_JAR,
+                                file, "", "");
                     }
                 }
             } catch (IOException ioe) {
@@ -1844,6 +1804,41 @@ public class ContextConfig implements Li
         }
     }
 
+    protected void processAnnotationsWebResource(WebResource webResource,
+            WebXml fragment, boolean handlesTypesOnly) {
+
+        if (webResource.isDirectory()) {
+            WebResource[] webResources =
+                    webResource.getWebResourceRoot().listResources(
+                            webResource.getWebappPath());
+            for (WebResource r : webResources) {
+                processAnnotationsWebResource(r, fragment, handlesTypesOnly);
+            }
+        } else if (webResource.isFile() &&
+                webResource.getName().endsWith(".class")) {
+            InputStream is = null;
+            try {
+                is = webResource.getInputStream();
+                processAnnotationsStream(is, fragment, handlesTypesOnly);
+            } catch (IOException e) {
+                log.error(sm.getString("contextConfig.inputStreamWebResource",
+                        webResource.getWebappPath()),e);
+            } catch (ClassFormatException e) {
+                log.error(sm.getString("contextConfig.inputStreamWebResource",
+                        webResource.getWebappPath()),e);
+            } finally {
+                if (is != null) {
+                    try {
+                        is.close();
+                    } catch (Throwable t) {
+                        ExceptionUtils.handleThrowable(t);
+                    }
+                }
+            }
+        }
+    }
+
+
     protected void processAnnotationsUrl(URL url, WebXml fragment,
             boolean handlesTypesOnly) {
         if (url == null) {
@@ -1851,8 +1846,6 @@ public class ContextConfig implements Li
             return;
         } else if ("jar".equals(url.getProtocol())) {
             processAnnotationsJar(url, fragment, handlesTypesOnly);
-        } else if ("jndi".equals(url.getProtocol())) {
-            processAnnotationsJndi(url, fragment, handlesTypesOnly);
         } else if ("file".equals(url.getProtocol())) {
             try {
                 processAnnotationsFile(
@@ -1915,61 +1908,6 @@ public class ContextConfig implements Li
     }
 
 
-    protected void processAnnotationsJndi(URL url, WebXml fragment,
-            boolean handlesTypesOnly) {
-        try {
-            URLConnection urlConn = url.openConnection();
-            DirContextURLConnection dcUrlConn;
-            if (!(urlConn instanceof DirContextURLConnection)) {
-                // This should never happen
-                sm.getString("contextConfig.jndiUrlNotDirContextConn", url);
-                return;
-            }
-
-            dcUrlConn = (DirContextURLConnection) urlConn;
-            dcUrlConn.setUseCaches(false);
-
-            String type = dcUrlConn.getHeaderField(ResourceAttributes.TYPE);
-            if (ResourceAttributes.COLLECTION_TYPE.equals(type)) {
-                // Collection
-                Enumeration<String> dirs = dcUrlConn.list();
-                while (dirs.hasMoreElements()) {
-                    String dir = dirs.nextElement();
-                    URL dirUrl = new URL(url.toString() + '/' + dir);
-                    processAnnotationsJndi(dirUrl, fragment, handlesTypesOnly);
-                }
-
-            } else {
-                // Single file
-                if (url.getPath().endsWith(".class")) {
-                    InputStream is = null;
-                    try {
-                        is = dcUrlConn.getInputStream();
-                        processAnnotationsStream(
-                                is, fragment, handlesTypesOnly);
-                    } catch (IOException e) {
-                        log.error(sm.getString("contextConfig.inputStreamJndi",
-                                url),e);
-                    } catch (ClassFormatException e) {
-                        log.error(sm.getString("contextConfig.inputStreamJndi",
-                                url),e);
-                    } finally {
-                        if (is != null) {
-                            try {
-                                is.close();
-                            } catch (Throwable t) {
-                                ExceptionUtils.handleThrowable(t);
-                            }
-                        }
-                    }
-                }
-            }
-        } catch (IOException e) {
-            log.error(sm.getString("contextConfig.jndiUrl", url), e);
-        }
-    }
-
-
     protected void processAnnotationsFile(File file, WebXml fragment,
             boolean handlesTypesOnly) {
 

Modified: tomcat/sandbox/trunk-resources/java/org/apache/catalina/startup/FailedContext.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/catalina/startup/FailedContext.java?rev=1382553&r1=1382552&r2=1382553&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/catalina/startup/FailedContext.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/catalina/startup/FailedContext.java Sun Sep  9 18:18:45 2012
@@ -22,7 +22,6 @@ import java.net.URL;
 import java.util.Locale;
 import java.util.Set;
 
-import javax.naming.directory.DirContext;
 import javax.servlet.ServletContainerInitializer;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletRegistration;
@@ -44,6 +43,7 @@ import org.apache.catalina.Manager;
 import org.apache.catalina.Pipeline;
 import org.apache.catalina.Realm;
 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;
@@ -261,9 +261,9 @@ public class FailedContext extends Lifec
     public void setRealm(Realm realm) { /* NO-OP */ }
 
     @Override
-    public DirContext getResources() { return null; }
+    public WebResourceRoot getResources() { return null; }
     @Override
-    public void setResources(DirContext resources) { /* NO-OP */ }
+    public void setResources(WebResourceRoot resources) { /* NO-OP */ }
 
     @Override
     public void backgroundProcess() { /* NO-OP */ }
@@ -629,9 +629,6 @@ public class FailedContext extends Lifec
     public JspConfigDescriptor getJspConfigDescriptor() { return null; }
 
     @Override
-    public void addResourceJarUrl(URL url) { /* NO-OP */ }
-
-    @Override
     public void addServletContainerInitializer(ServletContainerInitializer sci,
             Set<Class<?>> classes) { /* NO-OP */ }
 

Modified: tomcat/sandbox/trunk-resources/java/org/apache/catalina/startup/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/catalina/startup/LocalStrings.properties?rev=1382553&r1=1382552&r2=1382553&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/catalina/startup/LocalStrings.properties (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/catalina/startup/LocalStrings.properties Sun Sep  9 18:18:45 2012
@@ -43,6 +43,7 @@ contextConfig.init=ContextConfig: Initia
 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.invalidSci=The ServletContentInitializer [{0}] could not be created
 contextConfig.jndiUrl=Unable to process JNDI URL [{0}] for annotations
 contextConfig.jndiUrlNotDirContextConn=The connection created for URL [{0}] was not a DirContextURLConnection

Modified: tomcat/sandbox/trunk-resources/java/org/apache/catalina/util/ExtensionValidator.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/catalina/util/ExtensionValidator.java?rev=1382553&r1=1382552&r2=1382553&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/catalina/util/ExtensionValidator.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/catalina/util/ExtensionValidator.java Sun Sep  9 18:18:45 2012
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.catalina.util;
 
 import java.io.File;
@@ -24,18 +23,13 @@ import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.Locale;
-import java.util.NoSuchElementException;
 import java.util.StringTokenizer;
 import java.util.jar.JarInputStream;
 import java.util.jar.Manifest;
 
-import javax.naming.Binding;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.DirContext;
-
 import org.apache.catalina.Context;
-import org.apache.naming.resources.Resource;
+import org.apache.catalina.WebResource;
+import org.apache.catalina.WebResourceRoot;
 import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 
@@ -124,14 +118,14 @@ public final class ExtensionValidator {
      * <code>ManifestResorce<code> objects. These objects are then passed
      * to the validateManifestResources method for validation.
      *
-     * @param dirContext The JNDI root of the Web Application
-     * @param context The context from which the Logger and path to the
-     *                application
+     * @param resources The resources configured for this Web Application
+     * @param context   The context from which the Logger and path to the
+     *                  application
      *
      * @return true if all required extensions satisfied
      */
     public static synchronized boolean validateApplication(
-                                           DirContext dirContext,
+                                           WebResourceRoot resources,
                                            Context context)
                     throws IOException {
 
@@ -139,17 +133,14 @@ public final class ExtensionValidator {
         ArrayList<ManifestResource> appManifestResources = new ArrayList<>();
         // If the application context is null it does not exist and
         // therefore is not valid
-        if (dirContext == null) return false;
+        if (resources == null) return false;
         // Find the Manifest for the Web Application
         InputStream inputStream = null;
         try {
-            NamingEnumeration<Binding> wne =
-                dirContext.listBindings("/META-INF/");
-            Binding binding = wne.nextElement();
-            if (binding.getName().toUpperCase(Locale.ENGLISH).equals("MANIFEST.MF")) {
-                Resource resource = (Resource)dirContext.lookup
-                                    ("/META-INF/" + binding.getName());
-                inputStream = resource.streamContent();
+            WebResource resource =
+                    resources.getResource("/META-INF/MANIFEST.MF");
+            if (resource.isFile()) {
+                inputStream = resource.getInputStream();
                 Manifest manifest = new Manifest(inputStream);
                 inputStream.close();
                 inputStream = null;
@@ -158,10 +149,6 @@ public final class ExtensionValidator {
                     manifest, ManifestResource.WAR);
                 appManifestResources.add(mre);
             }
-        } catch (NamingException nex) {
-            // Application does not contain a MANIFEST.MF file
-        } catch (NoSuchElementException nse) {
-            // Application does not contain a MANIFEST.MF file
         } finally {
             if (inputStream != null) {
                 try {
@@ -172,35 +159,23 @@ public final class ExtensionValidator {
             }
         }
 
-        // Locate the Manifests for all bundled JARs
-        NamingEnumeration<Binding> ne = null;
         try {
-            ne = dirContext.listBindings("WEB-INF/lib/");
-            while ((ne != null) && ne.hasMoreElements()) {
-                Binding binding = ne.nextElement();
-                if (!binding.getName().toLowerCase(Locale.ENGLISH).endsWith(".jar")) {
-                    continue;
-                }
-                Object obj =
-                    dirContext.lookup("/WEB-INF/lib/" + binding.getName());
-                if (!(obj instanceof Resource)) {
-                    // Probably a directory named xxx.jar - ignore it
-                    continue;
-                }
-                Resource resource = (Resource) obj;
-                inputStream = resource.streamContent();
-                Manifest jmanifest = getManifest(inputStream);
-                if (jmanifest != null) {
-                    ManifestResource mre = new ManifestResource(
-                                                binding.getName(),
-                                                jmanifest,
-                                                ManifestResource.APPLICATION);
-                    appManifestResources.add(mre);
+            WebResource[] jars = resources.listResources("/WEB-INF/lib");
+            for (WebResource jar : jars) {
+                if (jar.getName().toLowerCase(Locale.ENGLISH).endsWith(".jar") &&
+                        jar.isFile()) {
+
+                    inputStream = jar.getInputStream();
+                    Manifest jmanifest = getManifest(inputStream);
+                    if (jmanifest != null) {
+                        ManifestResource mre = new ManifestResource(
+                                                    jar.getName(),
+                                                    jmanifest,
+                                                    ManifestResource.APPLICATION);
+                        appManifestResources.add(mre);
+                    }
                 }
             }
-        } catch (NamingException nex) {
-            // Jump out of the check for this application because it
-            // has no resources
         } finally {
             if (inputStream != null) {
                 try {

Modified: tomcat/sandbox/trunk-resources/test/javax/el/TestCompositeELResolver.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/test/javax/el/TestCompositeELResolver.java?rev=1382553&r1=1382552&r2=1382553&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/test/javax/el/TestCompositeELResolver.java (original)
+++ tomcat/sandbox/trunk-resources/test/javax/el/TestCompositeELResolver.java Sun Sep  9 18:18:45 2012
@@ -24,9 +24,11 @@ import static org.junit.Assert.assertEqu
 
 import org.junit.Test;
 
+import org.apache.catalina.WebResourceRoot;
 import org.apache.catalina.core.StandardContext;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.catalina.startup.TomcatBaseTest;
+import org.apache.catalina.webresources.StandardRoot;
 import org.apache.tomcat.util.buf.ByteChunk;
 
 public class TestCompositeELResolver extends TomcatBaseTest {
@@ -42,7 +44,9 @@ public class TestCompositeELResolver ext
 
         // This test needs the JSTL libraries
         File lib = new File("webapps/examples/WEB-INF/lib");
-        ctxt.setAliases("/WEB-INF/lib=" + lib.getCanonicalPath());
+        ctxt.setResources(new StandardRoot(ctxt));
+        ctxt.getResources().createWebResourceSet(
+                WebResourceRoot.ResourceSetType.POST, lib, "/WEB-INF/lib", "");
 
         tomcat.start();
 

Modified: tomcat/sandbox/trunk-resources/test/org/apache/catalina/mbeans/TestRegistration.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/test/org/apache/catalina/mbeans/TestRegistration.java?rev=1382553&r1=1382552&r2=1382553&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/test/org/apache/catalina/mbeans/TestRegistration.java (original)
+++ tomcat/sandbox/trunk-resources/test/org/apache/catalina/mbeans/TestRegistration.java Sun Sep  9 18:18:45 2012
@@ -96,7 +96,6 @@ public class TestRegistration extends To
         return new String[] {
             "Tomcat:j2eeType=WebModule,name=//" + host + context +
                 ",J2EEApplication=none,J2EEServer=none",
-            "Tomcat:type=Cache,host=" + host + ",context=" + context,
             "Tomcat:type=Loader,context=" + context + ",host=" + host,
             "Tomcat:type=Manager,context=" + context + ",host=" + host,
             "Tomcat:type=NamingResources,context=" + context +
@@ -107,6 +106,8 @@ public class TestRegistration extends To
                 ",host=" + host + ",name=StandardContextValve",
             "Tomcat:type=WebappClassLoader,context=" + context +
                 ",host=" + host,
+            "Tomcat:type=WebResourceRoot,context=" + context +
+                ",host=" + host,
         };
     }
 

Modified: tomcat/sandbox/trunk-resources/test/org/apache/catalina/startup/TestContextConfigAnnotation.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/test/org/apache/catalina/startup/TestContextConfigAnnotation.java?rev=1382553&r1=1382552&r2=1382553&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/test/org/apache/catalina/startup/TestContextConfigAnnotation.java (original)
+++ tomcat/sandbox/trunk-resources/test/org/apache/catalina/startup/TestContextConfigAnnotation.java Sun Sep  9 18:18:45 2012
@@ -343,10 +343,6 @@ public class TestContextConfigAnnotation
         public void addPropertyChangeListener(PropertyChangeListener l) {
         }
         @Override
-        public void addRepository(String repository) {}
-        @Override
-        public String[] findRepositories() { return null; }
-        @Override
         public boolean modified() { return false; }
         @Override
         public void removePropertyChangeListener(PropertyChangeListener l) {}

Modified: tomcat/sandbox/trunk-resources/test/org/apache/jasper/compiler/TestGenerator.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/test/org/apache/jasper/compiler/TestGenerator.java?rev=1382553&r1=1382552&r2=1382553&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/test/org/apache/jasper/compiler/TestGenerator.java (original)
+++ tomcat/sandbox/trunk-resources/test/org/apache/jasper/compiler/TestGenerator.java Sun Sep  9 18:18:45 2012
@@ -35,9 +35,11 @@ import static org.junit.Assert.assertTru
 
 import org.junit.Test;
 
+import org.apache.catalina.WebResourceRoot;
 import org.apache.catalina.core.StandardContext;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.catalina.startup.TomcatBaseTest;
+import org.apache.catalina.webresources.StandardRoot;
 import org.apache.tomcat.util.buf.ByteChunk;
 
 public class TestGenerator extends TomcatBaseTest {
@@ -117,7 +119,9 @@ public class TestGenerator extends Tomca
 
         // This test needs the JSTL libraries
         File lib = new File("webapps/examples/WEB-INF/lib");
-        ctxt.setAliases("/WEB-INF/lib=" + lib.getCanonicalPath());
+        ctxt.setResources(new StandardRoot(ctxt));
+        ctxt.getResources().createWebResourceSet(
+                WebResourceRoot.ResourceSetType.POST, lib, "/WEB-INF/lib", "");
 
         tomcat.start();
 

Modified: tomcat/sandbox/trunk-resources/webapps/docs/config/context.xml
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/webapps/docs/config/context.xml?rev=1382553&r1=1382552&r2=1382553&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/webapps/docs/config/context.xml (original)
+++ tomcat/sandbox/trunk-resources/webapps/docs/config/context.xml Sun Sep  9 18:18:45 2012
@@ -530,30 +530,6 @@
         </p>
       </attribute>
 
-      <attribute name="aliases" required="false">
-        <p>This attribute provides a list of external locations from which to
-        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>Whitespace is permitted around both the <code>,</code> and
-        <code>=</code> delimiters, and will be trimmed. Therefore, an aliases
-        attribute with the value <code>"/aliasPath1 = docBase1,<br/>
-        /aliasPath2= docBase2"</code> is equivalent to
-        <code>"/aliasPath1=docBase1,/aliasPath2=docBase2"</code></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>
-        <p>A more powerful feature (for development only) is
-        <a href="#Virtual_webapp">Virtual webapp</a>.</p>
-      </attribute>
-
       <attribute name="allowLinking" required="false">
         <p>If the value of this flag is <code>true</code>, symlinks will be
         allowed inside the web application, pointing to resources outside the
@@ -1276,94 +1252,6 @@ for details.</p>
 
   </subsection>
 
-  <subsection name="Virtual webapp">
-    <p>During development it may be more productive to avoid copying files (static
-    resources, JSPs, classes, jars...) and configure tomcat to use files from their
-    source locations. To do that, several customisations of the context configuration are
-    required:</p>
-    <ul>
-      <li>The <code>VirtualDirContext</code> implementation of
-      <a href="resources.html">Resources</a></li>
-      <li>The <code>VirtualWebappLoader</code> implementation of
-      <a href="loader.html">Loader</a></li>
-      <li><code>scanAllDirectories="true"</code> on the <a href="jar-scanner.html">JarScanner</a></li>
-    </ul>
-    <p>To illustrate this feature, here is an example of a standard maven webapp source tree:</p>
-<source>
-mywebapp/
-         src/
-             main/
-                  java/
-                  resources/
-                  webapp/
-                         WEB-INF/
-                                 classes/
-         target/
-                classes/
-</source>
-    <p>To deploy such an application (assuming it also uses the log4j maven artefact),
-    the context configuration looks like:</p>
-<source>
-&lt;Context path="/mywebapp" docBase="/Users/theuser/mywebapp/src/main/webapp" >
-  &lt;Resources className="org.apache.naming.resources.VirtualDirContext"
-    extraResourcePaths=
-      "/WEB-INF/classes=/Users/theuser/mywebapp/target/classes" />
-  &lt;Loader className="org.apache.catalina.loader.VirtualWebappLoader"
-    virtualClasspath="/Users/theuser/mywebapp/target/classes;
-      /Users/theuser/.m2/repository/log4j/log4j/1.2.15/log4j-1.2.15.jar" />
-  &lt;JarScanner scanAllDirectories="true" />
-&lt;/Context>
-</source>
-
-    <p>Here is another example where the webapp serves pictures under /pictures and movies
-    under /movies and also depends on another maven project mylib that would normally
-    produce a jar to be packaged in WEB-INF/lib:</p>
-<source>
-mylib/
-      src/
-          main/
-               java/
-               resources/
-                         META-INF/
-                                  resources/
-      target/
-             classes/
-mymovies/
-mypictures/
-mywebapp/
-         src/
-             main/
-                  java/
-                  resources/
-                  webapp/
-                         WEB-INF/
-                                 classes/
-         target/
-                classes/
-</source>
-    <p>The configuration is:</p>
-
-<source wrapped="true">
-&lt;Context path="/mywebapp" docBase="/Users/theuser/mywebapp/src/main/webapp" >
-<indent>
-  &lt;Resources className="org.apache.naming.resources.VirtualDirContext"
-    <indent><outdent>extraResourcePaths="/WEB-INF/classes=/Users/theuser/mywebapp/target/classes,/pictures=/Users/theuser/mypictures,/movies=/Users/theuser/mymovies"</outdent></indent>
-    <indent>/></indent>
-</indent>
-<indent>
-  &lt;Loader className="org.apache.catalina.loader.VirtualWebappLoader"
-    <indent><outdent>virtualClasspath="/Users/theuser/mywebapp/target/classes;/Users/theuser/mylib/target/classes;/Users/theuser/.m2/repository/log4j/log4j/1.2.15/log4j-1.2.15.jar"</outdent></indent>
-    <indent>/></indent>
-</indent>
-<indent>
-  &lt;JarScanner scanAllDirectories="true" />
-</indent>
-&lt;/Context>
-</source>
-
-    <p>Note that resources in mylib/target/classes/META-INF/resources/ are mapped to / as
-    required by servlet 3 specification.</p>
-  </subsection>
 </section>
 
 

Modified: tomcat/sandbox/trunk-resources/webapps/docs/config/loader.xml
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/webapps/docs/config/loader.xml?rev=1382553&r1=1382552&r2=1382553&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/webapps/docs/config/loader.xml (original)
+++ tomcat/sandbox/trunk-resources/webapps/docs/config/loader.xml Sun Sep  9 18:18:45 2012
@@ -140,43 +140,6 @@
 
   </subsection>
 
-  <subsection name="VirtualWebappLoader Implementation">
-
-    <p>This implementation of <strong>Loader</strong> is
-    <strong>org.apache.catalina.loader.VirtualWebappLoader</strong>.
-    It extends <code>WebappLoader</code> and supports the following
-    additional attributes</p>
-
-    <attributes>
-
-      <attribute name="virtualClasspath" required="false">
-        <p>Additional repositories to search for resources.
-        Multiple values can be joined using <code>;</code>
-        as a separator.</p>
-        <p>Leading and trailing whitespaces in values are ignored.
-        If a value does not point to an existing directory or
-        <code>*.jar</code> file, it is silently skipped.
-        Diagnostic messages can be seen if you enable debug logging for
-        the VirtualWebappLoader class.
-        </p>
-        <p>Example: <code>virtualClasspath=&quot;${catalina.base}/myapp_config&quot;</code></p>
-      </attribute>
-
-      <attribute name="searchVirtualFirst" required="false">
-        <p>Set to <code>true</code> if you want the virtual
-        class path to be searched before
-        <code>WEB-INF/classes</code> and <code>WEB-INF/lib</code>.
-        Default value is <code>false</code>.</p>
-        <p>If searched before, resources located in the virtual
-        class path take precendence over resources with the same
-        name contained in the webapp.</p>
-      </attribute>
-
-    </attributes>
-
-  </subsection>
-
-
 </section>
 
 

Modified: tomcat/sandbox/trunk-resources/webapps/docs/config/resources.xml
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/webapps/docs/config/resources.xml?rev=1382553&r1=1382552&r2=1382553&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/webapps/docs/config/resources.xml (original)
+++ tomcat/sandbox/trunk-resources/webapps/docs/config/resources.xml Sun Sep  9 18:18:45 2012
@@ -94,28 +94,6 @@
 
   </subsection>
 
-  <subsection name="VirtualDirContext implementation">
-    <p>This implementation of <strong>Resources</strong> is
-    <strong>org.apache.naming.resources.VirtualDirContext</strong> and is aimed to be used
-    during development to deploy a webapp without copying files to a webapp compliant
-    directory structure.
-    It extends <code>FileDirContext</code> and supports the following
-    additional attributes</p>
-
-    <attributes>
-      <attribute name="extraResourcePaths" required="false">
-        <p>Allows to map a path of the filesystem to a path in the webapp. Multiple
-        filesystem paths can be mapped to the same path in the webapp. Filesystem
-        path and virtual path must be separated by an equal signe (=). Pairs of paths
-        must be separated by a column.</p>
-        Example: <code>/=/Users/jdoe/mywebapp/src/main/webapp,/=/Users/jdoe/mywebapp/src/main/webapp2,/pictures=/Users/jdoe/sharedpictures</code>
-        <p>The path to the docBase (as declared in the Context) must not be added here.</p>
-        <p>This attribute enhances the feature provided by the <code>aliases</code>
-        attribute of the <strong>StandardContext</strong>.</p>
-      </attribute>
-    </attributes>
-  </subsection>
-
 </section>
 
 

Modified: tomcat/sandbox/trunk-resources/webapps/docs/security-howto.xml
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/webapps/docs/security-howto.xml?rev=1382553&r1=1382552&r2=1382553&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/webapps/docs/security-howto.xml (original)
+++ tomcat/sandbox/trunk-resources/webapps/docs/security-howto.xml Sun Sep  9 18:18:45 2012
@@ -255,8 +255,7 @@
 
       <p>The <strong>allowLinking</strong> attribute controls if a context is
       allowed to use linked files. If enabled and the context is undeployed, the
-      links will be followed when deleting the context resources. To avoid this
-      behaviour, use the <strong>aliases</strong> attribute. Changing this
+      links will be followed when deleting the context resources. Changing this
       setting from the default of <code>false</code> on case insensitive
       operating systems (this includes Windows) will disable a number of
       security measures and allow, among other things, direct access to the



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


Mime
View raw message