You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2008/12/11 14:21:13 UTC

svn commit: r725679 - in /incubator/sling/trunk/jcr/webdav: ./ src/main/java/org/apache/sling/jcr/webdav/impl/helper/ src/main/java/org/apache/sling/jcr/webdav/impl/servlets/ src/main/resources/ src/main/resources/OSGI-INF/metatype/ src/main/resources/...

Author: fmeschbe
Date: Thu Dec 11 05:21:12 2008
New Revision: 725679

URL: http://svn.apache.org/viewvc?rev=725679&view=rev
Log:
SLING-767 Integrate MIME Type resolution with Sling functionliaty and provide
better configurability of the WebDAV servlets

Added:
    incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingMimeResolver.java
    incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingResourceConfig.java
    incubator/sling/trunk/jcr/webdav/src/main/resources/org/
    incubator/sling/trunk/jcr/webdav/src/main/resources/org/apache/
    incubator/sling/trunk/jcr/webdav/src/main/resources/org/apache/sling/
    incubator/sling/trunk/jcr/webdav/src/main/resources/org/apache/sling/jcr/
    incubator/sling/trunk/jcr/webdav/src/main/resources/org/apache/sling/jcr/webdav/
    incubator/sling/trunk/jcr/webdav/src/main/resources/org/apache/sling/jcr/webdav/impl/
    incubator/sling/trunk/jcr/webdav/src/main/resources/org/apache/sling/jcr/webdav/impl/helper/
    incubator/sling/trunk/jcr/webdav/src/main/resources/org/apache/sling/jcr/webdav/impl/helper/mimetypes.properties
Removed:
    incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/AbstractSlingWebDavServlet.java
    incubator/sling/trunk/jcr/webdav/src/main/resources/webdav-resource-config.xml
Modified:
    incubator/sling/trunk/jcr/webdav/pom.xml
    incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SimpleWebDavServlet.java
    incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SlingWebDavServlet.java
    incubator/sling/trunk/jcr/webdav/src/main/resources/OSGI-INF/metatype/metatype.properties

Modified: incubator/sling/trunk/jcr/webdav/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/webdav/pom.xml?rev=725679&r1=725678&r2=725679&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/webdav/pom.xml (original)
+++ incubator/sling/trunk/jcr/webdav/pom.xml Thu Dec 11 05:21:12 2008
@@ -125,6 +125,11 @@
             <artifactId>org.apache.sling.jcr.api</artifactId>
             <version>2.0.2-incubator</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.commons.osgi</artifactId>
+            <version>2.0.3-incubator-SNAPSHOT</version>
+        </dependency>
 
         <dependency>
             <groupId>org.apache.jackrabbit</groupId>

Added: incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingMimeResolver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingMimeResolver.java?rev=725679&view=auto
==============================================================================
--- incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingMimeResolver.java (added)
+++ incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingMimeResolver.java Thu Dec 11 05:21:12 2008
@@ -0,0 +1,38 @@
+/*
+ * $Url: $
+ * $Id: $
+ *
+ * Copyright 1997-2005 Day Management AG
+ * Barfuesserplatz 6, 4001 Basel, Switzerland
+ * All Rights Reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * Day Management AG, ("Confidential Information"). You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with Day.
+ */
+package org.apache.sling.jcr.webdav.impl.helper;
+
+import javax.servlet.ServletContext;
+
+import org.apache.jackrabbit.server.io.MimeResolver;
+
+public class SlingMimeResolver extends MimeResolver {
+
+    private final ServletContext servletContext;
+    
+    public SlingMimeResolver(ServletContext servletContext) {
+        this.servletContext = servletContext;
+    }
+
+    @Override
+    public String getMimeType(String filename) {
+        String type = servletContext.getMimeType(filename);
+        if (type == null) {
+            type = getDefaultMimeType();
+        }
+        return type;
+    }
+    
+}

Added: incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingResourceConfig.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingResourceConfig.java?rev=725679&view=auto
==============================================================================
--- incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingResourceConfig.java (added)
+++ incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingResourceConfig.java Thu Dec 11 05:21:12 2008
@@ -0,0 +1,171 @@
+/*
+ * $Url: $
+ * $Id: $
+ *
+ * Copyright 1997-2005 Day Management AG
+ * Barfuesserplatz 6, 4001 Basel, Switzerland
+ * All Rights Reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * Day Management AG, ("Confidential Information"). You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with Day.
+ */
+package org.apache.sling.jcr.webdav.impl.helper;
+
+import java.net.URL;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import javax.jcr.Item;
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.servlet.ServletContext;
+
+import org.apache.jackrabbit.server.io.DefaultHandler;
+import org.apache.jackrabbit.server.io.DirListingExportHandler;
+import org.apache.jackrabbit.server.io.IOManager;
+import org.apache.jackrabbit.server.io.IOManagerImpl;
+import org.apache.jackrabbit.server.io.MimeResolver;
+import org.apache.jackrabbit.server.io.PropertyManager;
+import org.apache.jackrabbit.server.io.PropertyManagerImpl;
+import org.apache.jackrabbit.webdav.simple.DefaultItemFilter;
+import org.apache.jackrabbit.webdav.simple.ItemFilter;
+import org.apache.jackrabbit.webdav.simple.ResourceConfig;
+import org.apache.jackrabbit.webdav.simple.SimpleWebdavServlet;
+import org.apache.sling.commons.osgi.OsgiUtil;
+import org.apache.sling.jcr.webdav.impl.servlets.SlingWebDavServlet;
+
+public class SlingResourceConfig extends ResourceConfig {
+
+    private final MimeResolver mimeResolver;
+
+    private final String[] collectionTypes;
+
+    private final ItemFilter itemFilter;
+
+    private final IOManager ioManager;
+
+    private final PropertyManager propertyManager;
+
+    private final String servletContextPath;
+
+    private final Dictionary<String, String> servletInitParams;
+
+    public SlingResourceConfig(ServletContext servletContext,
+            Dictionary<?, ?> config) {
+        mimeResolver = new SlingMimeResolver(servletContext);
+        collectionTypes = OsgiUtil.toStringArray(
+            config.get(SlingWebDavServlet.COLLECTION_TYPES),
+            SlingWebDavServlet.COLLECTION_TYPES_DEFAULT);
+
+        String[] filterPrefixes = OsgiUtil.toStringArray(
+            config.get(SlingWebDavServlet.FILTER_PREFIXES),
+            SlingWebDavServlet.FILTER_PREFIXES_DEFAULT);
+        String[] filterNodeTypes = OsgiUtil.toStringArray(
+            config.get(SlingWebDavServlet.FILTER_TYPES),
+            SlingWebDavServlet.EMPTY_DEFAULT);
+        String[] filterURIs = OsgiUtil.toStringArray(
+            config.get(SlingWebDavServlet.FILTER_URIS),
+            SlingWebDavServlet.EMPTY_DEFAULT);
+
+        itemFilter = new DefaultItemFilter();
+        itemFilter.setFilteredPrefixes(filterPrefixes);
+        itemFilter.setFilteredURIs(filterURIs);
+        itemFilter.setFilteredNodetypes(filterNodeTypes);
+
+        String collectionType = OsgiUtil.toString(
+            config.get(SlingWebDavServlet.TYPE_COLLECTIONS),
+            SlingWebDavServlet.TYPE_COLLECTIONS_DEFAULT);
+        String nonCollectionType = OsgiUtil.toString(
+            config.get(SlingWebDavServlet.TYPE_NONCOLLECTIONS),
+            SlingWebDavServlet.TYPE_NONCOLLECTIONS_DEFAULT);
+        String contentType = OsgiUtil.toString(
+            config.get(SlingWebDavServlet.TYPE_CONTENT),
+            SlingWebDavServlet.TYPE_CONTENT_DEFAULT);
+
+        // share these handlers between the IOManager and the PropertyManager
+        DirListingExportHandler dirHandler = new DirListingExportHandler();
+        DefaultHandler defaultHandler = new DefaultHandler(null, collectionType,
+            nonCollectionType, contentType);
+        
+        ioManager = new IOManagerImpl();
+        ioManager.addIOHandler(dirHandler);
+        ioManager.addIOHandler(defaultHandler);
+
+        propertyManager = new PropertyManagerImpl();
+        propertyManager.addPropertyHandler(dirHandler);
+        propertyManager.addPropertyHandler(defaultHandler);
+
+        servletContextPath = OsgiUtil.toString(
+            config.get(SlingWebDavServlet.PROP_CONTEXT),
+            SlingWebDavServlet.DEFAULT_CONTEXT);
+
+        servletInitParams = new Hashtable<String, String>();
+        servletInitParams.put(
+            SimpleWebdavServlet.INIT_PARAM_RESOURCE_PATH_PREFIX,
+            servletContextPath);
+        String value = OsgiUtil.toString(
+            config.get(SlingWebDavServlet.PROP_REALM),
+            SlingWebDavServlet.DEFAULT_REALM);
+        servletInitParams.put(
+            SimpleWebdavServlet.INIT_PARAM_AUTHENTICATE_HEADER,
+            "Basic Realm=\"" + value + "\"");
+    }
+
+    // ---------- ResourceConfig overwrites
+
+    @Override
+    public IOManager getIOManager() {
+        return ioManager;
+    }
+
+    @Override
+    public ItemFilter getItemFilter() {
+        return itemFilter;
+    }
+
+    @Override
+    public MimeResolver getMimeResolver() {
+        return mimeResolver;
+    }
+
+    @Override
+    public PropertyManager getPropertyManager() {
+        return propertyManager;
+    }
+
+    @Override
+    public boolean isCollectionResource(Item item) {
+        if (item.isNode()) {
+            Node node = (Node) item;
+            for (String type : collectionTypes) {
+                try {
+                    if (node.isNodeType(type)) {
+                        return false;
+                    }
+                } catch (RepositoryException re) {
+                    // TODO: log and continue
+                }
+            }
+        }
+
+        return true;
+    }
+
+    @Override
+    public void parse(URL configURL) {
+        // we don't parse nothing
+    }
+
+    // ---------- SlingResourceConfig additions
+
+    public String getServletContextPath() {
+        return servletContextPath;
+    }
+
+    public Dictionary<String, String> getServletInitParams() {
+        return servletInitParams;
+    }
+}

Modified: incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SimpleWebDavServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SimpleWebDavServlet.java?rev=725679&r1=725678&r2=725679&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SimpleWebDavServlet.java (original)
+++ incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SimpleWebDavServlet.java Thu Dec 11 05:21:12 2008
@@ -19,47 +19,41 @@
 package org.apache.sling.jcr.webdav.impl.servlets;
 
 import java.io.IOException;
-import java.util.Dictionary;
-import java.util.Hashtable;
 
+import javax.jcr.Repository;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.jackrabbit.webdav.simple.SimpleWebdavServlet;
 import org.apache.sling.jcr.api.SlingRepository;
-import org.osgi.service.component.ComponentContext;
-import org.osgi.service.http.HttpService;
-import org.osgi.service.http.NamespaceException;
+import org.apache.sling.jcr.webdav.impl.helper.SlingResourceConfig;
 
 /**
  * The <code>SimpleWebDavServlet</code>
- * 
- * @scr.component label="%dav.name" description="%dav.description"
- * @scr.property name="service.description"
- *                value="Sling JcrResourceResolverFactory Implementation"
- * @scr.property name="service.vendor" value="The Apache Software Foundation"
  */
-public class SimpleWebDavServlet extends AbstractSlingWebDavServlet {
+public class SimpleWebDavServlet extends SimpleWebdavServlet {
 
-    /** @scr.property valueRef="DEFAULT_CONTEXT" */
-    private static final String PROP_CONTEXT = "dav.root";
+    private final SlingResourceConfig resourceConfig;
 
-    /** @scr.property valueRef="DEFAULT_REALM" */
-    private static final String PROP_REALM = "dav.realm";
+    private final Repository repository;
 
-    private static final String DEFAULT_CONTEXT = "/dav";
-
-    private static final String DEFAULT_REALM = "Sling WebDAV";
-    
-    /** @scr.reference */
-    private HttpService httpService;
-
-    // the alias under which the servlet is registered, null if not
-    private String contextPath;
+    /* package */SimpleWebDavServlet(SlingResourceConfig resourceConfig,
+            Repository repository) {
+        this.resourceConfig = resourceConfig;
+        this.repository = repository;
+    }
 
     // ---------- AbstractWebdavServlet overwrite ------------------------------
 
     @Override
+    public void init() throws ServletException {
+        super.init();
+        
+        setResourceConfig(resourceConfig);
+    }
+    
+    @Override
     protected void service(HttpServletRequest request,
             HttpServletResponse response) throws ServletException, IOException {
 
@@ -85,51 +79,17 @@
                 uri += slingRepo.getDefaultWorkspace();
                 response.sendRedirect(uri);
             }
-            
+
         } else {
-        
+
             super.service(request, response);
         }
-        
-    }
 
-    // ---------- SCR integration ----------------------------------------------
-
-    protected void activate(ComponentContext componentContext)
-            throws NamespaceException, ServletException {
-
-        Dictionary<?, ?> props = componentContext.getProperties();
-
-        String context = getString(props, PROP_CONTEXT, DEFAULT_CONTEXT);
-
-        Dictionary<String, String> initparams = new Hashtable<String, String>();
-
-        initparams.put(INIT_PARAM_RESOURCE_PATH_PREFIX, context);
-
-        String value = getString(props, PROP_REALM, DEFAULT_REALM);
-        initparams.put(INIT_PARAM_AUTHENTICATE_HEADER, "Basic Realm=\"" + value
-            + "\"");
-
-        // Register servlet, and set the contextPath field to signal successful
-        // registration
-        httpService.registerServlet(context, this, initparams, null);
-        this.contextPath = context;
     }
 
-    protected void deactivate(ComponentContext context) {
-        if (contextPath != null) {
-            httpService.unregister(contextPath);
-            contextPath = null;
-        }
-    }
-
-    // ---------- internal -----------------------------------------------------
-
-    private String getString(Dictionary<?, ?> props, String name,
-            String defaultValue) {
-        Object propValue = props.get(name);
-        return (propValue instanceof String)
-                ? (String) propValue
-                : defaultValue;
+    @Override
+    public Repository getRepository() {
+        return repository;
     }
+    
 }

Modified: incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SlingWebDavServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SlingWebDavServlet.java?rev=725679&r1=725678&r2=725679&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SlingWebDavServlet.java (original)
+++ incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SlingWebDavServlet.java Thu Dec 11 05:21:12 2008
@@ -18,57 +18,123 @@
  */
 package org.apache.sling.jcr.webdav.impl.servlets;
 
+import javax.jcr.Repository;
 import javax.jcr.Session;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
 
 import org.apache.jackrabbit.server.SessionProvider;
 import org.apache.jackrabbit.webdav.DavLocatorFactory;
+import org.apache.jackrabbit.webdav.simple.SimpleWebdavServlet;
 import org.apache.sling.jcr.api.SlingRepository;
 import org.apache.sling.jcr.webdav.impl.helper.SlingLocatorFactory;
+import org.apache.sling.jcr.webdav.impl.helper.SlingResourceConfig;
 import org.apache.sling.jcr.webdav.impl.helper.SlingSessionProvider;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.http.HttpService;
+import org.osgi.service.http.NamespaceException;
 
 /**
  * The <code>SlingWebDavServlet</code> implements the WebDAV protocol as a
  * default servlet for Sling handling all WebDAV methods.
  * 
- * @scr.component
- *  immediate="true"
- *  metatype="no"
- *
- * @scr.service
- *  interface="javax.servlet.Servlet"
- *
- * @scr.property
- *  name="service.description"
- *  value="Sling WebDAV Servlet"
- *
- * @scr.property
- *  name="service.vendor"
- *  value="The Apache Software Foundation"
- *
- * Use this as the default servlet for all requests to Sling
- * @scr.property
- *  name="sling.servlet.resourceTypes"
- *  value="sling/servlet/default"
- * @scr.property
- *  name="sling.servlet.methods"
- *  value="*"
+ * @scr.component name="org.apache.sling.jcr.webdav.impl.servlets.SimpleWebDavServlet"
+ *                label="%dav.name" description="%dav.description"
+ *                immediate="true"
+ * @scr.service interface="javax.servlet.Servlet"
+ * @scr.property name="service.description" value="Sling WebDAV Servlet"
+ * @scr.property name="service.vendor" value="The Apache Software Foundation"
+ * @scr.property name="sling.servlet.resourceTypes"
+ *               value="sling/servlet/default" private="true"
+ * @scr.property name="sling.servlet.methods" value="*" private="true"
  */
-public class SlingWebDavServlet extends AbstractSlingWebDavServlet {
+public class SlingWebDavServlet extends SimpleWebdavServlet {
+
+    /** @scr.property valueRef="DEFAULT_CONTEXT" */
+    public static final String PROP_CONTEXT = "dav.root";
+
+    /** @scr.property valueRef="DEFAULT_REALM" */
+    public static final String PROP_REALM = "dav.realm";
+
+    /** @scr.property valueRef="COLLECTION_TYPES_DEFAULT" */
+    public static final String COLLECTION_TYPES = "collection.types";
+
+    /** @scr.property valueRef="FILTER_PREFIXES_DEFAULT" */
+    public static final String FILTER_PREFIXES = "filter.prefixes";
+
+    /** @scr.property valueRef="EMPTY_DEFAULT" */
+    public static final String FILTER_TYPES = "filter.types";
+
+    /** @scr.property valueRef="EMPTY_DEFAULT" */
+    public static final String FILTER_URIS = "filter.uris";
+
+    /** @scr.property valueRef="TYPE_COLLECTIONS_DEFAULT" */
+    public static final String TYPE_COLLECTIONS = "type.collections";
+
+    /** @scr.property valueRef="TYPE_NONCOLLECTIONS_DEFAULT" */
+    public static final String TYPE_NONCOLLECTIONS = "type.noncollections";
+
+    /** @scr.property valueRef="TYPE_CONTENT_DEFAULT" */
+    public static final String TYPE_CONTENT = "type.content";
+
+    public static final String DEFAULT_CONTEXT = "/dav";
+
+    public static final String DEFAULT_REALM = "Sling WebDAV";
+
+    public static final String[] EMPTY_DEFAULT = new String[0];
+
+    public static final String[] FILTER_PREFIXES_DEFAULT = new String[] {
+        "rep", "jcr" };
+
+    public static final String TYPE_COLLECTIONS_DEFAULT = "sling:Folder";
+
+    public static final String TYPE_NONCOLLECTIONS_DEFAULT = "nt:file";
+
+    public static final String TYPE_CONTENT_DEFAULT = "nt:resource";
+
+    public static final String[] COLLECTION_TYPES_DEFAULT = new String[] {
+        TYPE_NONCOLLECTIONS_DEFAULT, TYPE_CONTENT_DEFAULT };
+
+    /** @scr.reference */
+    private SlingRepository repository;
+
+    /** @scr.reference */
+    private HttpService httpService;
+
+    /** @scr.reference */
+    private ServletContext servletContext;
+
+    private SlingResourceConfig resourceConfig;
 
     private DavLocatorFactory locatorFactory;
-    
+
     private SessionProvider sessionProvider;
+    
+    private boolean simpleWebDavServletRegistered;
+
+    // ---------- SimpleWebdavServlet overwrites -------------------------------
 
-    //---------- SimpleWebdavServlet overwrites -------------------------------
+    @Override
+    public void init() throws ServletException {
+        super.init();
+        
+        setResourceConfig(resourceConfig);
+    }
     
     @Override
+    public Repository getRepository() {
+        return repository;
+    }
+
+    @Override
     public DavLocatorFactory getLocatorFactory() {
         if (locatorFactory == null) {
-            
+
             // configured default workspace name
             SlingRepository slingRepo = (SlingRepository) getRepository();
             String workspace = slingRepo.getDefaultWorkspace();
-            
+
             // no configuration, try to login and acquire the default name
             if (workspace == null || workspace.length() == 0) {
                 Session tmp = null;
@@ -84,12 +150,12 @@
                     }
                 }
             }
-            
+
             locatorFactory = new SlingLocatorFactory(workspace);
         }
         return locatorFactory;
     }
-    
+
     @Override
     public synchronized SessionProvider getSessionProvider() {
         if (sessionProvider == null) {
@@ -97,4 +163,31 @@
         }
         return sessionProvider;
     }
+
+    // ---------- SCR integration
+
+    protected void activate(ComponentContext context)
+            throws NamespaceException, ServletException {
+
+        resourceConfig = new SlingResourceConfig(servletContext,
+            context.getProperties());
+
+        // Register servlet, and set the contextPath field to signal successful
+        // registration
+        Servlet simpleServlet = new SimpleWebDavServlet(resourceConfig,
+            getRepository());
+        httpService.registerServlet(resourceConfig.getServletContextPath(),
+            simpleServlet, resourceConfig.getServletInitParams(), null);
+        simpleWebDavServletRegistered = true;
+    }
+
+    protected void deactivate(ComponentContext context) {
+        
+        if (simpleWebDavServletRegistered) {
+            httpService.unregister(resourceConfig.getServletContextPath());
+            simpleWebDavServletRegistered = false;
+        }
+
+        resourceConfig = null;
+    }
 }

Modified: incubator/sling/trunk/jcr/webdav/src/main/resources/OSGI-INF/metatype/metatype.properties
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/webdav/src/main/resources/OSGI-INF/metatype/metatype.properties?rev=725679&r1=725678&r2=725679&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/webdav/src/main/resources/OSGI-INF/metatype/metatype.properties (original)
+++ incubator/sling/trunk/jcr/webdav/src/main/resources/OSGI-INF/metatype/metatype.properties Thu Dec 11 05:21:12 2008
@@ -32,10 +32,70 @@
  complete Repository. It is directly accessible in its own URL space and \
  requests to this servlet do not pass by the Sling Main Servlet and request \
  processing.
+ 
 dav.root.name = Root Path
 dav.root.description = The root path at which the Simple WebDAV Servlet is \
- accessible. The default value is "/dav". 
+ accessible. The default value is "/dav". Access to the repository is provided \
+ in two ways. You may connect your WebDAV client directly to the root of the \
+ Sling web application to access the workspace of Sling directly. The other way \
+ is required if you want to connect your WebDAV client to any other workspace \
+ besides the Sling workspace. In this case you connect your WebDAV client to \
+ another a path comprised of this root path plus the name of the workspace. For \
+ example to connect to the some_other workspace, you might connect to \
+ http://slinghost/dav/some_other. 
+  
 dav.realm.name = Authentication Realm
 dav.realm.description = The name of the HTTP Basic Authentication Realm \
  presented to the client to ask for authentication credentials to access the \
  repository.
+
+collection.types.name = Non Collection Node Types
+collection.types.description = The JCR Node Types considered being \
+ non-collection resouces by WebDAV. Any node replying true to Node.isNodeType() \
+ for one of the listed types is considered a non-collection resource. Otherwise \
+ the respective node is considered a colleciton resource.
+  
+filter.prefixes.name = Filter Prefixes
+filter.prefixes.description = A list of namespace prefixes indicating JCR items \
+ filtered from being reported as collection members or properties. The default \
+ list includes jcr and rep (Jackrabbit internal namespace prefix) items. \
+ Do not modify this setting unless you know exactly what you are doing.
+ 
+filter.uris.name = Filter URIs
+filter.uris.description = A list of namespace URIs indicating JCR items \
+ filtered from being reported as collection members or properties. The default \
+ list is empty. Do not modify this setting unless you know exactly what you \
+ are doing.
+ 
+filter.types.name = Filter Node Types
+filter.types.description = Nodetype names to be used to filter child nodes. \
+ A child node can be filtered if the declaring nodetype of its definition is \
+ one of the nodetype names specified in the nodetypes Element. E.g. defining \
+ rep:root as filtered nodetype whould result in jcr:system being hidden but \
+ no other child node of the root node, since those are defined by the nodetype \
+ nt:unstructered. The default is empty. Do not modify this setting unless you \
+ know exactly what you are doing.
+
+type.collections.name = Collection Primary Type
+type.collections.description = The JCR Primary Node Type to assign to nodes \
+ created to reflect WebDAV collections. The default value is sling:Folder. \
+ You may name any primary node type here, provided it allows the creation of \
+ nodex of this type and the defined Non-Collection Primary Type below it.
+ 
+type.noncollections.name = Non-Collection Primary Type
+type.noncollections.description = The JCR Primary Node Type to assign to \
+ nodes created to reflect WebDAV non-collection resources. The default value \
+ is nt:file. You may name any primary node type here, provided the node type \
+ is allowed to be created below nodes of the type defined for the Collection \
+ Primary Type and that a child node with the name "jcr:content" may be created \
+ below the non-collection resource whose type is defined by the Content Primary \
+ Type.
+  
+type.content.name = Content Primary Type
+type.content.description = The JCR Primary Node Type to assign to the \
+ jcr:content child node of a WebDAV non-collection resource. The default value \
+ is nt:resource. You may name any primary node type here, provided the node \
+ type is allowed to be created as the jcr:content child node of the node type \
+ defined by the Non-Collection Primary Type. In addition the node type must \
+ allow at least the following properties: jcr:data (binary), jcr:lastModified \
+ (date), and jcr:mimeType (string).
\ No newline at end of file

Added: incubator/sling/trunk/jcr/webdav/src/main/resources/org/apache/sling/jcr/webdav/impl/helper/mimetypes.properties
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/webdav/src/main/resources/org/apache/sling/jcr/webdav/impl/helper/mimetypes.properties?rev=725679&view=auto
==============================================================================
--- incubator/sling/trunk/jcr/webdav/src/main/resources/org/apache/sling/jcr/webdav/impl/helper/mimetypes.properties (added)
+++ incubator/sling/trunk/jcr/webdav/src/main/resources/org/apache/sling/jcr/webdav/impl/helper/mimetypes.properties Thu Dec 11 05:21:12 2008
@@ -0,0 +1,23 @@
+#  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.
+
+#
+# This file is required by the Jackrabbit MimeResolver class, which uses
+# the class loader to retrieve the mimetypes.properties file from the same
+# package as the class.
+#
+# We don't have any MIME Type mappings here, since the SlingMimeResolver
+# is based on Sling's MIME Type Resolution
+#
\ No newline at end of file