On Dec 10, 2007, at 3:40 AM, Thorsten Scherler wrote:

I ended up with:

<!-- This will match all extension less requests -->
     <map:match type="regexp" pattern="^[^.]+$">
       <!-- This will match all requests having "/" on the end -->
       <map:match type="regexp" pattern="^(.*)/$">
         <map:match pattern="*/">
           <map:redirect-to uri="../{1}.html" />

This is a browser redirect, so user will ultimately see .../foo.html URL in the browser. In this case, why would you start with a URL without extension? I does not make any sense. Just use URL with extension from the beginning.


         </map:match>
         <map:match pattern="**/*/">
           <map:redirect-to uri="../{2}.html" />
         </map:match>
       </map:match>
       <map:match pattern="**/*">
         <map:redirect-to uri="{2}.html" />
       </map:match>
       <map:match pattern="*">
         <map:redirect-to uri="{1}.html" />
       </map:match>
     </map:match>

Regardless of comment above, what you got here is too verbose, you can DRY it down using smarter match pattern. For example:

  <map:match pattern="^(?:[^.\/]*\/)*([^.\/]+)\/$">
    <map:redirect-to uri="../{1}.html"/>
  </map:match>
  <map:match pattern="^(?:[^.\/]*\/)*([^.\/]+)$">
    <map:redirect-to uri="{1}.html"/>
  </map:match>


One side effect is that the app is now way slower if you use
"extensionless requests". In our application we need the extensions to
trigger the correct pipelines, which I consider the normal usage of
cocoon. By redirecting the request one is causing more processing on the
app which explains the higher response time.

You probably mean "more round trips". I don't see any extra processing on the app.

Vadim


That makes me wonder whether extension less requests makes sense at all
in a multi-output-format environment.

WDYT?

salu2
--
Thorsten Scherler thorsten.at.apache.org Open Source Java consulting, training and solutions

Reply via email to