You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Paolo Scopa <pa...@yahoo.com> on 2007/07/05 10:24:30 UTC
4.1.1 Session issue
Hi experts,
I have a bit of troule storing/retrieving info in the session.
I followed the eshop example, adding a contribution in hivemind module to
store the user name in the session.
I want my dao to store this information every time that an object is updated
in the database (the user who last changed the object).
However I can't find a way to access the session from my dao, because to use
@injectState I must make my dao abstract (and obviously it cant be).
So it looks like I can access the session info only from a BasePage, which
is actually abstract.
My question is: do I really have to retrieve that information in the Page
and pass it around to the service, then to the dao to store it? Is there no
way to access it directly from the dao?
The main reason is that i wanted to include to a BaseDao class, so all my
daos will do the same thing while saving.
Any ideas?
Thanks
Paolo
--
View this message in context: http://www.nabble.com/4.1.1-Session-issue-tf4028256.html#a11442438
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: 4.1.1 Session issue
Posted by Igor Drobiazko <ig...@gmail.com>.
great :)
On 7/5/07, Paolo Scopa <pa...@yahoo.com> wrote:
>
>
> Ok, I eventually did it.
> I mached your solution with the post in
>
> http://www.nabble.com/How-to-inject-ASO-in-service--tf1518378.html#a4141166
> and it works fine
>
> Thanks a lot
> Paolo
>
>
>
> Paolo Scopa wrote:
> >
> > Thanks for replying,
> > I tried my best to understand what i should do, but im afraid i cant
> > follow you.
> > I never used ApplicationStateManager directly and i dont know where to
> > find an example.
> > Also i don't know where the lines you posted should be added.
> >
> > What i started from is something like
> >
> > <contribution configuration-id="tapestry.state.ApplicationObjects
> ">
> > <state-object name="sessionInfo" scope="session">
> > <create-instance class="mypackage.SessionInfo"/>
> > </state-object>
> > </contribution>
> >
> > I can access this via getSessionInfo inside a page, as i said: but not
> in
> > another class.
> >
> > Do you mean that i should create a new service that returns this object?
> >
> > Paolo
> >
> >
> > Igor Drobiazko wrote:
> >>
> >> Hi,
> >>
> >> you can inject the ApplicationStateManager in your DAO and access your
> >> ASO
> >> by using it.
> >>
> >>
> http://tapestry.apache.org/tapestry4.1/apidocs/org/apache/tapestry/engine/state/ApplicationStateManager.html
> >>
> http://tapestry.apache.org/tapestry4.1/tapestry-framework/hivedoc/service/tapestry.state.ApplicationStateManager.html
> >>
> >> Just add a field and the following line into your service construction:
> >>
> >> <set-service property="applicationStateManager"
> >> service-id="tapestry.state.
> >> ApplicationStateManager"/>
> >> </construct>
> >>
> >> On 7/5/07, Paolo Scopa <pa...@yahoo.com> wrote:
> >>>
> >>>
> >>> Hi experts,
> >>> I have a bit of troule storing/retrieving info in the session.
> >>>
> >>> I followed the eshop example, adding a contribution in hivemind module
> >>> to
> >>> store the user name in the session.
> >>> I want my dao to store this information every time that an object is
> >>> updated
> >>> in the database (the user who last changed the object).
> >>>
> >>> However I can't find a way to access the session from my dao, because
> to
> >>> use
> >>> @injectState I must make my dao abstract (and obviously it cant be).
> >>> So it looks like I can access the session info only from a BasePage,
> >>> which
> >>> is actually abstract.
> >>>
> >>> My question is: do I really have to retrieve that information in the
> >>> Page
> >>> and pass it around to the service, then to the dao to store it? Is
> there
> >>> no
> >>> way to access it directly from the dao?
> >>> The main reason is that i wanted to include to a BaseDao class, so all
> >>> my
> >>> daos will do the same thing while saving.
> >>>
> >>> Any ideas?
> >>> Thanks
> >>> Paolo
> >>>
> >>> --
> >>> View this message in context:
> >>> http://www.nabble.com/4.1.1-Session-issue-tf4028256.html#a11442438
> >>> Sent from the Tapestry - User mailing list archive at Nabble.com.
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>
> >>>
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/4.1.1-Session-issue-tf4028256.html#a11446920
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: 4.1.1 Session issue
Posted by Paolo Scopa <pa...@yahoo.com>.
Ok, I eventually did it.
I mached your solution with the post in
http://www.nabble.com/How-to-inject-ASO-in-service--tf1518378.html#a4141166
and it works fine
Thanks a lot
Paolo
Paolo Scopa wrote:
>
> Thanks for replying,
> I tried my best to understand what i should do, but im afraid i cant
> follow you.
> I never used ApplicationStateManager directly and i dont know where to
> find an example.
> Also i don't know where the lines you posted should be added.
>
> What i started from is something like
>
> <contribution configuration-id="tapestry.state.ApplicationObjects">
> <state-object name="sessionInfo" scope="session">
> <create-instance class="mypackage.SessionInfo"/>
> </state-object>
> </contribution>
>
> I can access this via getSessionInfo inside a page, as i said: but not in
> another class.
>
> Do you mean that i should create a new service that returns this object?
>
> Paolo
>
>
> Igor Drobiazko wrote:
>>
>> Hi,
>>
>> you can inject the ApplicationStateManager in your DAO and access your
>> ASO
>> by using it.
>>
>> http://tapestry.apache.org/tapestry4.1/apidocs/org/apache/tapestry/engine/state/ApplicationStateManager.html
>> http://tapestry.apache.org/tapestry4.1/tapestry-framework/hivedoc/service/tapestry.state.ApplicationStateManager.html
>>
>> Just add a field and the following line into your service construction:
>>
>> <set-service property="applicationStateManager"
>> service-id="tapestry.state.
>> ApplicationStateManager"/>
>> </construct>
>>
>> On 7/5/07, Paolo Scopa <pa...@yahoo.com> wrote:
>>>
>>>
>>> Hi experts,
>>> I have a bit of troule storing/retrieving info in the session.
>>>
>>> I followed the eshop example, adding a contribution in hivemind module
>>> to
>>> store the user name in the session.
>>> I want my dao to store this information every time that an object is
>>> updated
>>> in the database (the user who last changed the object).
>>>
>>> However I can't find a way to access the session from my dao, because to
>>> use
>>> @injectState I must make my dao abstract (and obviously it cant be).
>>> So it looks like I can access the session info only from a BasePage,
>>> which
>>> is actually abstract.
>>>
>>> My question is: do I really have to retrieve that information in the
>>> Page
>>> and pass it around to the service, then to the dao to store it? Is there
>>> no
>>> way to access it directly from the dao?
>>> The main reason is that i wanted to include to a BaseDao class, so all
>>> my
>>> daos will do the same thing while saving.
>>>
>>> Any ideas?
>>> Thanks
>>> Paolo
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/4.1.1-Session-issue-tf4028256.html#a11442438
>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/4.1.1-Session-issue-tf4028256.html#a11446920
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: 4.1.1 Session issue
Posted by Paolo Scopa <pa...@yahoo.com>.
Thanks for replying,
I tried my best to understand what i should do, but im afraid i cant follow
you.
I never used ApplicationStateManager directly and i dont know where to find
an example.
Also i don't know where the lines you posted should be added.
What i started from is something like
<contribution configuration-id="tapestry.state.ApplicationObjects">
<state-object name="sessionInfo" scope="session">
<create-instance class="mypackage.SessionInfo"/>
</state-object>
</contribution>
I can access this via getSessionInfo inside a page, as i said: but not in
another class.
Do you mean that i should create a new service that returns this object?
Paolo
Igor Drobiazko wrote:
>
> Hi,
>
> you can inject the ApplicationStateManager in your DAO and access your ASO
> by using it.
>
> http://tapestry.apache.org/tapestry4.1/apidocs/org/apache/tapestry/engine/state/ApplicationStateManager.html
> http://tapestry.apache.org/tapestry4.1/tapestry-framework/hivedoc/service/tapestry.state.ApplicationStateManager.html
>
> Just add a field and the following line into your service construction:
>
> <set-service property="applicationStateManager"
> service-id="tapestry.state.
> ApplicationStateManager"/>
> </construct>
>
> On 7/5/07, Paolo Scopa <pa...@yahoo.com> wrote:
>>
>>
>> Hi experts,
>> I have a bit of troule storing/retrieving info in the session.
>>
>> I followed the eshop example, adding a contribution in hivemind module to
>> store the user name in the session.
>> I want my dao to store this information every time that an object is
>> updated
>> in the database (the user who last changed the object).
>>
>> However I can't find a way to access the session from my dao, because to
>> use
>> @injectState I must make my dao abstract (and obviously it cant be).
>> So it looks like I can access the session info only from a BasePage,
>> which
>> is actually abstract.
>>
>> My question is: do I really have to retrieve that information in the Page
>> and pass it around to the service, then to the dao to store it? Is there
>> no
>> way to access it directly from the dao?
>> The main reason is that i wanted to include to a BaseDao class, so all my
>> daos will do the same thing while saving.
>>
>> Any ideas?
>> Thanks
>> Paolo
>>
>> --
>> View this message in context:
>> http://www.nabble.com/4.1.1-Session-issue-tf4028256.html#a11442438
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
--
View this message in context: http://www.nabble.com/4.1.1-Session-issue-tf4028256.html#a11446435
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: 4.1.1 Session issue
Posted by Igor Drobiazko <ig...@gmail.com>.
Hi,
you can inject the ApplicationStateManager in your DAO and access your ASO
by using it.
http://tapestry.apache.org/tapestry4.1/apidocs/org/apache/tapestry/engine/state/ApplicationStateManager.html
http://tapestry.apache.org/tapestry4.1/tapestry-framework/hivedoc/service/tapestry.state.ApplicationStateManager.html
Just add a field and the following line into your service construction:
<set-service property="applicationStateManager" service-id="tapestry.state.
ApplicationStateManager"/>
</construct>
On 7/5/07, Paolo Scopa <pa...@yahoo.com> wrote:
>
>
> Hi experts,
> I have a bit of troule storing/retrieving info in the session.
>
> I followed the eshop example, adding a contribution in hivemind module to
> store the user name in the session.
> I want my dao to store this information every time that an object is
> updated
> in the database (the user who last changed the object).
>
> However I can't find a way to access the session from my dao, because to
> use
> @injectState I must make my dao abstract (and obviously it cant be).
> So it looks like I can access the session info only from a BasePage, which
> is actually abstract.
>
> My question is: do I really have to retrieve that information in the Page
> and pass it around to the service, then to the dao to store it? Is there
> no
> way to access it directly from the dao?
> The main reason is that i wanted to include to a BaseDao class, so all my
> daos will do the same thing while saving.
>
> Any ideas?
> Thanks
> Paolo
>
> --
> View this message in context:
> http://www.nabble.com/4.1.1-Session-issue-tf4028256.html#a11442438
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>