cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Johnston <>
Subject ResourceExistsSelector and directories
Date Sun, 12 Feb 2006 21:31:36 GMT
I'm trying to detect in my sitemap if a requested URI matches an
existing file on the filesystem, and if so then serve up that file but
if not then I process the request via another method.  I thought that
the ResourceExistsSelector would do the trick:

<map:match pattern="**">
  <map:select type="resource-exists">
    <map:when test="static-files/{1}">
      <map:read src="static-files/{1}">
      <!-- build a backup response -->

This works for the most part.  However the problem arises when the user
requests a URL that matches the name of a directory on the filesystem.
For instance if static-files/mydir/myfile.txt exists on the filesystem,
then when a request comes in for then I get an
/opt/tomcat/webapps/cocoon/static-files/mydir (Is a directory)

It appears that the ResourceExistsSelector is detecting that a directory
matching the requested name exists, so it evaluates the <map:read/>.
This fails because the reader cannot read a directory, only files.

My question is does anyone know if there's a way using the official
Cocoon components (I could write my own but would prefer not to) that I
can detect in the sitemap whether a *file* (not a directory) exists on
the filesystem.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message