cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Yates <ceya...@stanford.edu>
Subject Re: How to access sourceResolver in action configure() method
Date Wed, 28 May 2003 19:59:15 GMT
The only thing I can think of is to upgrade to cocoon 2.1 where a 
SourceResolver is available from the ComponentManager.  But then you 
already knew that . . .

DURDINA Michal wrote:

>Charles, 
>thank you for a tip, but this way I only get the root of the webapplication.
>
>
>(This produces the same result as something I was using:
>org.apache.cocoon.environment.SourceResolver env =
>org.apache.cocoon.components.CocoonComponentManager.getCurrentEnvironment();
>path = env.resolve(myConfigFileName).getSystemId();
>File file = new File(path);
>)
>
>But I have my action in mounted sitemap and sourceResolver for mounted
>sitemap works in the context of the sitemap directory.
>If my mounted sitemap is located in 'subsitemap' directory and I use action
>within this sitemap, correct resolving of 'myconfig.xml' would be
>
>d:/jboss/server/default/deploy/webapp.war/subsitemap/myconfig.xml
>
>but via Context or Environment I only get my file resolved as 
>d:/jboss/server/default/deploy/webapp.war/myconfig.xml - what is wrong.
>
>Do not you know any way how to get same environment object as that which is
>passed by SitemapManager to the act() method of any action located in
>mounted sitemap?
>Maybe I could get it from ComponentManager by some role?
>
>Thank you,
>Michal
>
>
>-----Original Message-----
>From: Charles Yates [mailto:ceyates@stanford.edu]
>Sent: Tuesday, May 27, 2003 7:32 PM
>To: cocoon-users@xml.apache.org
>Subject: Re: How to access sourceResolver in action configure() method
>
>
>Can you put the configuration stuff into cocoon.xconf?  Then it would be 
>available in configure().  If not you could implement Contextualizable 
>and get the HttpContext like this:
>
>    public void contextualize(Context aContext) throws ContextException {
>        myContext =
>            (HttpContext)
>aContext.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
>    }
>
>then you could get the file like this:
>
>myConfigFile = new File(myContext.getRealPath(myConfigFileName));
>
>Charles
>
>(this works in 2.1, should in 2.0.4, though maybe minor differences)
>
>
>
>DURDINA Michal wrote:
>
>  
>
>>Hello!
>>I am using own ConfigurableComposerAction and I have problem with loading
>>configuration from external file (from filesystem). In act() method, I
>>    
>>
>would
>  
>
>>use SourceResolver parameter passed to this method, but in configure()
>>method I do not know where should I get the source resolver from.
>>
>>I am using Cocoon 2.0.4 with compiled sitemap, thus I cannot use this:
>>   
>> public void compose(ComponentManager manager) throws ComponentException {
>>       this.manager = manager;
>>       this.resolver =
>>    
>>
>(SourceResolver)manager.lookup(SourceResolver.ROLE);
>  
>
>>   }
>>
>>Thank you for your help, 
>>Michal
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>>For additional commands, e-mail: cocoon-users-help@xml.apache.org
>>
>>
>> 
>>
>>    
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: cocoon-users-help@xml.apache.org
>__________ Informacia od NOD32 1.415 (20030521) __________
>
>Tato sprava bola preverena systemom NOD32 pre Exchange.
>http://www.eset.sk
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Mime
View raw message