[prev in list] [next in list] [prev in thread] [next in thread] 

List:       slide-dev
Subject:    Properties of non-existent resources should be explicitly defined
From:       Steve Vaughan <snmvaughan92 () yahoo ! com>
Date:       2003-09-24 20:41:55
[Download RAW message or body]

When an instance of WebdavResource does not exist (the "exists" field is 
false), all of the other properties of the resource are undefined.  Within 
the Javadoc comment for the WebdavResource class a direct correlation is made 
between java.io.File.isDirectory() and 
org.apache.webdav.lib.WebdavResource.isCollection().  The File isDirectory() 
method, however, returns true only if the file exists and is a directory.  
WebdavResource simply returns a value based upon the last known setting for 
the resourceType field, meaning that if "exists" is false that this value is 
undefined.

I propose that the live properties take the value of the "exists" field into 
account, and return a known value when the resource does not exist.  Looking 
to java.io.FIle as an example, this would mean:

1) isResourceType() would return null for non-existent resources.   This would 
also fix isCollection(), making it match with the File isDirectory() 
definition.
2) getGetContentLength() would return 0L for non-existent resources.
3) getDisplayName() would return the unencoded name take from the httpURL 
field.

-Steve

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic