Ok, i just had a closer look at the property code - too me it seems as if there's a lot of unnecessary redundance in the code. For example:
A PROPGET for all properties of a resource will result in a call to 'collect-all-properties' that will call 'all-property-designators' which will result (at the end of a long call chain) in a call to 'get-dead-properties'. After that the same 'get-dead-properties' is called for each property again. Now, according to the documentation 'get-dead-properties' is supposed to return _all_ dead properties so it looks as if we do some extra work here ;-)
Cheers, RalfD
On Wed, 23 May 2007 18:35:49 +0200, Ralf Mattes rm@seid-online.de wrote:
A PROPGET for all properties of a resource
I assume you mean PROPFIND.
will result in a call to 'collect-all-properties' that will call 'all-property-designators' which will result (at the end of a long call chain) in a call to 'get-dead-properties'. After that the same 'get-dead-properties' is called for each property again.
No. GET-DEAD-PROPERTIES is called once for each /resource/ (not property) if the "Depth" header is not 0 - see transcript below. This has to be done because each resource can have a different set of dead properties. At least that's how I'm reading the spec.
Now, according to the documentation 'get-dead-properties' is supposed to return _all_ dead properties so it looks as if we do some extra work here ;-)
I don't think so.
Cheers, Edi.
CL-USER 1 > (defmethod print-object ((resource dav:file-resource) stream) ;; for the TRACE output (print-unreadable-object (resource stream :type t) (format stream " ~S" (dav::resource-name resource)))) #<STANDARD-METHOD PRINT-OBJECT NIL (CL-WEBDAV:FILE-RESOURCE T) 200BDDEF>
CL-USER 2 > (merge-pathnames "test/*.*" dav:*file-resource-base-path-namestring*) #P"c:/tmp/test/*.*"
CL-USER 3 > (directory *) (#P"c:/tmp/test/foo" #P"c:/tmp/test/bar")
CL-USER 4 > (push (dav:create-dav-dispatcher 'dav:file-resource) tbnl:*dispatch-table*) (#<Closure ((METHOD CL-WEBDAV:CREATE-DAV-DISPATCHER (SYMBOL)) . 1) 200F6252> HUNCHENTOOT:DEFAULT-DISPATCHER)
CL-USER 5 > (trace dav::get-dead-properties) (CL-WEBDAV:GET-DEAD-PROPERTIES)
CL-USER 6 > (tbnl:start-server :port 4242) #<HUNCHENTOOT::SERVER 20090CFB>
CL-USER 7 > (nth-value 1 (drakma:http-request "http://localhost:4242/test/" :method :propfind :additional-headers '(("Depth" . "1")))) 207
CL-USER 8 > (nth-value 1 (drakma:http-request "http://localhost:4242/test/" :method :propfind :additional-headers '(("Depth" . "0")))) 207
For the first request, the TRACE window looks like this:
0 CL-WEBDAV:GET-DEAD-PROPERTIES > ... >> CL-WEBDAV:RESOURCE : #<CL-WEBDAV:FILE-RESOURCE "test"> 0 CL-WEBDAV:GET-DEAD-PROPERTIES < ... << VALUE-0 : NIL << VALUE-1 : NIL 0 CL-WEBDAV:GET-DEAD-PROPERTIES > ... >> CL-WEBDAV:RESOURCE : #<CL-WEBDAV:FILE-RESOURCE "foo"> 0 CL-WEBDAV:GET-DEAD-PROPERTIES < ... << VALUE-0 : NIL << VALUE-1 : NIL 0 CL-WEBDAV:GET-DEAD-PROPERTIES > ... >> CL-WEBDAV:RESOURCE : #<CL-WEBDAV:FILE-RESOURCE "bar"> 0 CL-WEBDAV:GET-DEAD-PROPERTIES < ... << VALUE-0 : NIL << VALUE-1 : NIL
For the second request, the TRACE window looks like this:
0 CL-WEBDAV:GET-DEAD-PROPERTIES > ... >> CL-WEBDAV:RESOURCE : #<CL-WEBDAV:FILE-RESOURCE "test"> 0 CL-WEBDAV:GET-DEAD-PROPERTIES < ... << VALUE-0 : NIL << VALUE-1 : NIL
On Thu, 2007-05-24 at 09:23 +0200, Edi Weitz wrote:
On Wed, 23 May 2007 18:35:49 +0200, Ralf Mattes rm@seid-online.de wrote:
A PROPGET for all properties of a resource
I assume you mean PROPFIND.
Sorry, yes - I'm testing with cadaver whose PROPFIND command is called 'propget'.
will result in a call to 'collect-all-properties' that will call 'all-property-designators' which will result (at the end of a long call chain) in a call to 'get-dead-properties'. After that the same 'get-dead-properties' is called for each property again.
No. GET-DEAD-PROPERTIES is called once for each /resource/ (not property) if the "Depth" header is not 0 - see transcript below. This has to be done because each resource can have a different set of dead properties. At least that's how I'm reading the spec.
There's nothing wrong with your transcript but it doesn't seem to contradict what I reported. What I observe is that 'get-dead-properties' gets called once for the resource and once for each property. Now, unless you magically did add some properties to 'foo' and 'bar' you can't observe this ... ;-)
Cheers, RalfD
Now, according to the documentation 'get-dead-properties' is supposed to return _all_ dead properties so it looks as if we do some extra work here ;-)
I don't think so.
Cheers, Edi.
CL-USER 1 > (defmethod print-object ((resource dav:file-resource) stream) ;; for the TRACE output (print-unreadable-object (resource stream :type t) (format stream " ~S" (dav::resource-name resource)))) #<STANDARD-METHOD PRINT-OBJECT NIL (CL-WEBDAV:FILE-RESOURCE T) 200BDDEF>
CL-USER 2 > (merge-pathnames "test/*.*" dav:*file-resource-base-path-namestring*) #P"c:/tmp/test/*.*"
CL-USER 3 > (directory *) (#P"c:/tmp/test/foo" #P"c:/tmp/test/bar")
CL-USER 4 > (push (dav:create-dav-dispatcher 'dav:file-resource) tbnl:*dispatch-table*) (#<Closure ((METHOD CL-WEBDAV:CREATE-DAV-DISPATCHER (SYMBOL)) . 1) 200F6252> HUNCHENTOOT:DEFAULT-DISPATCHER)
CL-USER 5 > (trace dav::get-dead-properties) (CL-WEBDAV:GET-DEAD-PROPERTIES)
CL-USER 6 > (tbnl:start-server :port 4242) #<HUNCHENTOOT::SERVER 20090CFB>
CL-USER 7 > (nth-value 1 (drakma:http-request "http://localhost:4242/test/" :method :propfind :additional-headers '(("Depth" . "1")))) 207
CL-USER 8 > (nth-value 1 (drakma:http-request "http://localhost:4242/test/" :method :propfind :additional-headers '(("Depth" . "0")))) 207
For the first request, the TRACE window looks like this:
0 CL-WEBDAV:GET-DEAD-PROPERTIES > ... >> CL-WEBDAV:RESOURCE : #<CL-WEBDAV:FILE-RESOURCE "test"> 0 CL-WEBDAV:GET-DEAD-PROPERTIES < ... << VALUE-0 : NIL << VALUE-1 : NIL 0 CL-WEBDAV:GET-DEAD-PROPERTIES > ... >> CL-WEBDAV:RESOURCE : #<CL-WEBDAV:FILE-RESOURCE "foo"> 0 CL-WEBDAV:GET-DEAD-PROPERTIES < ... << VALUE-0 : NIL << VALUE-1 : NIL 0 CL-WEBDAV:GET-DEAD-PROPERTIES > ... >> CL-WEBDAV:RESOURCE : #<CL-WEBDAV:FILE-RESOURCE "bar"> 0 CL-WEBDAV:GET-DEAD-PROPERTIES < ... << VALUE-0 : NIL << VALUE-1 : NIL
For the second request, the TRACE window looks like this:
0 CL-WEBDAV:GET-DEAD-PROPERTIES > ... >> CL-WEBDAV:RESOURCE : #<CL-WEBDAV:FILE-RESOURCE "test"> 0 CL-WEBDAV:GET-DEAD-PROPERTIES < ... << VALUE-0 : NIL << VALUE-1 : NIL
Just as a follow-up:
I'm mainly concerned with PROPFIND on plain resources for now. I think the following code in 'properties.lisp' does extra work:
(dolist (property-designator (cond ((eql property-designators t) (all-property-designators resource)) <---[1] (t property-designators)))
(multiple-value-bind (status property) (propstat resource property-designator show-content) <--- [2]
For a PROPFIND on ALL properties [1] will call 'get-dead-properties'. Then, for each property (in the dolist body) [2] will call 'get-dead-properties' again (propstat->get-property->get-dead-property->get-dead-properties).
I hope I've made myself a bit clearer now.
Cheers, RalfD
On Thu, 24 May 2007 10:23:20 +0200, Ralf Mattes rm@seid-online.de wrote:
What I observe is that 'get-dead-properties' gets called once for the resource and once for each property.
Ah, now I see. You mean the call to GET-DEAD-PROPERTIES in GET-DEAD-PROPERTY, right?
Yes, in my original code GET-DEAD-PROPERTY was one of the generic functions you could specialize. When I cleaned up the code for release, I removed it because I deemed it kind of redundant and I generally favor convenience over speed optimizations. Of course, if you think this will be a huge performance hog for you, we can re-introduce this generic function and make the current implementation the default. That's a very simple change.