Hi Naren,
sorry that I'm replying later than I said I would on IRC.
You have several options to achieve this and it depends on what you want
to offer with your shopping card.
* global variable
By declaring a <globalvar> in your site or subsite, its value will
automatically be passed around your flowlinks. You can easily serialize
your Cart instance with the setOutput(Object) method. The downside is
however that your shopping card will be tied to the URL that is visited
and you probably don't want that. Ie, when people press the back button,
their cart should remain unmodified.
* store the cart in your database
This is my preferred approach, when I visit a store I expect my cart to
be tied to my account or to my browser. The first one is easy since the
account provides the unique id, the latter can be quite easily done by
creating a 'shoppingcart' cookie with a unique id. You can then use our
GenericQueryManager to very easily store, update and retrieve your
shopping cart instance that correspond to the id you're using.
This provides your with a scalable, clusterable and persistable approach
to shopping carts.
* store the cart in a (clustered) cache
Using a robust caching solution like OSCache (lowcost, free, not very
scalable) or Tangosol Coherence (commercial, very high performance, very
reliable), you can store your Cart instance with a unique ID that you
store in a cookie and retrieve it when you need it.
* use regular HTTP sessions
This is a poor man's solution of option 2 since it will expire in time.
You can use regular HTTP sessions in RIFE, but to do so you have to set
a flag that gives you raw access to the HttpServletRequest. When you do
this, you clearly indicate that RIFE will not handle all the state for
you and when manipulating the request yourself you could shoot yourself
in the foot regarding RIFE's component model or out of container
testability. You do this with the setProhibitRawAccess(false) method
call. Then you can use the getHttpServletRequest() method to retrieve
the current HttpServletRequest instance and incidently the session if
you want.
I hope this is clear and helps you further.
Best regards,
Geert
Naren parsv wrote:
Hello
I am devloping a Shopping Cart application using RIFE. I have a class Cart
that contains the detial of items in Shopping cart. In other Java
application I put this in Session. How can I implement this using RIFE as
there is not direct Session support. Can any body provide any example to
store such a Object for a user session?
Thanks a lot.
Regards
_______________________________________________
Rife-users mailing list
[email protected]
http://www.uwyn.com/mailman/listinfo/rife-users
--
Geert Bevin Uwyn bvba
"Use what you need" Avenue de Scailmont 34
http://www.uwyn.com 7170 Manage, Belgium
gbevin[remove] at uwyn dot com Tel +32 64 84 80 03
PGP Fingerprint : 4E21 6399 CD9E A384 6619 719A C8F4 D40D 309F D6A9
Public PGP key : available at servers pgp.mit.edu, wwwkeys.pgp.net
_______________________________________________
Rife-users mailing list
[email protected]
http://www.uwyn.com/mailman/listinfo/rife-users