cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vadim Gritsenko" <>
Subject RE: [C2] Question About WildcardURIMatcher
Date Sat, 26 Aug 2000 00:58:37 GMT
> From: []On Behalf Of Giacomo Pati
> > Vadim Gritsenko wrote:
> >
> > Hi,
> >
> > Is it OK that '<map:match pattern="welcome">' (from sitemap.xmap)
> > matches http://host/cocoon/welcome as well as
> > http://host/cocoon/zzzzzzwelcomezzzzzzzzz?
> > I mean, it should work this way or this is an error?
> Unfotunately it's the way it workes. That's why I have used the
> RegexpURIMatcher to have a way to determine start and end on a pattern
> (see my mail yesterday about this topic).
> Maybe you have a way or proposal how to fix it?

I have got some solution - it is implemented in attached files. Here is the
main changes:

1. I have added two more constants to matcher: MATCH_BEGIN and MATCH_THEEND.
If you will put MATCH_BEGIN in the very beginning of expression array, it
will work like
'^' in regular expresions, and if you put MATCH_THEEND instead of MATCH_END
- you will get behavior of '$'.
2. I changed behavior of '**'. Now it tries to match as more as possible
(instead of
"indexOf", I used "lastIndexOf").
3. now always uses MATCH_BEGIN and

If you will not use MATCH_BEGIN and MATCH_THEEND - behavior will be the same
as before,
except '**': now it is possible to write matchers like <map:match

Because of new behavior, I found error in jakarta_apache_org-html.xsl:
instead of
<link rel="stylesheet" href="styles/jakarta_apache_org.css"><!-- no not
remove this comment --></link>
should be
<link rel="stylesheet" href="../styles/jakarta_apache_org.css"><!-- no not
remove this comment --></link>
(directory "sites" in which xml resides was ignored by previous version of

Also, as an experiment, I replaced several image matchers (gif, jpeg, png)
with one:
   <map:match pattern="images/**.*">
    <map:read src="resources/images/{1}.{2}" mime-type="image/{2}"/>

And for files/directories:
   <map:match pattern="**/">
    <map:generate type="directory" src="{1}"/>
    <map:transform src="stylesheets/system/directory2html.xsl"/>

   <map:match pattern="**">
    <map:read src="{1}" mime-type="text/plain"/>
So it can work like "text/plain" web server :)

Also, added patch for slides demo: corrected links to images.

I hope that you will find these changes acceptable.


View raw message