Here is the code I used to get the servlet context
within a JavaFlow:

Map oMap =
ContextHelper.getObjectModel(this.getContext().getAvalonContext());

HttpContext oContext =
(HttpContext)oMap.get("context");

>From there you can use set/getAttribute to manipulate
application-scope variables.

One note:  I examined a compiled jsp page and noticed
that operations performed on the context object were
always surrounded by a "synchronized" block.  I did
the same in my code.


--- footh <[EMAIL PROTECTED]> wrote:

> That's exactly what I did, but the context passed in
> is null.  In fact, I don't believe contextualize is
> ever called as I have a System.out in there and I
> never see the output.  JavaFlow classes must not be
> within the Avalon framework.  I think I read
> somewhere
> that they are just translated to javascript-based
> flow.
> 
> --- Bart Molenkamp <[EMAIL PROTECTED]>
> wrote:
> 
> > I don't have deep knowledge about JavaFlow, but I
> > guess it would be
> > something like this:
> > 
> > public class MyFlow extends AbstractContinuable
> > implements
> > Contextualizable{
> >  private Context ctx;
> > 
> >  ...
> >  public void contextualize(Context ctx) {
> >    this.ctx = ctx;
> >  }
> > }
> > 
> > Cocoon will call the contextualize() method for
> you,
> > and pass the
> > correct context instance, which you can then use
> > during the lifecycle of
> > your flow class.
> > 
> > HTH,
> > Bart.
> > 
> > > -----Oorspronkelijk bericht-----
> > > Van: footh [mailto:[EMAIL PROTECTED]
> > > Verzonden: vrijdag 29 juli 2005 8:06
> > > Aan: users@cocoon.apache.org
> > > Onderwerp: RE: JavaFlow: getting the application
> > context
> > > 
> > > I still can't seem to get the context from a
> > JavaFlow
> > > class.  I tried implementing Contextualizable
> but
> > the
> > > context argument is null.
> > > 
> > > Can anyone offer suggestions?
> > > 
> > > --- Bart Molenkamp <[EMAIL PROTECTED]>
> > wrote:
> > > 
> > > > For Java components to get the context, you
> need
> > to
> > > > implement the
> > > > Contextualizable interface from Avalon.
> > > >
> > > > Bart.
> > > >
> > > > > -----Oorspronkelijk bericht-----
> > > > > Van: footh [mailto:[EMAIL PROTECTED]
> > > > > Verzonden: woensdag 27 juli 2005 6:17
> > > > > Aan: users@cocoon.apache.org
> > > > > Onderwerp: JavaFlow: getting the application
> > > > context
> > > > >
> > > > > Does anyone know how to get the application
> > > > context
> > > > > from within a javaflow?  I'm looking for
> > something
> > > > > equivalent to the "cocoon.context" code in a
> > > > > javascript-based flow.
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> >
> ____________________________________________________
> > > > > Start your day with Yahoo! - make it your
> home
> > > > page
> > > > > http://www.yahoo.com/r/hs
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> > > > [EMAIL PROTECTED]
> > > > > For additional commands, e-mail:
> > > > [EMAIL PROTECTED]
> > > >
> > > >
> > > >
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > > [EMAIL PROTECTED]
> > > > For additional commands, e-mail:
> > > > [EMAIL PROTECTED]
> > > >
> > > >
> > > 
> > > 
> > > 
> > > 
> > >
> >
> ____________________________________________________
> > > Start your day with Yahoo! - make it your home
> > page
> > > http://www.yahoo.com/r/hs
> > > 
> > > 
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > 
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > 
> > 
> 
> 
> 
>               
> ____________________________________________________
> Start your day with Yahoo! - make it your home page 
> http://www.yahoo.com/r/hs 
>  
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 



                
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

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

Reply via email to