Sessions getting mixed up

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Sessions getting mixed up

nquirynen
Hi,

I'm having some weird issues with sessions that are getting mixed up,
for example:

I open a page in both Firefox and Safari (so they are a different
HttpSession).
I do something in Firefox that sets a value in an object that is
annotated with @SessionState.
Apparently this change also affected the value in my Safari session.

What could be affecting this? Could this be a code problem, or maybe a
configuration/Tomcat problem?
I have no idea on where to start searching, so any pointers are welcome!

Thanks,
Nathan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Sessions getting mixed up

kristian marinkovic-3
can you post some code? the page with the annotated field and the methods
that manipulate that fields?


On Mon, Jun 17, 2013 at 10:49 AM, Nathan Quirynen <
[hidden email]> wrote:

> Hi,
>
> I'm having some weird issues with sessions that are getting mixed up, for
> example:
>
> I open a page in both Firefox and Safari (so they are a different
> HttpSession).
> I do something in Firefox that sets a value in an object that is annotated
> with @SessionState.
> Apparently this change also affected the value in my Safari session.
>
> What could be affecting this? Could this be a code problem, or maybe a
> configuration/Tomcat problem?
> I have no idea on where to start searching, so any pointers are welcome!
>
> Thanks,
> Nathan
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<[hidden email]>
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Sessions getting mixed up

Thiago H de Paula Figueiredo
In reply to this post by nquirynen
A common mistake is to initialize @Persist or @SessionState fields in its
declaration (such as @Persist private User user = new User(). Don't do
that. Use event handler methods for that. setupRender() is usually a good
choice.


On Mon, Jun 17, 2013 at 5:49 AM, Nathan Quirynen <
[hidden email]> wrote:

> Hi,
>
> I'm having some weird issues with sessions that are getting mixed up, for
> example:
>
> I open a page in both Firefox and Safari (so they are a different
> HttpSession).
> I do something in Firefox that sets a value in an object that is annotated
> with @SessionState.
> Apparently this change also affected the value in my Safari session.
>
> What could be affecting this? Could this be a code problem, or maybe a
> configuration/Tomcat problem?
> I have no idea on where to start searching, so any pointers are welcome!
>
> Thanks,
> Nathan
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<[hidden email]>
> For additional commands, e-mail: [hidden email]
>
>


--
Thiago
Reply | Threaded
Open this post in threaded view
|

Re: Sessions getting mixed up

nquirynen
In reply to this post by kristian marinkovic-3
Hi,

I think the problem is that I use the @SessionState in a injected service. And the service being a singleton, explains the behaviour. I guess @SessionState can only be used in pages and components? Have to test this though.

On 17/06/13 13:05, Kristian Marinkovic wrote:
can you post some code? the page with the annotated field and the methods
that manipulate that fields?


On Mon, Jun 17, 2013 at 10:49 AM, Nathan Quirynen <
[hidden email]> wrote:

Hi,

I'm having some weird issues with sessions that are getting mixed up, for
example:

I open a page in both Firefox and Safari (so they are a different
HttpSession).
I do something in Firefox that sets a value in an object that is annotated
with @SessionState.
Apparently this change also affected the value in my Safari session.

What could be affecting this? Could this be a code problem, or maybe a
configuration/Tomcat problem?
I have no idea on where to start searching, so any pointers are welcome!

Thanks,
Nathan

------------------------------**------------------------------**---------
To unsubscribe, e-mail: [hidden email][hidden email]
For additional commands, e-mail: [hidden email]



    


--

Een klare kijk op aanvullende pensioenen

Nathan Quirynen
03 340 04 60 | 0494 28 45 15
[hidden email]

Follow us on Web | Twitter | LinkedIn | RSS | YouTube

Reply | Threaded
Open this post in threaded view
|

Re: Sessions getting mixed up

nquirynen
I made the mistake of using @SessionState in a service, while this is only supported in pages components or mixins.
So the annotation didn't do anything. So there was always just one instantiation of the object, which everyone used.

I fixed my problem by using ApplicationStateManager in this service instead.

On 17/06/13 13:36, Nathan Quirynen wrote:
Hi,

I think the problem is that I use the @SessionState in a injected service. And the service being a singleton, explains the behaviour. I guess @SessionState can only be used in pages and components? Have to test this though.

On 17/06/13 13:05, Kristian Marinkovic wrote:
can you post some code? the page with the annotated field and the methods
that manipulate that fields?


On Mon, Jun 17, 2013 at 10:49 AM, Nathan Quirynen <
[hidden email]> wrote:

Hi,

I'm having some weird issues with sessions that are getting mixed up, for
example:

I open a page in both Firefox and Safari (so they are a different
HttpSession).
I do something in Firefox that sets a value in an object that is annotated
with @SessionState.
Apparently this change also affected the value in my Safari session.

What could be affecting this? Could this be a code problem, or maybe a
configuration/Tomcat problem?
I have no idea on where to start searching, so any pointers are welcome!

Thanks,
Nathan

------------------------------**------------------------------**---------
To unsubscribe, e-mail: [hidden email][hidden email]
For additional commands, e-mail: [hidden email]




--

Een klare kijk op aanvullende pensioenen

Nathan Quirynen
03 340 04 60 | 0494 28 45 15
[hidden email]

Follow us on Web | Twitter | LinkedIn | RSS | YouTube



--

Een klare kijk op aanvullende pensioenen

Nathan Quirynen
03 340 04 60 | 0494 28 45 15
[hidden email]

Follow us on Web | Twitter | LinkedIn | RSS | YouTube

Reply | Threaded
Open this post in threaded view
|

Re: Sessions getting mixed up

Thiago H de Paula Figueiredo
In reply to this post by nquirynen
On Mon, Jun 17, 2013 at 8:36 AM, Nathan Quirynen <
[hidden email]> wrote:

>  Hi,
>

Hello!


>
> I think the problem is that I use the @SessionState in a injected service.
> And the service being a singleton, explains the behaviour. I guess
> @SessionState can only be used in pages and components? Have to test this
> though.
>

@SessionState is ignored in services. It's meant to be used only in pages,
components and mixins i.e. classes that are transformed by Tapestry. As you
already said, if you want to deal with the session in a service, use
ApplicationStateManager instead.

Thiago
Reply | Threaded
Open this post in threaded view
|

Re: Sessions getting mixed up

Michael Gentry-2
Could Tapestry throw an exception if you use @SessionState in a service?

Thanks,

mrg



On Mon, Jun 17, 2013 at 9:25 AM, Thiago H. de Paula Figueiredo <
[hidden email]> wrote:

> On Mon, Jun 17, 2013 at 8:36 AM, Nathan Quirynen <
> [hidden email]> wrote:
>
> >  Hi,
> >
>
> Hello!
>
>
> >
> > I think the problem is that I use the @SessionState in a injected
> service.
> > And the service being a singleton, explains the behaviour. I guess
> > @SessionState can only be used in pages and components? Have to test this
> > though.
> >
>
> @SessionState is ignored in services. It's meant to be used only in pages,
> components and mixins i.e. classes that are transformed by Tapestry. As you
> already said, if you want to deal with the session in a service, use
> ApplicationStateManager instead.
>
> Thiago
>
Reply | Threaded
Open this post in threaded view
|

Re: Sessions getting mixed up

Thiago H de Paula Figueiredo
No. Services are handled by Tapestry-IoC and @SessionState isn't part of
it. In other words, we would need to create a dependency of Tapestry-IoC on
Tapestry(-core, the web framework), something that doesn't happen today.


On Mon, Jun 17, 2013 at 10:50 AM, Michael Gentry <[hidden email]>wrote:

> Could Tapestry throw an exception if you use @SessionState in a service?
>
> Thanks,
>
> mrg
>
>
>
> On Mon, Jun 17, 2013 at 9:25 AM, Thiago H. de Paula Figueiredo <
> [hidden email]> wrote:
>
> > On Mon, Jun 17, 2013 at 8:36 AM, Nathan Quirynen <
> > [hidden email]> wrote:
> >
> > >  Hi,
> > >
> >
> > Hello!
> >
> >
> > >
> > > I think the problem is that I use the @SessionState in a injected
> > service.
> > > And the service being a singleton, explains the behaviour. I guess
> > > @SessionState can only be used in pages and components? Have to test
> this
> > > though.
> > >
> >
> > @SessionState is ignored in services. It's meant to be used only in
> pages,
> > components and mixins i.e. classes that are transformed by Tapestry. As
> you
> > already said, if you want to deal with the session in a service, use
> > ApplicationStateManager instead.
> >
> > Thiago
> >
>



--
Thiago
Reply | Threaded
Open this post in threaded view
|

Re: Sessions getting mixed up

Jens Breitenstein
In reply to this post by Michael Gentry-2
Maybe I do net get it, but why can't you make use of a service having "Request Scope"? So Tapestry creates a new Instance per Request and you attach / inject yor session here?

Jens

Sent from my iPhone

On 17.06.2013, at 15:50, Michael Gentry <[hidden email]> wrote:

> Could Tapestry throw an exception if you use @SessionState in a service?
>
> Thanks,
>
> mrg
>
>
>
> On Mon, Jun 17, 2013 at 9:25 AM, Thiago H. de Paula Figueiredo <
> [hidden email]> wrote:
>
>> On Mon, Jun 17, 2013 at 8:36 AM, Nathan Quirynen <
>> [hidden email]> wrote:
>>
>>> Hi,
>>>
>>
>> Hello!
>>
>>
>>>
>>> I think the problem is that I use the @SessionState in a injected
>> service.
>>> And the service being a singleton, explains the behaviour. I guess
>>> @SessionState can only be used in pages and components? Have to test this
>>> though.
>>>
>>
>> @SessionState is ignored in services. It's meant to be used only in pages,
>> components and mixins i.e. classes that are transformed by Tapestry. As you
>> already said, if you want to deal with the session in a service, use
>> ApplicationStateManager instead.
>>
>> Thiago
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Sessions getting mixed up

Howard Lewis Ship
That's the PerThread scope.

Tapestry IoC was designed to do minimal intrusion into your code; until
5.2, it didn't do field injection, just constructor injection.

The problem with saying "@SessionScope is not supported" is that, if you
iterate over all the fields and all the annotation, how do you know which
ones are valid and which are not?  We kind of missed the boat by not having
our annotation classes themselves be annotated with a meta-annotation,
which would let the mechanisms inside IoC understand.

Don't get me started on what I would do differently with Tapestry with all
the knowledge I've gained ... however, many things need to be cast in stone
now, for backwards compatibility reasons.  A perfect system would probably
not have such a big difference between a service and a page/component ...
but that horse has left the barn.



On Mon, Jun 17, 2013 at 2:44 PM, [hidden email]
<[hidden email]>wrote:

> Maybe I do net get it, but why can't you make use of a service having
> "Request Scope"? So Tapestry creates a new Instance per Request and you
> attach / inject yor session here?
>
> Jens
>
> Sent from my iPhone
>
> On 17.06.2013, at 15:50, Michael Gentry <[hidden email]> wrote:
>
> > Could Tapestry throw an exception if you use @SessionState in a service?
> >
> > Thanks,
> >
> > mrg
> >
> >
> >
> > On Mon, Jun 17, 2013 at 9:25 AM, Thiago H. de Paula Figueiredo <
> > [hidden email]> wrote:
> >
> >> On Mon, Jun 17, 2013 at 8:36 AM, Nathan Quirynen <
> >> [hidden email]> wrote:
> >>
> >>> Hi,
> >>>
> >>
> >> Hello!
> >>
> >>
> >>>
> >>> I think the problem is that I use the @SessionState in a injected
> >> service.
> >>> And the service being a singleton, explains the behaviour. I guess
> >>> @SessionState can only be used in pages and components? Have to test
> this
> >>> though.
> >>>
> >>
> >> @SessionState is ignored in services. It's meant to be used only in
> pages,
> >> components and mixins i.e. classes that are transformed by Tapestry. As
> you
> >> already said, if you want to deal with the session in a service, use
> >> ApplicationStateManager instead.
> >>
> >> Thiago
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com