cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Upayavira ...@odoko.co.uk>
Subject Re: Request object with ServiceManager
Date Mon, 07 Nov 2005 14:15:01 GMT
Felix Röthenbacher wrote:
> 
> 
> Sylvain Wallez wrote:
> 
>> Upayavira wrote:
>>
>>> Felix Röthenbacher wrote:
>>>   
>>
>>
>> <snip/>
>>
>>>> Cocoon 2.1.x, Java
>>>>     
>>>
>>>
>>>
>>> Map om =
>>> CocoonComponentManager.getCurrentEnvironment().getObjectModel();
>>>   
>>
>>
>>
>> Eek! 
> 
> 
> :-)
> 
>> Althought this works, this is an internal class that no more exists in
>> the 2.2 branch!
>>
>> The best is if you have an Avalon context at hand (in an Avalon
>> component, implement the Contextualizable interface).
> 
> 
> Is there such a component I can use with a method getContext() or do I
> have to create a new one for this purpose?

I think you need to create a new one for this. What context is your java
code working in?

If it is called from flowscript, you can use
cocoon.createObject("org.yourclass.Whatever") to create the object, and
Cocoon will execute the necessary Avalon lifecycles depending upon the
implemented inferfaces. Thus, if your class implements Contextualizable,
and has a method:

    public void contextualize(Context context) throws ContextException {
        this.context = context;
    }

On object creation this method will be called and will get your context.

Does that help?

Regards, Upayavira

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


Mime
View raw message