You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Ross Gardler <rg...@apache.org> on 2005/06/03 13:10:21 UTC

Re: Problems when accessing directories...

Harald Krottmaier wrote:
> Hi!
> 
> I've noticed a problem when accessing the samples/-resource in a freshly 
> seeded project: index.xml is not automatically appended, so 
> forrest/cocoon (current svn-snapshot forrest_20050530043903.tar.gz) 
> reports a "Resource Not Found" error.
> 
> Putting the redirects (currently the last entries in sitemap.xmap) to an 
> earlier position, solves this problem.

OK I've diagnosed the problem. A request such as 
http://localhost:8888/samples/

will be matched by:

     <map:match type="regexp" pattern="^.+$">
       <map:select type="exists">
         <map:when test="{project:content.xdocs}/{0}">
           <map:mount uri-prefix="" src="raw.xmap" check-reload="yes" />
         </map:when>
       </map:select>
     </map:match>

raw.xmap contains:

     <map:match pattern="**">
       <map:read src="{project:content.xdocs}/{1}"/>
     </map:match>

So Forrest tries to read "{project:content.xdocs}/samples/", this is a 
directory so Resource Not Found

There are a number of ways to fix this, but I'm, not sure which is best:

1) remove the "**" match in raw.xmap

This will result in some raw files not being served, we would have to 
add specific matches for each content type. However, this will make the 
redirect to index.html work for URLs ending with or without a '/'

2) change the match "**" to a regexp that says anything not ending with '/'

This will only prevent raw.xmap from matching URLs ending with a '/', in 
  other words http://lcoalhost:888/samples/ would work but 
http://lcoalhost:888/samples would not work

(how would this regexp look? I'm not good with regular expression, even 
simple ones like this)

3) change the first match (in sitemap.xmap) to only match filenames with 
an extension

This assumes that there will be no raw content without an extension.

4) ???

Which should I implement?

Ross