You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:50:12 UTC
[sling-org-apache-sling-jcr-webdav] 09/31: SLING-767 Integrate MIME
Type resolution with Sling functionliaty and provide better configurability
of the WebDAV servlets
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.jcr.webdav-2.0.6-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-webdav.git
commit a0ed9b8f050a9e56db6d18bedbbbef9e79aaa76a
Author: Felix Meschberger <fm...@apache.org>
AuthorDate: Thu Dec 11 13:21:12 2008 +0000
SLING-767 Integrate MIME Type resolution with Sling functionliaty and provide
better configurability of the WebDAV servlets
git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/jcr/webdav@725679 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 5 +
.../jcr/webdav/impl/helper/SlingMimeResolver.java | 38 +++++
.../webdav/impl/helper/SlingResourceConfig.java | 171 +++++++++++++++++++++
.../impl/servlets/AbstractSlingWebDavServlet.java | 65 --------
.../webdav/impl/servlets/SimpleWebDavServlet.java | 88 +++--------
.../webdav/impl/servlets/SlingWebDavServlet.java | 151 ++++++++++++++----
.../OSGI-INF/metatype/metatype.properties | 62 +++++++-
.../jcr/webdav/impl/helper/mimetypes.properties | 23 +++
src/main/resources/webdav-resource-config.xml | 156 -------------------
9 files changed, 444 insertions(+), 315 deletions(-)
diff --git a/pom.xml b/pom.xml
index 696b6fa..bb75c6c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -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>
diff --git a/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingMimeResolver.java b/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingMimeResolver.java
new file mode 100644
index 0000000..749a6a9
--- /dev/null
+++ b/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingMimeResolver.java
@@ -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;
+ }
+
+}
diff --git a/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingResourceConfig.java b/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingResourceConfig.java
new file mode 100644
index 0000000..a85404b
--- /dev/null
+++ b/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingResourceConfig.java
@@ -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;
+ }
+}
diff --git a/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/AbstractSlingWebDavServlet.java b/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/AbstractSlingWebDavServlet.java
deleted file mode 100644
index a5145d1..0000000
--- a/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/AbstractSlingWebDavServlet.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.jcr.webdav.impl.servlets;
-
-import java.net.URL;
-
-import javax.jcr.Repository;
-import javax.servlet.ServletException;
-import javax.servlet.UnavailableException;
-
-import org.apache.jackrabbit.webdav.simple.ResourceConfig;
-import org.apache.jackrabbit.webdav.simple.SimpleWebdavServlet;
-import org.apache.sling.jcr.api.SlingRepository;
-
-/**
- * The <code>SimpleWebDavServlet</code>
- *
- * @scr.component
- * immediate="true"
- * metatype="no"
- */
-abstract class AbstractSlingWebDavServlet extends SimpleWebdavServlet {
-
- /** @scr.reference */
- private SlingRepository repository;
-
- @Override
- public Repository getRepository() {
- return repository;
- }
-
- @Override
- public void init() throws ServletException {
- super.init();
-
- // for now, the ResourceConfig is fixed
- final String configPath = "/webdav-resource-config.xml";
- final ResourceConfig rc = new ResourceConfig();
- final URL cfg = getClass().getResource(configPath);
- if (cfg == null) {
- throw new UnavailableException("ResourceConfig source not found:"
- + configPath);
- }
-
- rc.parse(cfg);
- setResourceConfig(rc);
- }
-
-}
diff --git a/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SimpleWebDavServlet.java b/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SimpleWebDavServlet.java
index 3392698..6ecb49c 100644
--- a/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SimpleWebDavServlet.java
+++ b/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SimpleWebDavServlet.java
@@ -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 @@ public class SimpleWebDavServlet extends AbstractSlingWebDavServlet {
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;
}
+
}
diff --git a/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SlingWebDavServlet.java b/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SlingWebDavServlet.java
index e68cba3..fdfe431 100644
--- a/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SlingWebDavServlet.java
+++ b/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SlingWebDavServlet.java
@@ -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 @@ public class SlingWebDavServlet extends AbstractSlingWebDavServlet {
}
}
}
-
+
locatorFactory = new SlingLocatorFactory(workspace);
}
return locatorFactory;
}
-
+
@Override
public synchronized SessionProvider getSessionProvider() {
if (sessionProvider == null) {
@@ -97,4 +163,31 @@ public class SlingWebDavServlet extends AbstractSlingWebDavServlet {
}
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;
+ }
}
diff --git a/src/main/resources/OSGI-INF/metatype/metatype.properties b/src/main/resources/OSGI-INF/metatype/metatype.properties
index 1d6bd0e..4fd5886 100644
--- a/src/main/resources/OSGI-INF/metatype/metatype.properties
+++ b/src/main/resources/OSGI-INF/metatype/metatype.properties
@@ -32,10 +32,70 @@ dav.description = The Simple WebDAV Servlet allows direct access to the \
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
diff --git a/src/main/resources/org/apache/sling/jcr/webdav/impl/helper/mimetypes.properties b/src/main/resources/org/apache/sling/jcr/webdav/impl/helper/mimetypes.properties
new file mode 100644
index 0000000..da8f690
--- /dev/null
+++ b/src/main/resources/org/apache/sling/jcr/webdav/impl/helper/mimetypes.properties
@@ -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
diff --git a/src/main/resources/webdav-resource-config.xml b/src/main/resources/webdav-resource-config.xml
deleted file mode 100644
index 3d9175b..0000000
--- a/src/main/resources/webdav-resource-config.xml
+++ /dev/null
@@ -1,156 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-<!--
-<!DOCTYPE config [
- <!ELEMENT config (iomanager , propertymanager, (collection | noncollection)? , filter?) >
-
- <!ELEMENT iomanager (class, iohandler*) >
- <!ELEMENT iohandler (class) >
-
- <!ELEMENT propertymanager (class, propertyhandler*) >
- <!ELEMENT propertyhandler (class) >
-
- <!ELEMENT collection (nodetypes) >
- <!ELEMENT noncollection (nodetypes) >
-
- <!ELEMENT filter (class, namespaces?, nodetypes?) >
-
- <!ELEMENT class >
- <!ATTLIST class
- name CDATA #REQUIRED
- >
- <!ELEMENT namespaces (prefix | uri)* >
- <!ELEMENT prefix (CDATA) >
- <!ELEMENT uri (CDATA) >
-
- <!ELEMENT nodetypes (nodetype)* >
- <!ELEMENT nodetype (CDATA) >
-]>
--->
-
-<config>
- <!--
- Defines the IOManager implementation that is responsible for passing import/export
- request to the individual IO-handlers.
- -->
- <iomanager>
- <!-- class element defines the manager to be used. The specified class
- must implement the IOManager interface.
- Note, that the handlers are being added and called in the order
- they appear in the configuration.
- -->
- <class name="org.apache.jackrabbit.server.io.IOManagerImpl" />
- <iohandler>
- <class name="org.apache.jackrabbit.server.io.DirListingExportHandler" />
- </iohandler>
- <iohandler>
- <class name="org.apache.jackrabbit.server.io.DefaultHandler" />
- </iohandler>
- </iomanager>
- <!--
- Example config for iomanager that populates its list of handlers with
- default values. Therefore the 'iohandler' elements are omited.
- -->
- <!--
- <iomanager>
- <class name="org.apache.jackrabbit.server.io.DefaultIOManager" />
- </iomanager>
- -->
- <!--
- Defines the PropertyManager implementation that is responsible for export
- and import of resource properties.
- -->
- <propertymanager>
- <!-- class element defines the manager to be used. The specified class
- must implement the PropertyManager interface.
- Note, that the handlers are being added and called in the order
- they appear in the configuration.
- -->
- <class name="org.apache.jackrabbit.server.io.PropertyManagerImpl" />
- <propertyhandler>
- <class name="org.apache.jackrabbit.server.io.ZipHandler" />
- </propertyhandler>
- <propertyhandler>
- <class name="org.apache.jackrabbit.server.io.XmlHandler" />
- </propertyhandler>
- <propertyhandler>
- <class name="org.apache.jackrabbit.server.io.DirListingExportHandler" />
- </propertyhandler>
- <propertyhandler>
- <class name="org.apache.jackrabbit.server.io.DefaultHandler" />
- </propertyhandler>
- </propertymanager>
- <!--
- Define nodetypes, that should never by displayed as 'collection'
- -->
- <noncollection>
- <nodetypes>
- <nodetype>nt:file</nodetype>
- <nodetype>nt:resource</nodetype>
- </nodetypes>
- </noncollection>
- <!--
- Example: Defines nodetypes, that should always be displayed as 'collection'.
- -->
- <!--
- <collection>
- <nodetypes>
- <nodetype>nt:folder</nodetype>
- <nodetype>rep:root</nodetype>
- </nodetypes>
- </collection>
- -->
- <!--
- Filter that allows to prevent certain items from being displayed.
- Please note, that this has an effect on PROPFIND calls only and does not
- provide limited access to those items matching any of the filters.
-
- However specifying a filter may cause problems with PUT or MKCOL if the
- resource to be created is being filtered out, thus resulting in inconsistent
- responses (e.g. PUT followed by PROPFIND on parent).
- -->
- <filter>
- <!-- class element defines the resource filter to be used. The specified class
- must implement the ItemFilter interface -->
- <class name="org.apache.jackrabbit.webdav.simple.DefaultItemFilter" />
- <!-- 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.
- -->
- <!--
- <nodetypes>
- <nodetype>rep:root</nodetype>
- </nodetypes>
- -->
- <!-- Namespace prefixes or uris. Items having a name that matches any of the
- entries will be filtered.
- -->
- <namespaces>
- <prefix>rep</prefix>
- <prefix>jcr</prefix>
- <!--
- <uri>internal</uri>
- <uri>http://www.jcp.org/jcr/1.0</uri>
- -->
- </namespaces>
- </filter>
-</config>
-
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.