Hi,

A service is a singleton by default. If you store a session-state object as a 
singleton service's member, every user will see the session state of the user 
who triggered your service for the first time.
Either change your service to PerThread scope [1] or better yet inject your 
session state object only in pages/components/mixins. Members of components are 
always per thread scoped.

[1] http://tapestry.apache.org/defining-tapestry-ioc-services.html


Cheers,
Christian


Am 26.07.2012 um 15:10 schrieb Matías Blasi:

> Hi all,
> 
> I'm facing the following issue:
> 
> I have a @SessionState object for a custom type.
> 
> As far as I understand that would be handled individually for each "user
> session", but I am seeing that the value is shared across all my user
> sessions... It shouldn't be possible, in fact, if it works like that we
> couldn't implement a shopping cart with this mechanism.... and I had a
> shopping cart working fine in my application!
> 
> Do you imagine what could be wrong to get this behaiviour? I cant imagine
> how implement a cross-SessionState without external persistence...
> 
> Here is my code:
> 
> public class CalificadosMessagesServiceImpl implements
> CalificadosMessagesService {
> 
> @SessionState(create=true)
> private CalificadosMessagesBag messagesBag;
> ...
> ...
> 
> @Override
> public List<CalificadosMessage> getSessoinMessages() {
> return this.messagesBag.getMessages();
> }
> 
> @Override
> public void recordSessionMessage(CalificadosMessage message) {
> this.messagesBag.addMessage(message);
> }
> ...
> ...
> }
> 
> All the logged users (from different browsers), get the same messages!
> 
> Am I loosing something obvious?
> 
> 
> Regards,
> Matias.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to