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}">
</map:when>
<map:otherwise>
<!-- build a backup response -->
</map:otherwise>
</map:select>
</map:match>
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 http://mydomain.com/mydir then I get an
error:
java.io.FileNotFoundException:
/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.
Thanks
--Jason
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]