cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From footh <fo...@yahoo.com>
Subject SOLVED: JavaFlow: getting the application context
Date Tue, 02 Aug 2005 01:54:32 GMT
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 <footh@yahoo.com> 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 <b.molenkamp@bizzdesign.nl>
> 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:footh@yahoo.com]
> > > 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 <b.molenkamp@bizzdesign.nl>
> > wrote:
> > > 
> > > > For Java components to get the context, you
> need
> > to
> > > > implement the
> > > > Contextualizable interface from Avalon.
> > > >
> > > > Bart.
> > > >
> > > > > -----Oorspronkelijk bericht-----
> > > > > Van: footh [mailto:footh@yahoo.com]
> > > > > 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:
> > > > users-unsubscribe@cocoon.apache.org
> > > > > For additional commands, e-mail:
> > > > users-help@cocoon.apache.org
> > > >
> > > >
> > > >
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > > users-unsubscribe@cocoon.apache.org
> > > > For additional commands, e-mail:
> > > > users-help@cocoon.apache.org
> > > >
> > > >
> > > 
> > > 
> > > 
> > > 
> > >
> >
> ____________________________________________________
> > > Start your day with Yahoo! - make it your home
> > page
> > > http://www.yahoo.com/r/hs
> > > 
> > > 
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > users-unsubscribe@cocoon.apache.org
> > > For additional commands, e-mail:
> > users-help@cocoon.apache.org
> > 
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail:
> > users-help@cocoon.apache.org
> > 
> > 
> 
> 
> 
> 		
> ____________________________________________________
> Start your day with Yahoo! - make it your home page 
> http://www.yahoo.com/r/hs 
>  
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail:
> users-help@cocoon.apache.org
> 
> 



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

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


Mime
View raw message