Hi All,

        Hope all is well. I need some advice! :)

        In my quest to avalonize and cocoonize our application, I've
        come up against a problem.

        From what I can see, it's not possible to add context key/values to
        the cocoon context from a servlet subclass for thread safe components.

        Threadsafe component instances are created by the ECM during
        Cocoon's startup in CocoonServlet.init(). If one wants to modify
        CocoonServlet.appContext in a servlet subclass (using values
        from init-param's, etc) then CocoonServlet.init() has to be
        called before the subclass does any work.

        This means, thread safe components that implement Contextualizable
        won't be able to find any context values they need.

        What am I trying to do ? Store values in the Cocoon context that are
        global across all components.

        I've found several solutions:

        1. make CocoonServlet.createCocoon() protected, allowing a
        subclass to override it, accessing the appContext before the Cocoon
        instance is created.

        2. make it possible to defer the creation of the Cocoon
        instance. eg. add an init-param 'create-cocoon-at-startup' which
        will specify whether the Cocoon instance will be created in
        CocoonServlet.init(), or at first request (or by a subclass).
        This allows a subclass to add values to the cocoon context
        during subclass.init().

        3. incorporate Wolfram Eiserts Avalon scratchpad ContextUtility
        class which allows one to specify a <context>..</context> tag
        set in cocoon.xconf that automatically populates the Cocoon context
        with globals. More info under
        http://marc.theaimsgroup.com/?l=avalon-dev&m=101559574528413&w=2

        4. any others ?

        I've tried other combinations of solutions (eg. parent component
        manager), but they all have other problematic issues. :(

        I've implemented all 3 options, but are wondering what everyone
        else thinks or if there is an easier way ?

        Any thoughts ?

        Cheers,

        Marcus

-- 
        .....
     ,,$$$$$$$$$,      Marcus Crafter
    ;$'      '$$$$:    Computer Systems Engineer
    $:         $$$$:   ManageSoft GmbH
     $       o_)$$$:   82-84 Mainzer Landstrasse
     ;$,    _/\ &&:'   60327 Frankfurt Germany
       '     /( &&&
           \_&&&&'
          &&&&.
    &&&&&&&:

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to