cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Ziegeler" <cziege...@s-und-n.de>
Subject RE: Bug? Foreign SourceResolver in Generator.configure()
Date Fri, 11 Jun 2004 07:48:00 GMT
Thanks Vadim for the test case.

Ok, we have a minor problem here :)

The contract of the SourceResolver is that it always resolves relative
to the *current sitemap*. The interesting question now is: what is
the "current sitemap" for a component that is instantiated? Is
it the sitemap the component is declared in or the sitemap of the
current request?
Now, I tend to the first option. If this is the case we have a bug :( 

To be precise I think we have this behaviour in Cocoon since 2.1.0.
I just tested 2.1.5 and the problem exists there as well.

The problem is that the lookup and therefore the initialization of
the generator is started from the sub sitemap and the sub sitemap
of course runs in the context of the location of the sub sitemap.

Now, we could solve this by "surrounding" the initialization phase
of a component with a change of the current context. So, all init
methods of a component run in the context of the sitemap where the
component is defined. All other methods run in the context
of the sitemap where the component is used.

WDYT?

Carsten

> -----Original Message-----
> From: Vadim Gritsenko [mailto:vadim@reverycodes.com] 
> Sent: Tuesday, June 08, 2004 9:07 PM
> To: dev@cocoon.apache.org
> Subject: Re: Bug? Foreign SourceResolver in Generator.configure()
> 
> Vadim Gritsenko wrote:
> 
> > Carsten Ziegeler wrote:
> >
> >> Vadim Gritsenko wrote:
> >>
> >>> Hey,
> >>>
> >>> Noticed yesterday while using HTMLGenerator: 
> SourceResolver used in
> >>> configure() method, obtained via
> >>> 
> this.manager.lookup(org.apache.excalibur.source.SourceResolver.ROLE)
> >>> , appears to be not of the sitemap where generator was 
> declared, but 
> >>> of the sitemap where generator is used. Bug?
> >>>   
> >>
> >> I would be happy if we could call this a feature :) But I 
> think this 
> >> is a bug :(
> >>
> >> Do we already have a sample where this bug can be seen?
> >
> 
> Rebuild cocoon, go to root sitemap, change
> 
>     <map:generator name="html" logger="sitemap.generator.html"
>                    src="org.apache.cocoon.generation.HTMLGenerator"
>                    label="content">
>       <!-- Tidy configuration file.
>       <jtidy-config>context://WEB-INF/tidy.properties</jtidy-config>
>       -->
>     </map:generator>
> 
> to
> 
>     <map:generator name="html" logger="sitemap.generator.html"
>                    src="org.apache.cocoon.generation.HTMLGenerator"
>                    label="content">
>       <jtidy-config>WEB-INF/tidy.properties</jtidy-config>
>     </map:generator>
> 
> you'll get:
>     java.io.FileNotFoundException:
>     
> C:\apache\cocoon-2.1\build\webapp\samples\blocks\html\WEB-INF\
> tidy.properties
> (The system cannot find the path specified)
> 
> 
> Note that file was resolved relative to sub-sub-sitemap, not 
> root sitemap.
> 
> Vadim
> 
> 


Mime
View raw message