You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Matthias Brunner <mb...@blumenstrasse.vol.at> on 2002/11/19 13:26:04 UTC
Trailing slashes in request
Hello,
someone must have encountered this problem as well but I did not find
anything useful (at least for me) in the archives.
Sub-sitemap fragment:
-------------------------------
<map:match pattern="admin">
<map:redirect-to uri="admin/index"/>
</map:match>
<map:match pattern="admin/">
<map:redirect-to uri="admin/index"/>
</map:match>
<map:match pattern="admin/index">
<map:generate src="admin/index.xml"/>
<map:transform src="res/xsl/menu2html.xsl"/>
<map:serialize/>
</map:match>
-------------------------------
So when someone hits "http://mysite/cocoon/sub/admin" he is
redirected to the index page as expected.
But how do I get "http://mysite/cocoon/sub/admin/" to work as well?
At the moment cocoon returns a 404 error.
And is there a way to define this redirect for all requests which did
not match elsewhere?
Something like <map:match pattern=".*|.*/" type="regexp"> at the end
of the pipeline?
--
Matthias Brunner <mb...@blumenstrasse.vol.at>
PGP FP 7862 32B3 3B75 292A F76F 5042 8587 21AB 5B89 D501
Check out http://blumenstrasse.vol.at/~mb/gpgkey.asc
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: Trailing slashes in request
Posted by Matthias Brunner <mb...@blumenstrasse.vol.at>.
On Tuesday 19 November 2002 14:48, Geoff Howard wrote:
> oops - the regular expression match I gave you can
> obviously cause problems because it's not restrictive
> enough. In a similar case, I use: <map:match
> type="regexp" pattern="^admin[/]?$">... the brackets
> don't have a functional purpose in this case - I just
> find it easier to read that way.
I have just found out that I have been mounting the sub-sitemap below
the "**/" pattern which invokes the DirectoryGenerator :) Corrected
this.
Unfortunately the following does not even work now:
<map:match pattern="^admin[/]?$" type="regexp">
<map:redirect-to uri="admin/index"/>
</map:match>
http://mysite/cocoon/sub/admin does work but
http://mysite/cocoon/sub/admin/ is redirected to
http://mysite/cocoon/sub/admin/admin/index.
Yet these are problems I can solve myself. Again, thank you.
--
Matthias Brunner <mb...@blumenstrasse.vol.at>
PGP FP 7862 32B3 3B75 292A F76F 5042 8587 21AB 5B89 D501
Check out http://blumenstrasse.vol.at/~mb/gpgkey.asc
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: Trailing slashes in request
Posted by Geoff Howard <co...@yahoo.com>.
oops - the regular expression match I gave you can
obviously cause problems because it's not restrictive
enough. In a similar case, I use: <map:match
type="regexp" pattern="^admin[/]?$">... the brackets
don't have a functional purpose in this case - I just
find it easier to read that way.
Geoff
--- Geoff Howard <co...@yahoo.com> wrote:
> The pattern you have below should work - is it
> possible you have a typo or some other problem
> causing
> the 404?
>
> In any case, you'll probably want to use the regex
> matcher instead of the plain wildcard matcher. I
> don't think it's defined by default in the sitemap
> so
> you may need to add
> <map:matcher logger="sitemap.matcher.regexp"
> name="regexp"
> src="org.apache.cocoon.matching.RegexpURIMatcher"/>
>
> to your <map:matchers> section.
>
> Then, you can just do something like
>
> <map:match type="regexp" pattern="admin/?">
> ...
>
> HTH,
> Geoff Howard
>
> --- Matthias Brunner <mb...@blumenstrasse.vol.at>
> wrote:
> > Hello,
> >
> > someone must have encountered this problem as well
> > but I did not find
> > anything useful (at least for me) in the archives.
> >
> > Sub-sitemap fragment:
> > -------------------------------
> > <map:match pattern="admin">
> > <map:redirect-to uri="admin/index"/>
> > </map:match>
> > <map:match pattern="admin/">
> > <map:redirect-to uri="admin/index"/>
> > </map:match>
> > <map:match pattern="admin/index">
> > <map:generate src="admin/index.xml"/>
> > <map:transform src="res/xsl/menu2html.xsl"/>
> > <map:serialize/>
> > </map:match>
> > -------------------------------
> >
> > So when someone hits
> > "http://mysite/cocoon/sub/admin" he is
> > redirected to the index page as expected.
> > But how do I get "http://mysite/cocoon/sub/admin/"
> > to work as well?
> > At the moment cocoon returns a 404 error.
> >
> > And is there a way to define this redirect for all
> > requests which did
> > not match elsewhere?
> > Something like <map:match pattern=".*|.*/"
> > type="regexp"> at the end
> > of the pipeline?
> > --
> > Matthias Brunner <mb...@blumenstrasse.vol.at>
> > PGP FP 7862 32B3 3B75 292A F76F 5042 8587 21AB
> 5B89
> > D501
> > Check out
> http://blumenstrasse.vol.at/~mb/gpgkey.asc
> >
> >
> >
>
---------------------------------------------------------------------
> > Please check that your question has not already
> > been answered in the
> > FAQ before posting.
> > <http://xml.apache.org/cocoon/faq/index.html>
> >
> > To unsubscribe, e-mail:
> > <co...@xml.apache.org>
> > For additional commands, e-mail:
> > <co...@xml.apache.org>
> >
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - Let the expert host your site
> http://webhosting.yahoo.com
>
>
---------------------------------------------------------------------
> Please check that your question has not already
> been answered in the
> FAQ before posting.
> <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:
> <co...@xml.apache.org>
> For additional commands, e-mail:
> <co...@xml.apache.org>
>
__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: Trailing slashes in request
Posted by Geoff Howard <co...@yahoo.com>.
The pattern you have below should work - is it
possible you have a typo or some other problem causing
the 404?
In any case, you'll probably want to use the regex
matcher instead of the plain wildcard matcher. I
don't think it's defined by default in the sitemap so
you may need to add
<map:matcher logger="sitemap.matcher.regexp"
name="regexp"
src="org.apache.cocoon.matching.RegexpURIMatcher"/>
to your <map:matchers> section.
Then, you can just do something like
<map:match type="regexp" pattern="admin/?">
...
HTH,
Geoff Howard
--- Matthias Brunner <mb...@blumenstrasse.vol.at> wrote:
> Hello,
>
> someone must have encountered this problem as well
> but I did not find
> anything useful (at least for me) in the archives.
>
> Sub-sitemap fragment:
> -------------------------------
> <map:match pattern="admin">
> <map:redirect-to uri="admin/index"/>
> </map:match>
> <map:match pattern="admin/">
> <map:redirect-to uri="admin/index"/>
> </map:match>
> <map:match pattern="admin/index">
> <map:generate src="admin/index.xml"/>
> <map:transform src="res/xsl/menu2html.xsl"/>
> <map:serialize/>
> </map:match>
> -------------------------------
>
> So when someone hits
> "http://mysite/cocoon/sub/admin" he is
> redirected to the index page as expected.
> But how do I get "http://mysite/cocoon/sub/admin/"
> to work as well?
> At the moment cocoon returns a 404 error.
>
> And is there a way to define this redirect for all
> requests which did
> not match elsewhere?
> Something like <map:match pattern=".*|.*/"
> type="regexp"> at the end
> of the pipeline?
> --
> Matthias Brunner <mb...@blumenstrasse.vol.at>
> PGP FP 7862 32B3 3B75 292A F76F 5042 8587 21AB 5B89
> D501
> Check out http://blumenstrasse.vol.at/~mb/gpgkey.asc
>
>
>
---------------------------------------------------------------------
> Please check that your question has not already
> been answered in the
> FAQ before posting.
> <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:
> <co...@xml.apache.org>
> For additional commands, e-mail:
> <co...@xml.apache.org>
>
__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>