cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bart Molenkamp" <b.molenk...@bizzdesign.nl>
Subject RE: File checking in the sitemap
Date Thu, 08 Sep 2005 09:44:07 GMT
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:askild@xangeli.com]
> Verzonden: donderdag 8 september 2005 11:27
> Aan: users@cocoon.apache.org
> 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: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message