cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob Berens" <rber...@osirion.nl>
Subject Re: Help! Redirect to cocoon:/ always redirects to root sitemap
Date Thu, 24 Nov 2005 13:17:01 GMT
Thanks,  Antonio, the workaround works fine.

I also think I found the reason for the problem. In
o.a.c.components.treeprocessor.ConcreteTreeProcessor.java
there has been a change in the handleCocoonRedirect method on line 288.

It now reads:

if (newEnv.getRootContext().equals(newEnv.getContext()) {

In 2.1.6 it was

if (newEnv.getRootContext() == newEnv.getContext()) {

The problem with the 2.1.8 expression is that if a mounted sitemap resides
in the SAME DIRECTORY as the mounting ROOT SITEMAP it gets the same context
(class = java.lang.String). Therefore the equals method returns true thereby
erronously indicating that the context of the root sitemap must be used. In
2.1.6 the comparison resulted always in false, unless you were really in the
root context.
Via your workaround using the "./" in front the context, which is a string
derived from the uri is forced to be different from the root context and
therefore it works.

Can any GURUH comment on this. Is this a bug? What are the consequences of
changing this back to the == check i.so. equals()?

----- Original Message ----- 
From: "Antonio Fiol BonnĂ­n" <antonio.fiol@gmail.com>
To: <dev@cocoon.apache.org>
Sent: Wednesday, November 23, 2005 6:15 PM
Subject: Re: Help! Redirect to cocoon:/ always redirects to root sitemap


> Try using src="./flow.xmap"
>
> It worked for me, and I sent an e-mail on that some time ago (I use
2.1.7).
>
>
> --
> Antonio
>
>
> 2005/11/23, Rob Berens <rberens@osirion.nl>:
> > I just ported our application from cocoon 2.1.6 to 2.1.8.
> >
> > Most things work fine, there only seems to be a problem with the cocoon:
> > protocol.
> >
> > My root sitemap called sitemap.xmap contains the following fragment:
> >
> >       <map:match pattern="flow/**">
> >         <map:mount src="flow.xmap" uri-prefix="" check-reload="true"
> > reload-method="synchron"/>
> >       </map:match>
> >
> > So if a uri starts with "flow", it is offered to the flow.xmap, which
does
> > the following:
> >
> >     <map:pipeline>
> >       <map:match pattern="flow/*/**">
> >         <map:redirect-to uri="cocoon:/{1}/flow/{2}"/>
> >       </map:match>
> >     </map:pipeline>
> >
> > I.e. it swaps the first two components in the uri and redirects to
itself.
> > (Some background: we have divided our webapp in publications which can
be
> > recognized by te first name in the uri, flow is used to identify
internal
> > requests originating from flow script (sendPage) and therefore we swap
in
> > order to have the publication name in front again).
> >
> > This worked with 2.1.6, but with 2.1.8 the redirect is done to the root
> > sitemap.xmap i.s.o. the current flow.xmap as can be seen from this
fragment
> > of the sitemap log file:
> >
> >
> > DEBUG (2005-11-23) 17:17.52:125 [sitemap] (/xenopsis/portal/index.html)
> > PoolThread-4/PreparableMatchNode: Matcher 'wildcard' matched prepared
> > pattern 'flow/*/**' at <map:match> -
> > file:/C:/OsrDev/xenopsis/build/webapp/flow.xmap:61:38
> > DEBUG (2005-11-23) 17:17.52:125 [sitemap] (/xenopsis/portal/index.html)
> > PoolThread-4/InvokeContext:
> > Current Sitemap Parameters:
> > LEVEL 1
> > PARAM: '2' VALUE: 'portal/index.html'
> > PARAM: '0' VALUE: 'flow/xenopsis/portal/index.html'
> > PARAM: '1' VALUE: 'xenopsis'
> >
> > INFO  (2005-11-23) 17:17.52:125 [sitemap] (/xenopsis/portal/index.html)
> > PoolThread-4/RedirectToURINode: Redirecting to
> > 'cocoon:/xenopsis/flow/portal/index.html' at <map:redirect-to> -
> > file:/C:/OsrDev/xenopsis/build/webapp/flow.xmap:62:54
> > INFO  (2005-11-23) 17:17.52:125 [sitemap] (/xenopsis/portal/index.html)
> > PoolThread-4/ForwardRedirector: Redirecting to
> > 'cocoon:/xenopsis/flow/portal/index.html'
> > DEBUG (2005-11-23) 17:17.52:125 [sitemap] (/xenopsis/portal/index.html)
> > PoolThread-4/EnvironmentWrapper: Setting uri (prefix=null,
> > uris=xenopsis/flow/portal/index.html)
> > DEBUG (2005-11-23) 17:17.52:125 [sitemap] (/xenopsis/portal/index.html)
> > PoolThread-4/PreparableMatchNode: Matcher 'wildcard' matched prepared
> > pattern '**' at <map:match> -
> > file:/C:/OsrDev/xenopsis/build/webapp/sitemap.xmap:258:31
> > DEBUG (2005-11-23) 17:17.52:125 [sitemap] (/xenopsis/portal/index.html)
> > PoolThread-4/InvokeContext:
> > Current Sitemap Parameters:
> > LEVEL 2
> > PARAM: '0' VALUE: 'xenopsis/flow/portal/index.html'
> > PARAM: '1' VALUE: 'xenopsis/flow/portal/index.html'
> > LEVEL 1
> > PARAM: '../2' VALUE: 'portal/index.html'
> > PARAM: '../0' VALUE: 'flow/xenopsis/portal/index.html'
> > PARAM: '../1' VALUE: 'xenopsis'
> >
> >
> > I observed the same behaviour for uri's used in sendPage and not
starting
> > with a '/'. They were also redirected to the root sitemap.
> >
> > I didn't make any modifications in our sitemaps or in our java scripts
> > during the port. They have been ported unchanged from 2.1.6 to 2.1.8.
> >
> > What am I doing wrong? Or is this a bug?
> >
> > Rob Berens
> > Osirion B.V.
> > The Netherlands
> > E-mail: rberens@osirion.nl
> >
> >
>
>
> --
> Antonio
>


Mime
View raw message