You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axkit-dev@xml.apache.org by Michael A Nachbaur <mi...@nachbaur.com> on 2004/02/21 19:24:54 UTC
Patch: AxDirHandler pluggable support
Hi AxKittens!
I've written a patch to AxKit to tidy up AxHandleDirs and makes the
directory handler process pluggable, so different XML grammars can be
used, depending upon an implementor's needs.
This adds a new configuration directive "AxDirHandler <Module>" which is
used to indicate the desired directory handler plugin, but AxHandleDirs
On|Off is still required to toggle if directory listings will be
handled. If AxDirHandler is not specified, the default module
Apache::AxKit::DirHandler::Basic is used (this is essentially a
copy-and-paste job from the current directory handler, so
backwards-compatibility is assured).
Even if you don't use any of the additional directory handler plugins,
this patch is still desirable because it supplies an mtime() for the
directory (which is the greatest mtime value of any file in the
directory). This way we can cache the directory results, and any XSL
transform applied to it.
I've created one directory plugin that I think is pretty sexy:
Apache::AxKit::DirHandler::RDF. This spits out an RDF description of a
directory's contents. By itself this isn't too fancy - very useful, but
not too fancy - but it can take additional configuration directives (in
the form of PerlSetVar AxDirHandler*):
AxDirHandlerRecurse On|Off -- Recurses through subdirectories
AxDirHandlerInspect {Images,MimeType} -- This is similar to
AxAddXSLParams, and allows you to add mime-type information and image
metadata to appropriate files.
Further to this, the A::A::DirHandler::RDF module can be inherited to
add additional file inspection options.
If you want to see a real-live demo of this, go to
http://devbox.nachbaur.com (though I may be styling the output at
sometime in the future since this is, obviously, a development machine).
For more information on how it works, see the POD documentation within
the patch. BTW, I'm thinking it would make sense for
Apache::AxKit::DirHandler::RDF to be a separate CPAN module, so we don't
add YA set of module dependencies (namely File::MimeInfo and
Image::Info) to AxKit.
Re: Patch: AxDirHandler pluggable support
Posted by Michael A Nachbaur <mi...@nachbaur.com>.
Kip Hampton wrote:
> Michael A Nachbaur wrote:
>
>> This adds a new configuration directive "AxDirHandler <Module>" which
>> is used to indicate the desired directory handler plugin, but
>> AxHandleDirs On|Off is still required to toggle if directory listings
>> will be handled. If AxDirHandler is not specified, the default
>> module Apache::AxKit::DirHandler::Basic is used (this is essentially
>> a copy-and-paste job from the current directory handler, so
>> backwards-compatibility is assured).
>
>
> I'm generally +1 on this proposed patch (and thanks for taking this
> up, Mike).
>
> It seems messy to add YA config directive for the special Provider
> case (AxDirHandler is really just a ContentProvider for dir listings)
> when setting the AxHandlerDir to On and applying the correct
> ContentProvider should work, but i guess we bought that when we made
> the AxHandleDir *flag* effect the content that was returned (rather
> than just signaling the intention to handle directory listings).
:-\
Yeah, I know. I don't like the extra directive either, but I can't
really see a way around it. The problem is that there are circumstances
where I want to serve content from two different directories with the
same ContentProvider (A:A:P:File) but with different directory handlers.
In fact, I'm doing just that with Callisto (which was the impetus to get
moving on this patch). I have one directory that uses the Basic plugin
for rendering directory contents, while another generates RDF content
for processing by a Mozilla treeview widget.
I'm certainly up for suggestions on this one however. I don't want to
make an unpleasant situation worse (nor do I want to invalidate your
book Kip ;-) but I don't see an immediately convenient way of working
around this.
Ideas, suggestions, threats and bribes welcome. :-)
Re: Patch: AxDirHandler pluggable support
Posted by Kip Hampton <kh...@totalcinema.com>.
Michael A Nachbaur wrote:
<snip/>
> This adds a new configuration directive "AxDirHandler <Module>" which is
> used to indicate the desired directory handler plugin, but AxHandleDirs
> On|Off is still required to toggle if directory listings will be
> handled. If AxDirHandler is not specified, the default module
> Apache::AxKit::DirHandler::Basic is used (this is essentially a
> copy-and-paste job from the current directory handler, so
> backwards-compatibility is assured).
I'm generally +1 on this proposed patch (and thanks for taking this up,
Mike).
It seems messy to add YA config directive for the special Provider case
(AxDirHandler is really just a ContentProvider for dir listings) when
setting the AxHandlerDir to On and applying the correct ContentProvider
should work, but i guess we bought that when we made the AxHandleDir
*flag* effect the content that was returned (rather than just signaling
the intention to handle directory listings).
-kip