I thought it would be a handy feature to be able to ask
a wserver
object which URL's it knows about. In order to do
this, I made
an exported method
published-uris ((wserver wserver) &key (defaulthost
"localhost"))
=> list of net.uri:uri objects
which "Returns a list of all URI's published by this
wserver.
When the host portion of an entity is NIL, uses the
value of
DEFAULTHOST to construct a valid URI."
To make this work, it is necessary for all locator
classes to
define a method locator-paths-hosts. This method is
not
exported, but used to flatten the structure of the
locator-info
slot. The method must match this specification
(defgeneric locator-paths-hosts (locator)
(:documentation "Returns a list of (path host) for
each path and
host that this locator will match."))
Methods for the two built-in locators, as well as a
failsafe
method that just emits a warning, is included in the
patch.
Now that I can get a hold of the URIs a wserver knows
about, a
natural extension would be to be able to get the entity
object
responsible for each such URI. Hence the exported
method
lookup-uri ((wserver wserver) (uri net.uri:uri))
=> entity
which "Returns the entity responsible for handling the
URI, or
NIL." It does this by using the standard-locator
methods on a
constructed request.
The included patch was made against the portableaserve
port of Allegroserve, but the patch should be easy to
backport to the core Aserve, there is nothing
port-specific in it.
Patch implementing published-uris and lookup-uri