Stefano Mazzocchi wrote:

> 
> So, for example (keeping syntax back compatible)
> 
>  <select type="uri">
>     <when test="store-([0-9]*)\/section-([0-9]*)\/index\.xhtml"
> type="regexp>
>       <generator src="docs/store-{1}/section{2}/index.html" />
>       <transformer/>
>       <serializer/>
>     </when>
>     <when test="store-*/compliance.pdf" type="wildcard">
>       <generator src="docs/compliance-report.xsp">
>         <parameter name="storenbr" value="{1}"/>
>       </generator>
>       <transformer/>
>       <serializer/>
>     </when>
>     <otherwise>
>       <generator src="{1}">  // what does the 'otherwise' part return?
>       <transformer/>
>       <serializer/>
>     </otherwise>
>  </select>
> 
> but the question becomes:
> 
> if we can't implement hash-based jumping based on regexps, the above has
> no effect on performance since you have to perform the regexp matching
> sequentially anyway, and hitting a serializer has the effect of exiting
> the pipeline anyway, even on matchers.
> 
> So, really, what benefits are we getting?



My approach assumes that the regexp is used in the unrolling process.  I.e.
when the sitemap is set up, the sitemap checks for files that match the
patterns in the "src" attributes like this:

docs/
     store-1001/
        section1/index.html
        section2/index.html
     store-2056/
        section1/index.html
        section2/index.html

Such a directory structure will unroll to the following lookup values in
the hashmap:

"store-1001/section-1/index.html"
"store-1001/section-2/index.html"
"store-2056/section-1/index.html"
"store-2056/section-2/index.html"

So that during the runtime of the system, the request is easily matched
with a simple get on a hashmap.

This also provides another layer of validation: No uri is added that
cannot be resolved--offering a quick 404 detection.


-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to