Hi,
I don't think that this selector will always work. Maybe for files, but
other sources (such as cocoon://) always return true on Source.exists().
The way I do it (it handles all types of resources, including file://)
is to simply try, and catch the failure:
<map:pipeline type="noncaching" internal-error-handling="true">
<map:match pattern="**">
<map:read src="resources/{0}"/>
</map:match>
<map:handle-errors when="always">
<map:match pattern="**"> <!-- the matcher, to set {0} var -->
<!-- do something else -->
</map:match>
</map:handle-errors>
</map:pipeline>
HTH,
Bart.
> -----Oorspronkelijk bericht-----
> Van: Askild Aaberg Olsen [mailto:[EMAIL PROTECTED]
> Verzonden: donderdag 8 september 2005 11:27
> Aan: [email protected]
> Onderwerp: Re: File checking in the sitemap
>
> Derek Hohls wrote:
>
> >I have a simple(?) use case: I would like to be able to
> >check, in the sitemap, whether or not a file exists (in a
> >directory), and then read that file from disc, or, if it
> >does not exist, carry out another option (prob. call
> >another internal pipeline, which will create a new
> >stream of data).
> >
> >
> Is the ResourceExistsSelector what you are looking for?
>
> http://cocoon.apache.org/2.1/userdocs/selectors/resourceexists-
> selector.html
>
> Askild
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]