Ferdinand Soethe wrote:





Ross Gardler wrote:


Unfortunately, it won't quite work the way you want because the syntax
for url rewriting and locationmap lookup is different. Therefore to change the behaviour requires a change in the site.xml file.


Since I need this for the lm-docs anyhow, what exactly won't work. The
example I had in mind was very similar to yours except for the second
URL.

<v0.9 label="0.9-dev" href="lm:core.docs.0_90"/>

and in the site-author locationmap you have:

<map pattern="core.docs.*">
   <select>
     <location src="{project:content}/docs_{1}"/>
     <location src="{http://forrest.apache.org/docs_{1}"/>
   </select>
</map>

Why do I need this extra page

You are still mixing th two concepts of a client URL rewrite and an internal location lookup.

An URL in the source document, in this case site.xml, of the form lm:some.location is a rewrite, it results in the URL in the output document being replaced with what is found in the locationmap.

So, if you use the above with a site.xml entry of href="lm:core.docs.0_90" what gets returned to the browser is something like href="src/documentation/content/xdocs/docs_0_90" in the case of the first match (which is wrong) or href="http://forrest.apache.org/docs_0_90"; in the second case (which is right).

On the other hand if we let forrest use the locationmap for a lookup of the source file by having site.xml say href="docs_0_90/index.html", then forrest will look for the source file to generate this page in either "src/documentation/content/xdocs/docs_0_90/index.xml" (which is right) in the first match or "http://forrest.apache.org/docs_0_90/index.xml"; in the second match (which is potentially wrong).

Why is the second wrong?

Well now you ask the question it isn't, strictly speaking, wrong. We could publish the source XML to the web site and this would work just fine. But we don't really want all those users pulling the live docs from our server each time they build theie local docs. It will add unnecessary load to the servers.

So we need a solution that works locally, hence we fall back to a placeholder page that tells the user the docs are available online. As David already pointed out this is very similar to what we did with the 0.7 release, the advantage of using the locationmap is that we can create a system now that will work seamlessly with the subsequent releases. The question is, is it worth the effort now, to save a little time on each release? Your call.

Ross

Ross