You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jean-Eric Cuendet <je...@rptec.ch> on 2006/02/27 23:08:49 UTC

Getting session state from within a Tapestry service

Hi,
I need to get the session state from a Typestry service (from the
servoce() method)
Is there a way to do it? I'm unable to find any...
Thanks a lot
-jec



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Getting session state from within a Tapestry service

Posted by Raul Raja Martinez <do...@estudiowebs.com>.
This is how you inject the ApplicationStateManager, it gets autowired by 
hivemind.

private ApplicationStateManager appStateManager;

public void setAppStateManager(ApplicationStateManager manager) {
  appStateManager = manager;
}

ApplicationObject getSessionData() {
     return appStateManager.get("sessionDataId"); //the id is the id of 
the ASO declared in your hivemodule.xml
}

James Carman wrote:
> Yes, there's an tapestry.state.ApplicationStateManager service in the
> registry from which you can do:
> 
> SessionData sessionData = ( SessionData )applicationStateManager.get(
> "session-data" );
> 
> Of course, you'd use whatever name you used to register the state object.
> 
> -----Original Message-----
> From: Jean-Eric Cuendet [mailto:jec@rptec.ch] 
> Sent: Tuesday, February 28, 2006 5:24 AM
> To: Tapestry users
> Subject: Re: Getting session state from within a Tapestry service
> 
> Thanks, but what I need is the State object from hivemind.
> Is it possible to get my SessionData object from hivemind through the 
> getSession().getID() from WebRequest?
> Or is there another way?
> 
> I tried @InjectState("sessionData") but that is not possible in a Service.
> -jec
> 
> Daniel Lydiard wrote:
>> @InjectObject("infrastructure:request")
>> public abstract WebRequest getRequest();
>>
>>
>> getRequest().getSession()
>>
>>
> http://jakarta.apache.org/tapestry/tapestry/apidocs/org/apache/tapestry/web/
> WebRequest.html 
>>
>>
>> ----- Original Message ----- From: "Jean-Eric Cuendet" <je...@rptec.ch>
>> To: <ta...@jakarta.apache.org>
>> Sent: Monday, February 27, 2006 2:08 PM
>> Subject: Getting session state from within a Tapestry service
>>
>>
>>> Hi,
>>> I need to get the session state from a Typestry service (from the
>>> servoce() method)
>>> Is there a way to do it? I'm unable to find any...
>>> Thanks a lot
>>> -jec
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: Getting session state from within a Tapestry service

Posted by James Carman <ja...@carmanconsulting.com>.
Yes, there's an tapestry.state.ApplicationStateManager service in the
registry from which you can do:

SessionData sessionData = ( SessionData )applicationStateManager.get(
"session-data" );

Of course, you'd use whatever name you used to register the state object.

-----Original Message-----
From: Jean-Eric Cuendet [mailto:jec@rptec.ch] 
Sent: Tuesday, February 28, 2006 5:24 AM
To: Tapestry users
Subject: Re: Getting session state from within a Tapestry service

Thanks, but what I need is the State object from hivemind.
Is it possible to get my SessionData object from hivemind through the 
getSession().getID() from WebRequest?
Or is there another way?

I tried @InjectState("sessionData") but that is not possible in a Service.
-jec

Daniel Lydiard wrote:
> @InjectObject("infrastructure:request")
> public abstract WebRequest getRequest();
> 
> 
> getRequest().getSession()
> 
>
http://jakarta.apache.org/tapestry/tapestry/apidocs/org/apache/tapestry/web/
WebRequest.html 
> 
> 
> 
> ----- Original Message ----- From: "Jean-Eric Cuendet" <je...@rptec.ch>
> To: <ta...@jakarta.apache.org>
> Sent: Monday, February 27, 2006 2:08 PM
> Subject: Getting session state from within a Tapestry service
> 
> 
>> Hi,
>> I need to get the session state from a Typestry service (from the
>> servoce() method)
>> Is there a way to do it? I'm unable to find any...
>> Thanks a lot
>> -jec
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Getting session state from within a Tapestry service

Posted by Jean-Eric Cuendet <je...@rptec.ch>.
Thanks, but what I need is the State object from hivemind.
Is it possible to get my SessionData object from hivemind through the 
getSession().getID() from WebRequest?
Or is there another way?

I tried @InjectState("sessionData") but that is not possible in a Service.
-jec

Daniel Lydiard wrote:
> @InjectObject("infrastructure:request")
> public abstract WebRequest getRequest();
> 
> 
> getRequest().getSession()
> 
> http://jakarta.apache.org/tapestry/tapestry/apidocs/org/apache/tapestry/web/WebRequest.html 
> 
> 
> 
> ----- Original Message ----- From: "Jean-Eric Cuendet" <je...@rptec.ch>
> To: <ta...@jakarta.apache.org>
> Sent: Monday, February 27, 2006 2:08 PM
> Subject: Getting session state from within a Tapestry service
> 
> 
>> Hi,
>> I need to get the session state from a Typestry service (from the
>> servoce() method)
>> Is there a way to do it? I'm unable to find any...
>> Thanks a lot
>> -jec
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Getting session state from within a Tapestry service

Posted by Daniel Lydiard <dl...@hotmail.com>.
@InjectObject("infrastructure:request")
public abstract WebRequest getRequest();


getRequest().getSession()

http://jakarta.apache.org/tapestry/tapestry/apidocs/org/apache/tapestry/web/WebRequest.html


----- Original Message ----- 
From: "Jean-Eric Cuendet" <je...@rptec.ch>
To: <ta...@jakarta.apache.org>
Sent: Monday, February 27, 2006 2:08 PM
Subject: Getting session state from within a Tapestry service


> Hi,
> I need to get the session state from a Typestry service (from the
> servoce() method)
> Is there a way to do it? I'm unable to find any...
> Thanks a lot
> -jec
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org