On 6/7/05, Ross Gardler <[EMAIL PROTECTED]> wrote: > Tim Williams wrote: > > On 6/6/05, Ross Gardler <[EMAIL PROTECTED]> wrote: > > > >>Tim Williams wrote: > >> > >>>On 6/6/05, Ross Gardler <[EMAIL PROTECTED]> wrote: > >>> > >>> > >>>>Tim Williams wrote: > >> > >>... > >> > >> > >>><map:select type="exists"> > >>> <map:when test="{project:content.xdocs}tabs.xml"> > >>> <map:generate src="{project:content.xdocs}tabs.xml"/> > >>> </map:when> > >>> <map:when test="{lm:tabs.xml}"> > >>> <map:generate src="{lm:tabs.xml}"/> > >>> </map:when> > >>></map:select> > >> > >>This is interesting. Have you tested what happens when {lm:tabs.xml} > >>does not point to anything useful? That is, does the second <map:when> work? > > > > > > :( Sadly, no. It looks like {lm:tabs.xml} always evaluates to > > existing. Are locationmaps not usable in an exists selector for some > > reason? > > > > My guess is (there's another disclaimer, I haven't tested this yet)... > > Since you are mapping the {lm:tabs.xml} to a http request a document is > always returned. It may be a 404 error, but it is still a document. To > confirm this we would need to look at the generator code and, if > necessary detect error conditions from the various repository types.
The problem or at least a symptom appears to be with the resolver inside the select method of SourceExistsSelector. Here's my rationale: o) LocationMapModule appears to properly be responding with null if a particular hint is not found. o) The empty string comes into SourceExistsSelector and for some weird reason the resolver resolves it to "file:/C:/src/apache-forrest-7-branch/main/webapp/" (for me, but you get the idea). o) Obviously calling src.exists() on the above location returns true causing the map:when to always evaluate to true even when no hint is found in the locationmap. I've got a temporary hack in place by testing for an empty uri parameter immediately before it even gets to the resolver. This gets me the behaviour I would expect in an exists selector test but I'm thinking it'd be best if someone who knows exactly how the resolver/SourceExistsSelector works took a look at it. In the mean time, I could use my little hack to keep moving. Make sense? --tim