You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Bob Harrod <rj...@gmail.com> on 2012/05/17 19:32:05 UTC

Cocoon 2.1 sitemap broken in Tomcat 6

We've recently upgraded our Cocoon 2.1 based web app from Tomcat 4 to
Tomcat 6.  Our sitemaps were written with a somewhat invalid matchers which
worked in Tomcat 4:

For example:

<map:match pattern="/basicthing">
...
</map:match>


Tomcat 6 more adequately adheres to the HTTP URL spec and appends a
trailing slash.  Of course, the trailing slash breaks the matcher above.
The following matcher would work in Tomcat 6 but breaks all of the matchers
for Tomcat 4:

<map:match pattern="/basicthing/">
...
</map:match>


To avoid duplication, I've written a matcher to catch this case to avoid
duplicating matchers:

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


While this works for the basic case, it is not recursive, and as soon as a
url pattern goes past basic thing (/basicthing/morethings/), I need another
matcher to catch this case ("*/*/").

Is there a way to create a recursive matcher in cocoon to catch multiple
slashes and end at a trailing slash?  I'm thinking something like:

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

Would that work?

Re: Cocoon 2.1 sitemap broken in Tomcat 6

Posted by Thorsten Scherler <sc...@gmail.com>.
On 05/17/2012 07:32 PM, Bob Harrod wrote:
> We've recently upgraded our Cocoon 2.1 based web app from Tomcat 4 to 
> Tomcat 6.  Our sitemaps were written with a somewhat invalid matchers 
> which worked in Tomcat 4:
>
> For example:
>
> <map:match pattern="/basicthing">
> ...
> </map:match>
>
>
> Tomcat 6 more adequately adheres to the HTTP URL spec and appends a 
> trailing slash.  Of course, the trailing slash breaks the matcher 
> above. The following matcher would work in Tomcat 6 but breaks all of 
> the matchers for Tomcat 4:
>
> <map:match pattern="/basicthing/">
> ...
> </map:match>
>
>
> To avoid duplication, I've written a matcher to catch this case to 
> avoid duplicating matchers:
>
> <map:match pattern="*/">
> <map:redirect-to uri="cocoon:/{1}"/>
> </map:match>
>
>
> While this works for the basic case, it is not recursive, and as soon 
> as a url pattern goes past basic thing (/basicthing/morethings/), I 
> need another matcher to catch this case ("*/*/").
>
> Is there a way to create a recursive matcher in cocoon to catch 
> multiple slashes and end at a trailing slash?  I'm thinking something 
> like:
>
> <map:match pattern="**/">
> <map:redirect-to uri="cocoon:/{1}"/>
> </map:match>
>
> Would that work?

yes

salu2

-- 
Thorsten Scherler<scherler.at.gmail.com>
codeBusters S.L. - web based systems
<consulting, training and solutions>

http://www.codebusters.es/