You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Skip Walker <sk...@gossamer-group.com> on 2002/09/16 04:04:55 UTC

RE: working with session scope pull tools not via Velocity Context

Take a look at org.apache.turbine.services.pull.TurbinePull


According to the JavaDoc, the following should work in LoginUser:

Context context = TurbinePull.getGlobalContext();

TurbinePull.populateContext(context, rundata);

You should now have access to a context that will allow you to do your

Cart crt = (Cart) context.get("cart");

Of course, this isn't really necessary for any action extending
VelocityAction or VelocitySecureAction, since the context is already
available to you.  If you are writing your own login action, then I would
make sure to extend VelocityAction, and then the context will be available
to you.

Skip


> Sent: Monday, September 16, 2002 1:53 AM
> To: turbine-user@jakarta.apache.org
> Subject: working with session scope pull tools not via
> Velocity Context
>
>
> Hi.
>
> I wrote a  session scope  pull tool to manage a Cart
>
> up to now i've always used in screens/actions (which extend
> the VelocityScreen/VelocityAction)
>
> Cart crt = (Cart) context.get("cart");
>
> // do smth with crt
>
> context.put(crt,"cart");
>
>
> Is there a way to access session pull tools instances, via
> other ways in java files?
>
> e.g.  a Pool Tool ?  (Never yet used this tool and the
> mailing list seems to indicate
> the existence of problems in "pooling" the pull tools
>
>
> This whole issue aroused from the necessity for me
>
> to access my session-scoped pull Cart in the LoginUser action
>
>  with doPerform(RunData data)
>
>  and Context instance unavailable.
>
>
> regards,
>
> slava
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: working with session scope pull tools not via Velocity Context

Posted by Slava Zimine <sl...@japgod.mine.nu>.
thanx for a code snippet to retrieve a Context

as about the Login action  extending the VelocityAction,  I did just that.
AND.... the user was effectively logged in his ACL  were NOT updated. 
I think it's safer to extend classes exactly as they are extended in Turbine. 

And in any case  the testing should be done in Login actions  to see if the user/acl  are updated.

Do you have an experience with a Pool service ? 
from its' service description

Cart crt = TurbinePool.getInstance("org.slava.pull.Cart");
// do smth with crt
TurbinePool.putInstance(crt);

Should work. 
I have not tried this yet, just discovered. 

regards,
slava


On Sun, Sep 15, 2002 at 09:04:55PM -0500, Skip Walker wrote:
> Take a look at org.apache.turbine.services.pull.TurbinePull
> 
> 
> According to the JavaDoc, the following should work in LoginUser:
> 
> Context context = TurbinePull.getGlobalContext();
> 
> TurbinePull.populateContext(context, rundata);
> 
> You should now have access to a context that will allow you to do your
> 
> Cart crt = (Cart) context.get("cart");
> 
> Of course, this isn't really necessary for any action extending
> VelocityAction or VelocitySecureAction, since the context is already
> available to you.  If you are writing your own login action, then I would
> make sure to extend VelocityAction, and then the context will be available
> to you.
> 
> Skip
> 
> 
> > Sent: Monday, September 16, 2002 1:53 AM
> > To: turbine-user@jakarta.apache.org
> > Subject: working with session scope pull tools not via
> > Velocity Context
> >
> >
> > Hi.
> >
> > I wrote a  session scope  pull tool to manage a Cart
> >
> > up to now i've always used in screens/actions (which extend
> > the VelocityScreen/VelocityAction)
> >
> > Cart crt = (Cart) context.get("cart");
> >
> > // do smth with crt
> >
> > context.put(crt,"cart");
> >
> >
> > Is there a way to access session pull tools instances, via
> > other ways in java files?
> >
> > e.g.  a Pool Tool ?  (Never yet used this tool and the
> > mailing list seems to indicate
> > the existence of problems in "pooling" the pull tools
> >
> >
> > This whole issue aroused from the necessity for me
> >
> > to access my session-scoped pull Cart in the LoginUser action
> >
> >  with doPerform(RunData data)
> >
> >  and Context instance unavailable.
> >
> >
> > regards,
> >
> > slava
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>