incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r612808 - in /incubator/sling/trunk/jcr/webdav/src/main: java/org/apache/sling/jcr/webdav/SimpleWebDavServlet.java resources/webdav-resource-config.xml
Date Thu, 17 Jan 2008 13:15:34 GMT
Author: bdelacretaz
Date: Thu Jan 17 05:14:44 2008
New Revision: 612808

URL: http://svn.apache.org/viewvc?rev=612808&view=rev
Log:
Added webdav-resource-config.xml to map nt:file and related nodetypes in the usual way

Added:
    incubator/sling/trunk/jcr/webdav/src/main/resources/webdav-resource-config.xml   (with
props)
Modified:
    incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/SimpleWebDavServlet.java

Modified: incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/SimpleWebDavServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/SimpleWebDavServlet.java?rev=612808&r1=612807&r2=612808&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/SimpleWebDavServlet.java
(original)
+++ incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/SimpleWebDavServlet.java
Thu Jan 17 05:14:44 2008
@@ -19,6 +19,7 @@
 package org.apache.sling.jcr.webdav;
 
 import java.io.IOException;
+import java.net.URL;
 import java.util.Dictionary;
 import java.util.Hashtable;
 
@@ -27,11 +28,11 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.jackrabbit.webdav.simple.ResourceConfig;
 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;
 
 /**
  * The <code>SimpleWebDavServlet</code>
@@ -61,7 +62,7 @@
     public Repository getRepository() {
         return repository;
     }
-
+    
     // ---------- AbstractWebdavServlet overwrite ------------------------------
 
     @Override
@@ -84,7 +85,7 @@
     
     // ---------- SCR integration ----------------------------------------------
 
-    protected void activate(ComponentContext componentContext) {
+    protected void activate(ComponentContext componentContext) throws Exception {
         Dictionary<?, ?> props = componentContext.getProperties();
 
         String context = getString(props, PROP_CONTEXT, DEFAULT_CONTEXT);
@@ -98,25 +99,25 @@
             initparams.put(INIT_PARAM_AUTHENTICATE_HEADER, "Basic Realm=\""
                 + value + "\"");
         }
+        
+        // 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 IOException("ResourceConfig source not found:" + configPath);
+        }
+        rc.parse(cfg);
+        setResourceConfig(rc);
 
         // value = getString(props, INIT_PARAM_MISSING_AUTH_MAPPING, null);
         // if (value != null) {
         // initparams.put(INIT_PARAM_MISSING_AUTH_MAPPING, value);
         // }
 
-        try {
-            httpService.registerServlet(context, this, initparams, null);
-
-            // set the contextPath field to signal successfull registration
-            this.contextPath = context;
-
-        } catch (NamespaceException ne) {
-            // context collision
-
-        } catch (ServletException se) {
-            // servlet initialization failure
-
-        }
+          // 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) {

Added: incubator/sling/trunk/jcr/webdav/src/main/resources/webdav-resource-config.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/webdav/src/main/resources/webdav-resource-config.xml?rev=612808&view=auto
==============================================================================
--- incubator/sling/trunk/jcr/webdav/src/main/resources/webdav-resource-config.xml (added)
+++ incubator/sling/trunk/jcr/webdav/src/main/resources/webdav-resource-config.xml Thu Jan
17 05:14:44 2008
@@ -0,0 +1,162 @@
+<?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.ZipHandler" />
+        </iohandler>
+        <iohandler>
+            <class name="org.apache.jackrabbit.server.io.XmlHandler" />
+        </iohandler>
+        <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>
+

Propchange: incubator/sling/trunk/jcr/webdav/src/main/resources/webdav-resource-config.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message