Re: Is this safe?

2008-01-21 Thread Eelco Hillenius
On Jan 21, 2008 1:51 AM, Martijn Lindhout <[EMAIL PROTECTED]> wrote:
> ok, and if the session isn't thread safe, where do I store my temporal data?

I think the session is a fine storage option for a shopping cart. Just
synchronize the cart itself and you're fine. Or don't; it's rather
unlikely you actually run into trouble if you ask me.

Btw, add(new CartPanel("cart", new PropertyModel(this,
"session.cart"))); also works, since components have a getSession
method.

Eelco

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



Re: Is this safe?

2008-01-21 Thread Martijn Lindhout
custom request cycle?

2008/1/21, Martijn Dashorst <[EMAIL PROTECTED]>:
>
> Typically a custom request cycle for the actual object and store the key
> for
> getting access to the object in the session.
> If the cart is not a hibernate entity, but something really transient, I
> don't think there is any harm in putting it in the session, as long as you
> are certain you won't be doing resouce updates based on the session.
> Typically add/remove from carts are single requests that are synchronized
> on
> the session.
>
> As for the property model, you can do this as well:
>
> add(new ShoppingCartPanel("panel", new PropertyModel(this, "session.cart
> ")));
>
>
> Martijn
>
> On 1/21/08, Martijn Lindhout <[EMAIL PROTECTED]> wrote:
> >
> > ok, and if the session isn't thread safe, where do I store my temporal
> > data?
> >
> >
> > 2008/1/21, Johan Compagner <[EMAIL PROTECTED]>:
> > >
> > > The session. Because the property exp is used when you ask for the
> value
> > >
> > > On 1/21/08, Martijn Lindhout <[EMAIL PROTECTED]> wrote:
> > > > you're right. It contains a shoppingcart. What is stored in the
> > > > propertymodel, the session? Or the result of evaluating the
> expression
> > > > s.cart -> session.getCart().
> > > >
> > > > And if the session isn't thread safe, where do I store my temporal
> > data?
> > > >
> > > > 2008/1/21, Johan Compagner <[EMAIL PROTECTED]>:
> > > > >
> > > > > What would you like to detach?
> > > > > What is inside that card object? I guess thats a temp storage
> object
> > > > > of shopping items?
> > > > >
> > > > > Do remenber that getting the card object from the session isnt
> > thread
> > > > > safe! (mutating it can be done from more then one thread if
> > different
> > > > > pagemaps and so on are used)
> > > > >
> > > > > On 1/21/08, Martijn Lindhout <[EMAIL PROTECTED]> wrote:
> > > > > > Hi all,
> > > > > >
> > > > > > I wonder if this will work:
> > > > > >
> > > > > > add(new CartPanel("cart", new PropertyModel(s, "cart")));
> > > > > >
> > > > > > where 's' is my app specific session, containing the method
> > > getCart()
> > > > > which
> > > > > > checks the session for an existing cart, and if not found
> creates
> > > one.
> > > > > >
> > > > > > Is this enough to handle load/detach? Or do I have to write my
> own
> > > > > > LoadableModel
> > > > > >
> > > > > > --
> > > > > > Martijn Lindhout
> > > > > > JointEffort IT Services
> > > > > > http://www.jointeffort.nl
> > > > > > [EMAIL PROTECTED]
> > > > > > +31 (0)6 18 47 25 29
> > > > > >
> > > > >
> > > > >
> > -
> > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Martijn Lindhout
> > > > JointEffort IT Services
> > > > http://www.jointeffort.nl
> > > > [EMAIL PROTECTED]
> > > > +31 (0)6 18 47 25 29
> > > >
> > >
> > > -
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> > --
> > Martijn Lindhout
> > JointEffort IT Services
> > http://www.jointeffort.nl
> > [EMAIL PROTECTED]
> > +31 (0)6 18 47 25 29
> >
>
>
>
> --
> Buy Wicket in Action: http://manning.com/dashorst
> Apache Wicket 1.3.0 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0
>



-- 
Martijn Lindhout
JointEffort IT Services
http://www.jointeffort.nl
[EMAIL PROTECTED]
+31 (0)6 18 47 25 29


Re: Is this safe?

2008-01-21 Thread Martijn Dashorst
Typically a custom request cycle for the actual object and store the key for
getting access to the object in the session.
If the cart is not a hibernate entity, but something really transient, I
don't think there is any harm in putting it in the session, as long as you
are certain you won't be doing resouce updates based on the session.
Typically add/remove from carts are single requests that are synchronized on
the session.

As for the property model, you can do this as well:

add(new ShoppingCartPanel("panel", new PropertyModel(this, "session.cart
")));


Martijn

On 1/21/08, Martijn Lindhout <[EMAIL PROTECTED]> wrote:
>
> ok, and if the session isn't thread safe, where do I store my temporal
> data?
>
>
> 2008/1/21, Johan Compagner <[EMAIL PROTECTED]>:
> >
> > The session. Because the property exp is used when you ask for the value
> >
> > On 1/21/08, Martijn Lindhout <[EMAIL PROTECTED]> wrote:
> > > you're right. It contains a shoppingcart. What is stored in the
> > > propertymodel, the session? Or the result of evaluating the expression
> > > s.cart -> session.getCart().
> > >
> > > And if the session isn't thread safe, where do I store my temporal
> data?
> > >
> > > 2008/1/21, Johan Compagner <[EMAIL PROTECTED]>:
> > > >
> > > > What would you like to detach?
> > > > What is inside that card object? I guess thats a temp storage object
> > > > of shopping items?
> > > >
> > > > Do remenber that getting the card object from the session isnt
> thread
> > > > safe! (mutating it can be done from more then one thread if
> different
> > > > pagemaps and so on are used)
> > > >
> > > > On 1/21/08, Martijn Lindhout <[EMAIL PROTECTED]> wrote:
> > > > > Hi all,
> > > > >
> > > > > I wonder if this will work:
> > > > >
> > > > > add(new CartPanel("cart", new PropertyModel(s, "cart")));
> > > > >
> > > > > where 's' is my app specific session, containing the method
> > getCart()
> > > > which
> > > > > checks the session for an existing cart, and if not found creates
> > one.
> > > > >
> > > > > Is this enough to handle load/detach? Or do I have to write my own
> > > > > LoadableModel
> > > > >
> > > > > --
> > > > > Martijn Lindhout
> > > > > JointEffort IT Services
> > > > > http://www.jointeffort.nl
> > > > > [EMAIL PROTECTED]
> > > > > +31 (0)6 18 47 25 29
> > > > >
> > > >
> > > >
> -
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > >
> > > --
> > > Martijn Lindhout
> > > JointEffort IT Services
> > > http://www.jointeffort.nl
> > > [EMAIL PROTECTED]
> > > +31 (0)6 18 47 25 29
> > >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> Martijn Lindhout
> JointEffort IT Services
> http://www.jointeffort.nl
> [EMAIL PROTECTED]
> +31 (0)6 18 47 25 29
>



-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0


Re: Is this safe?

2008-01-21 Thread Martijn Lindhout
ok, and if the session isn't thread safe, where do I store my temporal data?


2008/1/21, Johan Compagner <[EMAIL PROTECTED]>:
>
> The session. Because the property exp is used when you ask for the value
>
> On 1/21/08, Martijn Lindhout <[EMAIL PROTECTED]> wrote:
> > you're right. It contains a shoppingcart. What is stored in the
> > propertymodel, the session? Or the result of evaluating the expression
> > s.cart -> session.getCart().
> >
> > And if the session isn't thread safe, where do I store my temporal data?
> >
> > 2008/1/21, Johan Compagner <[EMAIL PROTECTED]>:
> > >
> > > What would you like to detach?
> > > What is inside that card object? I guess thats a temp storage object
> > > of shopping items?
> > >
> > > Do remenber that getting the card object from the session isnt thread
> > > safe! (mutating it can be done from more then one thread if different
> > > pagemaps and so on are used)
> > >
> > > On 1/21/08, Martijn Lindhout <[EMAIL PROTECTED]> wrote:
> > > > Hi all,
> > > >
> > > > I wonder if this will work:
> > > >
> > > > add(new CartPanel("cart", new PropertyModel(s, "cart")));
> > > >
> > > > where 's' is my app specific session, containing the method
> getCart()
> > > which
> > > > checks the session for an existing cart, and if not found creates
> one.
> > > >
> > > > Is this enough to handle load/detach? Or do I have to write my own
> > > > LoadableModel
> > > >
> > > > --
> > > > Martijn Lindhout
> > > > JointEffort IT Services
> > > > http://www.jointeffort.nl
> > > > [EMAIL PROTECTED]
> > > > +31 (0)6 18 47 25 29
> > > >
> > >
> > > -
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> > --
> > Martijn Lindhout
> > JointEffort IT Services
> > http://www.jointeffort.nl
> > [EMAIL PROTECTED]
> > +31 (0)6 18 47 25 29
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Martijn Lindhout
JointEffort IT Services
http://www.jointeffort.nl
[EMAIL PROTECTED]
+31 (0)6 18 47 25 29


Re: Is this safe?

2008-01-21 Thread Johan Compagner
The session. Because the property exp is used when you ask for the value

On 1/21/08, Martijn Lindhout <[EMAIL PROTECTED]> wrote:
> you're right. It contains a shoppingcart. What is stored in the
> propertymodel, the session? Or the result of evaluating the expression
> s.cart -> session.getCart().
>
> And if the session isn't thread safe, where do I store my temporal data?
>
> 2008/1/21, Johan Compagner <[EMAIL PROTECTED]>:
> >
> > What would you like to detach?
> > What is inside that card object? I guess thats a temp storage object
> > of shopping items?
> >
> > Do remenber that getting the card object from the session isnt thread
> > safe! (mutating it can be done from more then one thread if different
> > pagemaps and so on are used)
> >
> > On 1/21/08, Martijn Lindhout <[EMAIL PROTECTED]> wrote:
> > > Hi all,
> > >
> > > I wonder if this will work:
> > >
> > > add(new CartPanel("cart", new PropertyModel(s, "cart")));
> > >
> > > where 's' is my app specific session, containing the method getCart()
> > which
> > > checks the session for an existing cart, and if not found creates one.
> > >
> > > Is this enough to handle load/detach? Or do I have to write my own
> > > LoadableModel
> > >
> > > --
> > > Martijn Lindhout
> > > JointEffort IT Services
> > > http://www.jointeffort.nl
> > > [EMAIL PROTECTED]
> > > +31 (0)6 18 47 25 29
> > >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> Martijn Lindhout
> JointEffort IT Services
> http://www.jointeffort.nl
> [EMAIL PROTECTED]
> +31 (0)6 18 47 25 29
>

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



Re: Is this safe?

2008-01-21 Thread Martijn Lindhout
you're right. It contains a shoppingcart. What is stored in the
propertymodel, the session? Or the result of evaluating the expression
s.cart -> session.getCart().

And if the session isn't thread safe, where do I store my temporal data?

2008/1/21, Johan Compagner <[EMAIL PROTECTED]>:
>
> What would you like to detach?
> What is inside that card object? I guess thats a temp storage object
> of shopping items?
>
> Do remenber that getting the card object from the session isnt thread
> safe! (mutating it can be done from more then one thread if different
> pagemaps and so on are used)
>
> On 1/21/08, Martijn Lindhout <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> > I wonder if this will work:
> >
> > add(new CartPanel("cart", new PropertyModel(s, "cart")));
> >
> > where 's' is my app specific session, containing the method getCart()
> which
> > checks the session for an existing cart, and if not found creates one.
> >
> > Is this enough to handle load/detach? Or do I have to write my own
> > LoadableModel
> >
> > --
> > Martijn Lindhout
> > JointEffort IT Services
> > http://www.jointeffort.nl
> > [EMAIL PROTECTED]
> > +31 (0)6 18 47 25 29
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Martijn Lindhout
JointEffort IT Services
http://www.jointeffort.nl
[EMAIL PROTECTED]
+31 (0)6 18 47 25 29


Re: Is this safe?

2008-01-21 Thread Johan Compagner
What would you like to detach?
What is inside that card object? I guess thats a temp storage object
of shopping items?

Do remenber that getting the card object from the session isnt thread
safe! (mutating it can be done from more then one thread if different
pagemaps and so on are used)

On 1/21/08, Martijn Lindhout <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I wonder if this will work:
>
> add(new CartPanel("cart", new PropertyModel(s, "cart")));
>
> where 's' is my app specific session, containing the method getCart() which
> checks the session for an existing cart, and if not found creates one.
>
> Is this enough to handle load/detach? Or do I have to write my own
> LoadableModel
>
> --
> Martijn Lindhout
> JointEffort IT Services
> http://www.jointeffort.nl
> [EMAIL PROTECTED]
> +31 (0)6 18 47 25 29
>

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



Is this safe?

2008-01-21 Thread Martijn Lindhout
Hi all,

I wonder if this will work:

add(new CartPanel("cart", new PropertyModel(s, "cart")));

where 's' is my app specific session, containing the method getCart() which
checks the session for an existing cart, and if not found creates one.

Is this enough to handle load/detach? Or do I have to write my own
LoadableModel

-- 
Martijn Lindhout
JointEffort IT Services
http://www.jointeffort.nl
[EMAIL PROTECTED]
+31 (0)6 18 47 25 29