Commons VFS
  1. Commons VFS
  2. VFS-263

WebdavFileObject does not implement doSetAttribute()

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Labels:
      None
    • Environment:

      all

      Description

      Usually, WebDAV servers allow to read from and write to properties (attributes in VFS speech) of a WebDAV resource.

      Though WebdavFileObject in current TRUNK allows to read those properties, it doesn't allow to write them. WebdavFileObject should implement doSetAttribute() to fully support WebDAV properties.

        Activity

        Ingo Maas created issue -
        Hide
        Ingo Maas added a comment -

        The way I've solved it for me:
        ////
        protected void doSetAttribute(String attrName, Object value) throws Exception {
        try
        {
        URLFileName fileName = (URLFileName) getName();
        String urlStr = urlString( fileName);
        DavPropertySet properties = new DavPropertySet();
        DavPropertyNameSet propertyNameSet = new DavPropertyNameSet();
        DavProperty property = new DefaultDavProperty( attrName, value, Namespace.EMPTY_NAMESPACE);

        if (value != null)

        { properties.add( property); }

        else

        { propertyNameSet.add( property.getName() ); // remove porperty }

        PropPatchMethod method = new PropPatchMethod( urlStr, properties, propertyNameSet);
        setupMethod( method);
        execute( method);
        if (!method.succeeded() )

        { throw new FileSystemException("Property '" + attrName + "' could not be set."); }

        }
        catch (FileSystemException fse)

        { throw fse; }

        catch (Exception e)

        { throw new FileSystemException("vfs.provider.webdav/propfind.error", getName(), e); }

        }

        Show
        Ingo Maas added a comment - The way I've solved it for me: //// protected void doSetAttribute(String attrName, Object value) throws Exception { try { URLFileName fileName = (URLFileName) getName(); String urlStr = urlString( fileName); DavPropertySet properties = new DavPropertySet(); DavPropertyNameSet propertyNameSet = new DavPropertyNameSet(); DavProperty property = new DefaultDavProperty( attrName, value, Namespace.EMPTY_NAMESPACE); if (value != null) { properties.add( property); } else { propertyNameSet.add( property.getName() ); // remove porperty } PropPatchMethod method = new PropPatchMethod( urlStr, properties, propertyNameSet); setupMethod( method); execute( method); if (!method.succeeded() ) { throw new FileSystemException("Property '" + attrName + "' could not be set."); } } catch (FileSystemException fse) { throw fse; } catch (Exception e) { throw new FileSystemException("vfs.provider.webdav/propfind.error", getName(), e); } }
        Hide
        Ralph Goers added a comment -

        Patch applied. Please verify and close.

        Show
        Ralph Goers added a comment - Patch applied. Please verify and close.
        Ralph Goers made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.0 [ 12313174 ]
        Resolution Fixed [ 1 ]
        Hide
        Ingo Maas added a comment -

        Closed.

        Show
        Ingo Maas added a comment - Closed.
        Ingo Maas made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        155d 19h 39m 1 Ralph Goers 12/Nov/09 03:57
        Resolved Resolved Closed Closed
        319d 10h 12m 1 Ingo Maas 27/Sep/10 15:09

          People

          • Assignee:
            Unassigned
            Reporter:
            Ingo Maas
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 5m
              5m
              Remaining:
              Remaining Estimate - 5m
              5m
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development