You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Stanczak Group <ju...@stanczakgroup.com> on 2006/03/29 18:43:41 UTC

Accessing a Session from a Service?

I have a IEngineService that I've created and I'd like to access the
login session session to check permissions. How do I do this?

I have to following config in hivemodule.xml.

This is the service I want to inject the session state object
login_session into:

<service-point id="fileDownloadService"
interface="org.apache.tapestry.engine.IEngineService">   
        <invoke-factory>
            <construct class="com.collegevitae.vitae.FileDownloadService">
                <set-object property="response"
value="infrastructure:response"/>
                <set-object property="linkFactory"
value="infrastructure:linkFactory"/>
                <set-object property="loginSession"
value="app-property:login_session"/>## This was what I added, but
returns null object.
            </construct>
        </invoke-factory>
    </service-point>


This is what I want access to for that users session:

<contribution configuration-id="tapestry.state.ApplicationObjects">
        <state-object name="login_session" scope="session">
            <create-instance class="com.collegevitae.LoginSession"/>
        </state-object> 
    </contribution>

-- 
Justin Stanczak
Stanczak Group
812-735-3600

"All that is necessary for the triumph of evil is that good men do nothing."
Edmund Burke

..________...............__.................
./  _____/..____..._____/..|_..____...____....
/...\..____/.__.\./....\...__\/.._.\./._..\....
\....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
.\______../\___.._\__|../__|..\____/.\____/......
........\/.....\/.....\/..........................


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


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


Re: Accessing a Session from a Service?

Posted by Martin Strand <ma...@entcap.se>.
This should be helpful:
http://www.mail-archive.com/tapestry-user@jakarta.apache.org/msg12250.html

I'm not sure, but I believe this approach instantiates the ASO even if it's not used (unlike @InjectState).

Martin

On Wed, 29 Mar 2006 18:43:41 +0200, Stanczak Group <ju...@stanczakgroup.com> wrote:

> I have a IEngineService that I've created and I'd like to access the
> login session session to check permissions. How do I do this?
>
> I have to following config in hivemodule.xml.
>
> This is the service I want to inject the session state object
> login_session into:
>
> <service-point id="fileDownloadService"
> interface="org.apache.tapestry.engine.IEngineService">
>         <invoke-factory>
>             <construct class="com.collegevitae.vitae.FileDownloadService">
>                 <set-object property="response"
> value="infrastructure:response"/>
>                 <set-object property="linkFactory"
> value="infrastructure:linkFactory"/>
>                 <set-object property="loginSession"
> value="app-property:login_session"/>## This was what I added, but
> returns null object.
>             </construct>
>         </invoke-factory>
>     </service-point>
>
>
> This is what I want access to for that users session:
>
> <contribution configuration-id="tapestry.state.ApplicationObjects">
>         <state-object name="login_session" scope="session">
>             <create-instance class="com.collegevitae.LoginSession"/>
>         </state-object>
>     </contribution>
>



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


RE: Accessing a Session from a Service?

Posted by James Carman <ja...@carmanconsulting.com>.
Yeah, you just have to make sure that it re-injects it for all scopes.  The
easiest way to do that would be to create a proxy which just delegates to
whatever object the ApplicationStateManager returns each time for that name.
But, proxying POJOs can be difficult (<shameless plug for own project>unless
you use Jakarta Commons Proxy</shameless plug for own project>).  

-----Original Message-----
From: Mike Snare [mailto:mikesnare@gmail.com] 
Sent: Thursday, March 30, 2006 8:30 AM
To: Tapestry users
Subject: Re: Accessing a Session from a Service?

That's what I've had to do when I wanted to inject an ASO into another
service.  Seems like a good enhancement request...

-Mike

On 3/30/06, James Carman <ja...@carmanconsulting.com> wrote:
> I couldn't find a way to do it, but I guess it'd be somewhat trivial to
> actually write a provider.
>
> -----Original Message-----
> From: Stanczak Group [mailto:justin@stanczakgroup.com]
> Sent: Wednesday, March 29, 2006 12:16 PM
> To: Tapestry users
> Subject: Re: Accessing a Session from a Service?
>
> No problem. Cool thanks. Is there not a way to just inject that object
> or is that now a good approach?
>
> James Carman wrote:
> > I apologize.  I only saw the first part of your hivemodule.xml stuff.
> Yeah,
> > that's an ASO alright! :-)  You can look it up via the
> > ApplicationStateManager.  Just provide a setter for an
> > ApplicationStateManager in your engine service and HiveMind will
autowire
> it
> > for you.  Then, you can look up your ASO by name.
> >
> >
> > -----Original Message-----
> > From: Stanczak Group [mailto:justin@stanczakgroup.com]
> > Sent: Wednesday, March 29, 2006 11:57 AM
> > To: Tapestry users
> > Subject: Re: Accessing a Session from a Service?
> >
> > Isn't that what I posted? Doesn't that make it an ASO?
> >
> > <contribution configuration-id="tapestry.state.ApplicationObjects">
> >         <state-object name="login_session" scope="session">
> >             <create-instance class="com.collegevitae.LoginSession"/>
> >         </state-object>
> >     </contribution>
> >
> >
> > James Carman wrote:
> >
> >> You can look up ASOs using the ApplicationStateManager.  Is your
> >> login_session an ASO?
> >>
> >> -----Original Message-----
> >> From: Stanczak Group [mailto:justin@stanczakgroup.com]
> >> Sent: Wednesday, March 29, 2006 11:44 AM
> >> To: Tapestry users
> >> Subject: Accessing a Session from a Service?
> >>
> >> I have a IEngineService that I've created and I'd like to access the
> >> login session session to check permissions. How do I do this?
> >>
> >> I have to following config in hivemodule.xml.
> >>
> >> This is the service I want to inject the session state object
> >> login_session into:
> >>
> >> <service-point id="fileDownloadService"
> >> interface="org.apache.tapestry.engine.IEngineService">
> >>         <invoke-factory>
> >>             <construct
> class="com.collegevitae.vitae.FileDownloadService">
> >>                 <set-object property="response"
> >> value="infrastructure:response"/>
> >>                 <set-object property="linkFactory"
> >> value="infrastructure:linkFactory"/>
> >>                 <set-object property="loginSession"
> >> value="app-property:login_session"/>## This was what I added, but
> >> returns null object.
> >>             </construct>
> >>         </invoke-factory>
> >>     </service-point>
> >>
> >>
> >> This is what I want access to for that users session:
> >>
> >> <contribution configuration-id="tapestry.state.ApplicationObjects">
> >>         <state-object name="login_session" scope="session">
> >>             <create-instance class="com.collegevitae.LoginSession"/>
> >>         </state-object>
> >>     </contribution>
> >>
> >>
> >>
> >
> >
>
> --
> Justin Stanczak
> Stanczak Group
> 812-735-3600
>
> "All that is necessary for the triumph of evil is that good men do
nothing."
> Edmund Burke
>
> ..________...............__.................
> ./  _____/..____..._____/..|_..____...____....
> /...\..____/.__.\./....\...__\/.._.\./._..\....
> \....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
> .\______../\___.._\__|../__|..\____/.\____/......
> ........\/.....\/.....\/..........................
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>
> ---------------------------------------------------------------------
> 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: Accessing a Session from a Service?

Posted by Mike Snare <mi...@gmail.com>.
That's what I've had to do when I wanted to inject an ASO into another
service.  Seems like a good enhancement request...

-Mike

On 3/30/06, James Carman <ja...@carmanconsulting.com> wrote:
> I couldn't find a way to do it, but I guess it'd be somewhat trivial to
> actually write a provider.
>
> -----Original Message-----
> From: Stanczak Group [mailto:justin@stanczakgroup.com]
> Sent: Wednesday, March 29, 2006 12:16 PM
> To: Tapestry users
> Subject: Re: Accessing a Session from a Service?
>
> No problem. Cool thanks. Is there not a way to just inject that object
> or is that now a good approach?
>
> James Carman wrote:
> > I apologize.  I only saw the first part of your hivemodule.xml stuff.
> Yeah,
> > that's an ASO alright! :-)  You can look it up via the
> > ApplicationStateManager.  Just provide a setter for an
> > ApplicationStateManager in your engine service and HiveMind will autowire
> it
> > for you.  Then, you can look up your ASO by name.
> >
> >
> > -----Original Message-----
> > From: Stanczak Group [mailto:justin@stanczakgroup.com]
> > Sent: Wednesday, March 29, 2006 11:57 AM
> > To: Tapestry users
> > Subject: Re: Accessing a Session from a Service?
> >
> > Isn't that what I posted? Doesn't that make it an ASO?
> >
> > <contribution configuration-id="tapestry.state.ApplicationObjects">
> >         <state-object name="login_session" scope="session">
> >             <create-instance class="com.collegevitae.LoginSession"/>
> >         </state-object>
> >     </contribution>
> >
> >
> > James Carman wrote:
> >
> >> You can look up ASOs using the ApplicationStateManager.  Is your
> >> login_session an ASO?
> >>
> >> -----Original Message-----
> >> From: Stanczak Group [mailto:justin@stanczakgroup.com]
> >> Sent: Wednesday, March 29, 2006 11:44 AM
> >> To: Tapestry users
> >> Subject: Accessing a Session from a Service?
> >>
> >> I have a IEngineService that I've created and I'd like to access the
> >> login session session to check permissions. How do I do this?
> >>
> >> I have to following config in hivemodule.xml.
> >>
> >> This is the service I want to inject the session state object
> >> login_session into:
> >>
> >> <service-point id="fileDownloadService"
> >> interface="org.apache.tapestry.engine.IEngineService">
> >>         <invoke-factory>
> >>             <construct
> class="com.collegevitae.vitae.FileDownloadService">
> >>                 <set-object property="response"
> >> value="infrastructure:response"/>
> >>                 <set-object property="linkFactory"
> >> value="infrastructure:linkFactory"/>
> >>                 <set-object property="loginSession"
> >> value="app-property:login_session"/>## This was what I added, but
> >> returns null object.
> >>             </construct>
> >>         </invoke-factory>
> >>     </service-point>
> >>
> >>
> >> This is what I want access to for that users session:
> >>
> >> <contribution configuration-id="tapestry.state.ApplicationObjects">
> >>         <state-object name="login_session" scope="session">
> >>             <create-instance class="com.collegevitae.LoginSession"/>
> >>         </state-object>
> >>     </contribution>
> >>
> >>
> >>
> >
> >
>
> --
> Justin Stanczak
> Stanczak Group
> 812-735-3600
>
> "All that is necessary for the triumph of evil is that good men do nothing."
> Edmund Burke
>
> ..________...............__.................
> ./  _____/..____..._____/..|_..____...____....
> /...\..____/.__.\./....\...__\/.._.\./._..\....
> \....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
> .\______../\___.._\__|../__|..\____/.\____/......
> ........\/.....\/.....\/..........................
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>
> ---------------------------------------------------------------------
> 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: Accessing a Session from a Service?

Posted by James Carman <ja...@carmanconsulting.com>.
I couldn't find a way to do it, but I guess it'd be somewhat trivial to
actually write a provider.

-----Original Message-----
From: Stanczak Group [mailto:justin@stanczakgroup.com] 
Sent: Wednesday, March 29, 2006 12:16 PM
To: Tapestry users
Subject: Re: Accessing a Session from a Service?

No problem. Cool thanks. Is there not a way to just inject that object
or is that now a good approach?

James Carman wrote:
> I apologize.  I only saw the first part of your hivemodule.xml stuff.
Yeah,
> that's an ASO alright! :-)  You can look it up via the
> ApplicationStateManager.  Just provide a setter for an
> ApplicationStateManager in your engine service and HiveMind will autowire
it
> for you.  Then, you can look up your ASO by name.
>
>
> -----Original Message-----
> From: Stanczak Group [mailto:justin@stanczakgroup.com] 
> Sent: Wednesday, March 29, 2006 11:57 AM
> To: Tapestry users
> Subject: Re: Accessing a Session from a Service?
>
> Isn't that what I posted? Doesn't that make it an ASO?
>
> <contribution configuration-id="tapestry.state.ApplicationObjects">
>         <state-object name="login_session" scope="session">
>             <create-instance class="com.collegevitae.LoginSession"/>
>         </state-object> 
>     </contribution>
>
>
> James Carman wrote:
>   
>> You can look up ASOs using the ApplicationStateManager.  Is your
>> login_session an ASO?
>>
>> -----Original Message-----
>> From: Stanczak Group [mailto:justin@stanczakgroup.com] 
>> Sent: Wednesday, March 29, 2006 11:44 AM
>> To: Tapestry users
>> Subject: Accessing a Session from a Service?
>>
>> I have a IEngineService that I've created and I'd like to access the
>> login session session to check permissions. How do I do this?
>>
>> I have to following config in hivemodule.xml.
>>
>> This is the service I want to inject the session state object
>> login_session into:
>>
>> <service-point id="fileDownloadService"
>> interface="org.apache.tapestry.engine.IEngineService">   
>>         <invoke-factory>
>>             <construct
class="com.collegevitae.vitae.FileDownloadService">
>>                 <set-object property="response"
>> value="infrastructure:response"/>
>>                 <set-object property="linkFactory"
>> value="infrastructure:linkFactory"/>
>>                 <set-object property="loginSession"
>> value="app-property:login_session"/>## This was what I added, but
>> returns null object.
>>             </construct>
>>         </invoke-factory>
>>     </service-point>
>>
>>
>> This is what I want access to for that users session:
>>
>> <contribution configuration-id="tapestry.state.ApplicationObjects">
>>         <state-object name="login_session" scope="session">
>>             <create-instance class="com.collegevitae.LoginSession"/>
>>         </state-object> 
>>     </contribution>
>>
>>   
>>     
>
>   

-- 
Justin Stanczak
Stanczak Group
812-735-3600

"All that is necessary for the triumph of evil is that good men do nothing."
Edmund Burke

..________...............__.................
./  _____/..____..._____/..|_..____...____....
/...\..____/.__.\./....\...__\/.._.\./._..\....
\....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
.\______../\___.._\__|../__|..\____/.\____/......
........\/.....\/.....\/..........................


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


---------------------------------------------------------------------
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: Accessing a Session from a Service?

Posted by Stanczak Group <ju...@stanczakgroup.com>.
No problem. Cool thanks. Is there not a way to just inject that object
or is that now a good approach?

James Carman wrote:
> I apologize.  I only saw the first part of your hivemodule.xml stuff.  Yeah,
> that's an ASO alright! :-)  You can look it up via the
> ApplicationStateManager.  Just provide a setter for an
> ApplicationStateManager in your engine service and HiveMind will autowire it
> for you.  Then, you can look up your ASO by name.
>
>
> -----Original Message-----
> From: Stanczak Group [mailto:justin@stanczakgroup.com] 
> Sent: Wednesday, March 29, 2006 11:57 AM
> To: Tapestry users
> Subject: Re: Accessing a Session from a Service?
>
> Isn't that what I posted? Doesn't that make it an ASO?
>
> <contribution configuration-id="tapestry.state.ApplicationObjects">
>         <state-object name="login_session" scope="session">
>             <create-instance class="com.collegevitae.LoginSession"/>
>         </state-object> 
>     </contribution>
>
>
> James Carman wrote:
>   
>> You can look up ASOs using the ApplicationStateManager.  Is your
>> login_session an ASO?
>>
>> -----Original Message-----
>> From: Stanczak Group [mailto:justin@stanczakgroup.com] 
>> Sent: Wednesday, March 29, 2006 11:44 AM
>> To: Tapestry users
>> Subject: Accessing a Session from a Service?
>>
>> I have a IEngineService that I've created and I'd like to access the
>> login session session to check permissions. How do I do this?
>>
>> I have to following config in hivemodule.xml.
>>
>> This is the service I want to inject the session state object
>> login_session into:
>>
>> <service-point id="fileDownloadService"
>> interface="org.apache.tapestry.engine.IEngineService">   
>>         <invoke-factory>
>>             <construct class="com.collegevitae.vitae.FileDownloadService">
>>                 <set-object property="response"
>> value="infrastructure:response"/>
>>                 <set-object property="linkFactory"
>> value="infrastructure:linkFactory"/>
>>                 <set-object property="loginSession"
>> value="app-property:login_session"/>## This was what I added, but
>> returns null object.
>>             </construct>
>>         </invoke-factory>
>>     </service-point>
>>
>>
>> This is what I want access to for that users session:
>>
>> <contribution configuration-id="tapestry.state.ApplicationObjects">
>>         <state-object name="login_session" scope="session">
>>             <create-instance class="com.collegevitae.LoginSession"/>
>>         </state-object> 
>>     </contribution>
>>
>>   
>>     
>
>   

-- 
Justin Stanczak
Stanczak Group
812-735-3600

"All that is necessary for the triumph of evil is that good men do nothing."
Edmund Burke

..________...............__.................
./  _____/..____..._____/..|_..____...____....
/...\..____/.__.\./....\...__\/.._.\./._..\....
\....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
.\______../\___.._\__|../__|..\____/.\____/......
........\/.....\/.....\/..........................


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


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


RE: Accessing a Session from a Service?

Posted by James Carman <ja...@carmanconsulting.com>.
I apologize.  I only saw the first part of your hivemodule.xml stuff.  Yeah,
that's an ASO alright! :-)  You can look it up via the
ApplicationStateManager.  Just provide a setter for an
ApplicationStateManager in your engine service and HiveMind will autowire it
for you.  Then, you can look up your ASO by name.


-----Original Message-----
From: Stanczak Group [mailto:justin@stanczakgroup.com] 
Sent: Wednesday, March 29, 2006 11:57 AM
To: Tapestry users
Subject: Re: Accessing a Session from a Service?

Isn't that what I posted? Doesn't that make it an ASO?

<contribution configuration-id="tapestry.state.ApplicationObjects">
        <state-object name="login_session" scope="session">
            <create-instance class="com.collegevitae.LoginSession"/>
        </state-object> 
    </contribution>


James Carman wrote:
> You can look up ASOs using the ApplicationStateManager.  Is your
> login_session an ASO?
>
> -----Original Message-----
> From: Stanczak Group [mailto:justin@stanczakgroup.com] 
> Sent: Wednesday, March 29, 2006 11:44 AM
> To: Tapestry users
> Subject: Accessing a Session from a Service?
>
> I have a IEngineService that I've created and I'd like to access the
> login session session to check permissions. How do I do this?
>
> I have to following config in hivemodule.xml.
>
> This is the service I want to inject the session state object
> login_session into:
>
> <service-point id="fileDownloadService"
> interface="org.apache.tapestry.engine.IEngineService">   
>         <invoke-factory>
>             <construct class="com.collegevitae.vitae.FileDownloadService">
>                 <set-object property="response"
> value="infrastructure:response"/>
>                 <set-object property="linkFactory"
> value="infrastructure:linkFactory"/>
>                 <set-object property="loginSession"
> value="app-property:login_session"/>## This was what I added, but
> returns null object.
>             </construct>
>         </invoke-factory>
>     </service-point>
>
>
> This is what I want access to for that users session:
>
> <contribution configuration-id="tapestry.state.ApplicationObjects">
>         <state-object name="login_session" scope="session">
>             <create-instance class="com.collegevitae.LoginSession"/>
>         </state-object> 
>     </contribution>
>
>   

-- 
Justin Stanczak
Stanczak Group
812-735-3600

"All that is necessary for the triumph of evil is that good men do nothing."
Edmund Burke

..________...............__.................
./  _____/..____..._____/..|_..____...____....
/...\..____/.__.\./....\...__\/.._.\./._..\....
\....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
.\______../\___.._\__|../__|..\____/.\____/......
........\/.....\/.....\/..........................


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


---------------------------------------------------------------------
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: Accessing a Session from a Service?

Posted by Stanczak Group <ju...@stanczakgroup.com>.
Isn't that what I posted? Doesn't that make it an ASO?

<contribution configuration-id="tapestry.state.ApplicationObjects">
        <state-object name="login_session" scope="session">
            <create-instance class="com.collegevitae.LoginSession"/>
        </state-object> 
    </contribution>


James Carman wrote:
> You can look up ASOs using the ApplicationStateManager.  Is your
> login_session an ASO?
>
> -----Original Message-----
> From: Stanczak Group [mailto:justin@stanczakgroup.com] 
> Sent: Wednesday, March 29, 2006 11:44 AM
> To: Tapestry users
> Subject: Accessing a Session from a Service?
>
> I have a IEngineService that I've created and I'd like to access the
> login session session to check permissions. How do I do this?
>
> I have to following config in hivemodule.xml.
>
> This is the service I want to inject the session state object
> login_session into:
>
> <service-point id="fileDownloadService"
> interface="org.apache.tapestry.engine.IEngineService">   
>         <invoke-factory>
>             <construct class="com.collegevitae.vitae.FileDownloadService">
>                 <set-object property="response"
> value="infrastructure:response"/>
>                 <set-object property="linkFactory"
> value="infrastructure:linkFactory"/>
>                 <set-object property="loginSession"
> value="app-property:login_session"/>## This was what I added, but
> returns null object.
>             </construct>
>         </invoke-factory>
>     </service-point>
>
>
> This is what I want access to for that users session:
>
> <contribution configuration-id="tapestry.state.ApplicationObjects">
>         <state-object name="login_session" scope="session">
>             <create-instance class="com.collegevitae.LoginSession"/>
>         </state-object> 
>     </contribution>
>
>   

-- 
Justin Stanczak
Stanczak Group
812-735-3600

"All that is necessary for the triumph of evil is that good men do nothing."
Edmund Burke

..________...............__.................
./  _____/..____..._____/..|_..____...____....
/...\..____/.__.\./....\...__\/.._.\./._..\....
\....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
.\______../\___.._\__|../__|..\____/.\____/......
........\/.....\/.....\/..........................


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


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


RE: Accessing a Session from a Service?

Posted by James Carman <ja...@carmanconsulting.com>.
You can look up ASOs using the ApplicationStateManager.  Is your
login_session an ASO?

-----Original Message-----
From: Stanczak Group [mailto:justin@stanczakgroup.com] 
Sent: Wednesday, March 29, 2006 11:44 AM
To: Tapestry users
Subject: Accessing a Session from a Service?

I have a IEngineService that I've created and I'd like to access the
login session session to check permissions. How do I do this?

I have to following config in hivemodule.xml.

This is the service I want to inject the session state object
login_session into:

<service-point id="fileDownloadService"
interface="org.apache.tapestry.engine.IEngineService">   
        <invoke-factory>
            <construct class="com.collegevitae.vitae.FileDownloadService">
                <set-object property="response"
value="infrastructure:response"/>
                <set-object property="linkFactory"
value="infrastructure:linkFactory"/>
                <set-object property="loginSession"
value="app-property:login_session"/>## This was what I added, but
returns null object.
            </construct>
        </invoke-factory>
    </service-point>


This is what I want access to for that users session:

<contribution configuration-id="tapestry.state.ApplicationObjects">
        <state-object name="login_session" scope="session">
            <create-instance class="com.collegevitae.LoginSession"/>
        </state-object> 
    </contribution>

-- 
Justin Stanczak
Stanczak Group
812-735-3600

"All that is necessary for the triumph of evil is that good men do nothing."
Edmund Burke

..________...............__.................
./  _____/..____..._____/..|_..____...____....
/...\..____/.__.\./....\...__\/.._.\./._..\....
\....\_\..\..___/|...|..\..|.(..<_>.|.<_>..)....
.\______../\___.._\__|../__|..\____/.\____/......
........\/.....\/.....\/..........................


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


---------------------------------------------------------------------
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