jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r355130 - in /incubator/jackrabbit/trunk/contrib/jcr-server: server/src/java/org/apache/jackrabbit/webdav/jcr/ server/src/java/org/apache/jackrabbit/webdav/simple/ webapp/src/webapp/WEB-INF/ webdav/src/java/org/apache/jackrabbit/webdav/
Date Thu, 08 Dec 2005 15:45:17 GMT
Author: angela
Date: Thu Dec  8 07:44:57 2005
New Revision: 355130

URL: http://svn.apache.org/viewcvs?rev=355130&view=rev
Log:
1) JCR-185 - filter jcr properties in jcr-server
2) move helper-methods from ResourceFactoryImpl to DavMethod
3) do no rely on HttpServletRequest.getContentLength() for reading the request body (rev.
354815)
4) no hardcoded check for root-path in ResourceConfig (rev. 354818)	 
5) mark private methods in DavResourceImpl 'private' (rev. 354820)

Added:
    incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DefaultItemFilter.java
  (with props)
    incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ItemFilter.java
  (with props)
Removed:
    incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DefaultResourceFilter.java
    incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ResourceFilter.java
Modified:
    incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/DavResourceFactoryImpl.java
    incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
    incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ResourceConfig.java
    incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ResourceFactoryImpl.java
    incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF/config.xml
    incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavMethods.java
    incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/DavResourceFactoryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/DavResourceFactoryImpl.java?rev=355130&r1=355129&r2=355130&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/DavResourceFactoryImpl.java
(original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/jcr/DavResourceFactoryImpl.java
Thu Dec  8 07:44:57 2005
@@ -85,7 +85,7 @@
                 instead.*/
                 if (request instanceof DeltaVServletRequest && isVersionControlled(resource))
{
                     String labelHeader = ((DeltaVServletRequest)request).getLabel();
-                    if (labelHeader != null && DavMethods.isMethodAffectedByLabel(request.getMethod()))
{
+                    if (labelHeader != null && DavMethods.isMethodAffectedByLabel(request))
{
                         Item item = getItem(session, locator);
                         Version v = ((Node)item).getVersionHistory().getVersionByLabel(labelHeader);
                         DavResourceLocator vloc = locator.getFactory().createResourceLocator(locator.getPrefix(),
locator.getWorkspacePath(), v.getPath(), false);

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java?rev=355130&r1=355129&r2=355130&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
(original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
Thu Dec  8 07:44:57 2005
@@ -71,7 +71,7 @@
     private boolean inited = false;
     private boolean isCollection = true;
 
-    private ResourceFilter filter;
+    private ItemFilter filter;
     private IOManager ioManager;
 
     private long modificationTime = IOUtil.UNDEFINED_TIME;
@@ -88,7 +88,7 @@
         this.session = session;
         this.factory = factory;
         this.locator = locator;
-        this.filter = config.getResourceFilter();
+        this.filter = config.getItemFilter();
         this.ioManager = config.getIOManager();
 
         if (locator != null && locator.getResourcePath() != null) {
@@ -274,14 +274,13 @@
 
         // non-protected JCR properties defined on the underlying jcr node
         try {
-            // todo: should filter be respected for properties as well?
             PropertyIterator it = node.getProperties();
             while (it.hasNext()) {
                 Property p = it.nextProperty();
                 String pName = p.getName();
                 PropertyDefinition def = p.getDefinition();
-                if (def.isMultiple()) {
-                    log.debug("Multivalue property '" + pName + "' not added to webdav property
set.");
+                if (def.isMultiple() || isFilteredItem(p)) {
+                    log.debug("Property '" + pName + "' not added to webdav property set
(either multivalue or filtered).");
                     continue;
                 }
                 DavPropertyName name = getDavName(pName, node.getSession());
@@ -291,7 +290,6 @@
         } catch (RepositoryException e) {
             log.error("Unexpected error while retrieving properties: " + e.getMessage());
         }
-
         inited = true;
     }
 
@@ -456,7 +454,7 @@
                 NodeIterator it = node.getNodes();
                 while (it.hasNext()) {
                     Node n = it.nextNode();
-                    if (!isFilteredNode(n)) {
+                    if (!isFilteredItem(n)) {
                         DavResourceLocator resourceLocator = locator.getFactory().createResourceLocator(locator.getPrefix(),
locator.getWorkspacePath(), n.getPath(), false);
                         DavResource childRes = factory.createResource(resourceLocator, session);
                         list.add(childRes);
@@ -776,7 +774,7 @@
      *
      * @return true if this resource is lockable.
      */
-    protected boolean isJsrLockable() {
+    private boolean isJsrLockable() {
         boolean lockable = false;
         if (exists()) {
             try {
@@ -800,7 +798,7 @@
      *
      * @return true if this resource cannot be modified due to a write lock
      */
-    protected boolean isLocked(DavResource res) {
+    private boolean isLocked(DavResource res) {
         ActiveLock lock = res.getLock(Type.WRITE, Scope.EXCLUSIVE);
         if (lock == null) {
             return false;
@@ -826,7 +824,7 @@
      * @param session
      * @return a <code>DavPropertyName</code> for the given jcr name.
      */
-    protected DavPropertyName getDavName(String jcrName, Session session) throws RepositoryException
{
+    private DavPropertyName getDavName(String jcrName, Session session) throws RepositoryException
{
         // make sure the local name is xml compliant
         String localName = ISO9075.encode(Text.getLocalName(jcrName));
         String prefix = Text.getNamespacePrefix(jcrName);
@@ -850,7 +848,7 @@
      * @return jcr name
      * @throws RepositoryException
      */
-    protected String getJcrName(DavPropertyName propName) throws RepositoryException {
+    private String getJcrName(DavPropertyName propName) throws RepositoryException {
         // remove any encoding necessary for xml compliance
         String pName = ISO9075.decode(propName.getName());
         String uri = propName.getNamespace().getURI();
@@ -882,7 +880,7 @@
      * @param property
      * @throws RepositoryException
      */
-    protected void setJcrProperty(DavProperty property) throws RepositoryException {
+    private void setJcrProperty(DavProperty property) throws RepositoryException {
         // retrieve value
         String value = property.getValue().toString();
         // set value; since multivalued-properties are not listed in the set
@@ -894,7 +892,7 @@
      * @param propertyName
      * @throws RepositoryException
      */
-    protected void removeJcrProperty(DavPropertyName propertyName) throws RepositoryException
{
+    private void removeJcrProperty(DavPropertyName propertyName) throws RepositoryException
{
         String jcrName = getJcrName(propertyName);
         if (node.hasProperty(jcrName)) {
             node.getProperty(jcrName).remove();
@@ -902,13 +900,13 @@
         // removal of non existing property succeeds
     }
 
-    protected boolean isFilteredResource(DavResource resource) {
+    private boolean isFilteredResource(DavResource resource) {
         // TODO: filtered nodetypes should be checked as well in order to prevent problems.
-        return filter != null && filter.isFilteredResource(resource.getDisplayName(),
session.getRepositorySession());
+        return filter != null && filter.isFilteredItem(resource.getDisplayName(),
session.getRepositorySession());
     }
 
-    protected boolean isFilteredNode(Node n) {
-        return filter != null && filter.isFilteredItem(n);
+    private boolean isFilteredItem(Item item) {
+        return filter != null && filter.isFilteredItem(item);
     }
 
     //--------------------------------------------------------< inner class >---

Added: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DefaultItemFilter.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DefaultItemFilter.java?rev=355130&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DefaultItemFilter.java
(added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DefaultItemFilter.java
Thu Dec  8 07:44:57 2005
@@ -0,0 +1,156 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed 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.jackrabbit.webdav.simple;
+
+import org.apache.log4j.Logger;
+
+import javax.jcr.Item;
+import javax.jcr.RepositoryException;
+import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.Session;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <code>DefaultItemFilter</code>...
+ */
+public class DefaultItemFilter implements ItemFilter {
+
+    private static Logger log = Logger.getLogger(DefaultItemFilter.class);
+
+    private List prefixFilter = new ArrayList();
+    private List uriFilter = new ArrayList();
+    private List nodetypeFilter = new ArrayList();
+
+    public DefaultItemFilter() {
+    }
+
+    /**
+     * @see ItemFilter#setFilteredURIs(String[])
+     */
+    public void setFilteredURIs(String[] uris) {
+        if (uris != null) {
+            for (int i = 0; i < uris.length; i++) {
+                uriFilter.add(uris[i]);
+            }
+        }
+    }
+
+    /**
+     * @see ItemFilter#setFilteredPrefixes(String[])
+     */
+    public void setFilteredPrefixes(String[] prefixes) {
+        if (prefixes != null) {
+            for (int i = 0; i < prefixes.length; i++) {
+                prefixFilter.add(prefixes[i]);
+            }
+        }
+    }
+
+    /**
+     * @see ItemFilter#setFilteredNodetypes(String[])
+     */
+    public void setFilteredNodetypes(String[] nodetypeNames) {
+        if (nodetypeNames != null) {
+            for (int i = 0; i < nodetypeNames.length; i++) {
+                nodetypeFilter.add(nodetypeNames[i]);
+            }
+        }
+    }
+
+    /**
+     * Returns true if the given item matches either one of the namespace or
+     * of the the nodetype filters specified.
+     *
+     * @see ItemFilter#isFilteredItem(Item)
+     */
+    public boolean isFilteredItem(Item item) {
+        return isFilteredNamespace(item) || isFilteredNodeType(item);
+    }
+
+    /**
+     * @see ItemFilter#isFilteredItem(String, Session)
+     */
+    public boolean isFilteredItem(String displayName, Session session) {
+        return isFilteredNamespace(displayName, session);
+    }
+
+    /**
+     *
+     * @param name
+     * @param session
+     * @return
+     */
+    private boolean isFilteredNamespace(String name, Session session) {
+        // shortcut
+        if (prefixFilter.isEmpty() && uriFilter.isEmpty()) {
+            return false;
+        }
+        int pos = name.indexOf(":");
+        if (pos < 0) {
+            // no namespace info present
+            return false;
+        }
+        try {
+            String prefix = name.substring(0, pos);
+            String uri = session.getNamespaceURI(prefix);
+            return prefixFilter.contains(prefix) || uriFilter.contains(uri);
+        } catch (RepositoryException e) {
+            log.warn(e.getMessage());
+        }
+        return false;
+    }
+
+    /**
+     *
+     * @param item
+     * @return
+     */
+    private boolean isFilteredNamespace(Item item) {
+        try {
+            return isFilteredNamespace(item.getName(), item.getSession());
+        } catch (RepositoryException e) {
+            log.warn(e.getMessage());
+        }
+        return false;
+    }
+
+    /**
+     *
+     * @param item
+     * @return
+     */
+    private boolean isFilteredNodeType(Item item) {
+        // shortcut
+        if (nodetypeFilter.isEmpty()) {
+            return false;
+        }
+        try {
+            String ntName;
+            if (item.isNode()) {
+                ntName = ((Node) item).getDefinition().getDeclaringNodeType().getName();
+            } else {
+                ntName = ((Property) item).getDefinition().getDeclaringNodeType().getName();
+            }
+            return nodetypeFilter.contains(ntName);
+        } catch (RepositoryException e) {
+            log.warn(e.getMessage());
+        }
+        // nodetype info could not be retrieved
+        return false;
+    }
+}
\ No newline at end of file

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DefaultItemFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/DefaultItemFilter.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Added: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ItemFilter.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ItemFilter.java?rev=355130&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ItemFilter.java
(added)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ItemFilter.java
Thu Dec  8 07:44:57 2005
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed 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.jackrabbit.webdav.simple;
+
+import javax.jcr.Item;
+import javax.jcr.Session;
+
+/**
+ * <code>ItemFilter</code>
+ */
+public interface ItemFilter {
+
+    /**
+     * Define the URIs that should be filtered out if present in the prefix
+     * of an items name.
+     *
+     * @param uris
+     */
+    public void setFilteredURIs(String[] uris);
+
+    /**
+     * Define the namespace prefixes that should be filtered if present in
+     * the prefix of an items name.
+     *
+     * @param prefixes
+     */
+    public void setFilteredPrefixes(String[] prefixes);
+
+    /**
+     * Set the nodetype names that should be used if a given item should be
+     * filtered. Note that not the nodetype(s) defined for a given item
+     * is relevant but rather the nodetype that defined the definition of the item.
+     *
+     * @param nodetypeNames
+     */
+    public void setFilteredNodetypes(String[] nodetypeNames);
+
+    /**
+     * Returns true if the given item should be filtered.
+     *
+     * @param item to be tested
+     * @return true if the given item should be filtered.
+     */
+    public boolean isFilteredItem(Item item);
+
+    /**
+     * Returns true if the resouce with the given name should be filtered.
+     *
+     * @param name to be tested for a filtered namespace prefix
+     * @param session used for looking up namespace mappings
+     * @return true if the given resource should be filtered.
+     */
+    public boolean isFilteredItem(String name, Session session);
+}
\ No newline at end of file

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ItemFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ItemFilter.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ResourceConfig.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ResourceConfig.java?rev=355130&r1=355129&r2=355130&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ResourceConfig.java
(original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ResourceConfig.java
Thu Dec  8 07:44:57 2005
@@ -38,7 +38,7 @@
 
     private static Logger log = Logger.getLogger(ResourceConfig.class);
 
-    private ResourceFilter resourceFilter;
+    private ItemFilter itemFilter;
     private IOManager ioManager;
     private String[] nodetypeNames = new String[0];
     private boolean collectionNames = false;
@@ -99,13 +99,13 @@
             Element filter = root.getChild("filter");
             if (filter != null) {
                 Object inst = buildClassFromConfig(filter.getChild("class"));
-                if (inst != null && inst instanceof ResourceFilter) {
-                    resourceFilter = (ResourceFilter)inst;
+                if (inst != null && inst instanceof ItemFilter) {
+                    itemFilter = (ItemFilter)inst;
                 }
-                if (resourceFilter != null) {
+                if (itemFilter != null) {
                     Element nts = filter.getChild("nodetypes");
-                    resourceFilter.setFilteredNodetypes(parseNodeTypesEntry(nts));
-                    parseNamespacesEntry(filter.getChild("namespaces"), resourceFilter);
+                    itemFilter.setFilteredNodetypes(parseNodeTypesEntry(nts));
+                    parseNamespacesEntry(filter.getChild("namespaces"), itemFilter);
                 }
             } else {
                 log.debug("Resource configuration: no 'filter' element specified.");
@@ -136,7 +136,7 @@
         return instance;
     }
 
-    private void parseNamespacesEntry(Element child, ResourceFilter filter) {
+    private void parseNamespacesEntry(Element child, ItemFilter filter) {
         if (child == null) {
             return;
         }
@@ -200,10 +200,6 @@
             boolean isCollection = true;
             Node n = (Node)item;
             try {
-                if (n.getPath().equals("/")) {
-                    // the root node always represents a collection
-                    return true;
-                }
                 for (int i = 0; i < nodetypeNames.length && isCollection; i++)
{
                     isCollection = collectionNames ? n.isNodeType(nodetypeNames[i]) : !n.isNodeType(nodetypeNames[i]);
                 }
@@ -217,17 +213,17 @@
     }
 
     /**
-     * Returns the resource filter specified with the configuration or {@link DefaultResourceFilter}
+     * Returns the item filter specified with the configuration or {@link DefaultItemFilter}
      * if the configuration was missing the corresponding entry or the parser failed
-     * to build a <code>ResourceFilter</code> instance from the configuration.
+     * to build a <code>ItemFilter</code> instance from the configuration.
      *
-     * @return resource filter as defined by the config or {@link DefaultResourceFilter}
+     * @return item filter as defined by the config or {@link DefaultItemFilter}
      */
-    public ResourceFilter getResourceFilter() {
-        if (resourceFilter == null) {
-            log.debug("ResourceConfig: missing resource filter > building DefaultResourceFilter
");
-            resourceFilter = new DefaultResourceFilter();
+    public ItemFilter getItemFilter() {
+        if (itemFilter == null) {
+            log.debug("ResourceConfig: missing resource filter > building DefaultItemFilter
");
+            itemFilter = new DefaultItemFilter();
         }
-        return resourceFilter;
+        return itemFilter;
     }
 }

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ResourceFactoryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ResourceFactoryImpl.java?rev=355130&r1=355129&r2=355130&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ResourceFactoryImpl.java
(original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/webdav/simple/ResourceFactoryImpl.java
Thu Dec  8 07:44:57 2005
@@ -34,8 +34,8 @@
  */
 public class ResourceFactoryImpl implements DavResourceFactory {
 
-    private LockManager lockMgr;
-    private ResourceConfig resourceConfig;
+    private final LockManager lockMgr;
+    private final ResourceConfig resourceConfig;
 
     /**
      * Create a new <code>ResourceFactory</code> that uses the given lock
@@ -75,8 +75,8 @@
     public DavResource createResource(DavResourceLocator locator, DavServletRequest request,
                                       DavServletResponse response) throws DavException {
         DavResourceImpl resource = (DavResourceImpl)createResource(locator, request.getDavSession());
-        if (isCreateRequest(request) && ! resource.exists()) {
-            resource.setIsCollection(isCreateCollectionRequest(request));
+        if (DavMethods.isCreateRequest(request) && ! resource.exists()) {
+            resource.setIsCollection(DavMethods.isCreateCollectionRequest(request));
         }
         return resource;
     }
@@ -99,50 +99,5 @@
         } catch (RepositoryException e) {
             throw new JcrDavException(e);
         }
-    }
- 
-    /**
-     * Returns <code>true</code> if the request is to create a
-     * resource. True for <code>MKCOL</code>, <code>PUT</code> and
-     * <code>POST</code> requests.
-     */
-    protected boolean isCreateRequest(DavServletRequest request) {
-        int methodCode = DavMethods.getMethodCode(request.getMethod());
-        return (methodCode == DavMethods.DAV_MKCOL ||
-                methodCode == DavMethods.DAV_PUT ||
-                methodCode == DavMethods.DAV_POST);
-    }
- 
-    /**
-     * Returns <code>true</code> if the request is to create a
-     * collection resource. True for <code>MKCOL</code> requests.
-     */
-    protected boolean isCreateCollectionRequest(DavServletRequest request) {
-        return (DavMethods.getMethodCode(request.getMethod()) ==
-                DavMethods.DAV_MKCOL);
-    }
- 
-    /**
-     */
-    public LockManager getLockManager() {
-        return lockMgr;
-    }
- 
-    /**
-     */
-    public void setLockManager(LockManager lockMgr) {
-        this.lockMgr = lockMgr;
-    }
- 
-    /**
-     */
-    public ResourceConfig getResourceConfig() {
-        return resourceConfig;
-    }
- 
-    /**
-     */
-    public void setResourceConfig(ResourceConfig resourceConfig) {
-        this.resourceConfig = resourceConfig;
     }
 }

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF/config.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF/config.xml?rev=355130&r1=355129&r2=355130&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF/config.xml (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webapp/src/webapp/WEB-INF/config.xml Thu
Dec  8 07:44:57 2005
@@ -63,8 +63,8 @@
      -->
     <filter>
         <!-- class element defines the resource filter to be used. The specified class
-             must implement the ResourceFilter interface -->
-        <class name="org.apache.jackrabbit.webdav.simple.DefaultResourceFilter" />
+             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.

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavMethods.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavMethods.java?rev=355130&r1=355129&r2=355130&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavMethods.java
(original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/DavMethods.java
Thu Dec  8 07:44:57 2005
@@ -288,8 +288,34 @@
                                    DAV_LABEL, DAV_COPY };
     }
 
-    public static boolean isMethodAffectedByLabel(String method) {
-        int code = getMethodCode(method);
+   /**
+     * Returns <code>true</code> if the request is to create a
+     * resource. True for <code>MKCOL</code>, <code>PUT</code> and
+     * <code>POST</code> requests.
+     */
+    public static boolean isCreateRequest(DavServletRequest request) {
+        int methodCode = getMethodCode(request.getMethod());
+        return (methodCode == DAV_MKCOL ||
+                methodCode == DAV_PUT ||
+                methodCode == DAV_POST);
+    }
+
+    /**
+     * Returns <code>true</code> if the request is to create a
+     * collection resource. True for <code>MKCOL</code> requests.
+     */
+    public static boolean isCreateCollectionRequest(DavServletRequest request) {
+        return (getMethodCode(request.getMethod()) == DAV_MKCOL);
+    }
+
+    /**
+     * Returns true, if the specified method is affected by a Label header
+     *
+     * @param request
+     * @return
+     */
+    public static boolean isMethodAffectedByLabel(DavServletRequest request) {
+        int code = getMethodCode(request.getMethod());
         for (int i = 0; i < labelMethods.length; i++) {
             if (code == labelMethods[i]) {
                 return true;

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java?rev=355130&r1=355129&r2=355130&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java
(original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/webdav/src/java/org/apache/jackrabbit/webdav/WebdavRequestImpl.java
Thu Dec  8 07:44:57 2005
@@ -260,7 +260,6 @@
      */
     public Document getRequestDocument() {
         Document requestDocument = null;
-        if (httpRequest.getContentLength() > 0) {
             // try to parse the request body
             try {
                 InputStream in = httpRequest.getInputStream();
@@ -275,7 +274,6 @@
             } catch (JDOMException e) {
                 if (log.isDebugEnabled()) {
                     log.debug("Unable to build an XML Document from the request body: " +
e.getMessage());
-                }
             }
         }
         return requestDocument;



Mime
View raw message