You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Chris Conrad <cc...@vasoftware.com> on 2005/06/15 07:03:18 UTC

Tapestry 4 ASO question

I was wondering if there is a way to specify that my ASOs should be  
set to null by default instead of Tapestry creating a new instance?   
I'd like to use an ASO to store logged in user information.  If  
getUser() returns null then I know the user isn't logged in.  Instead  
I need to do getUser.getId() == 0 which works, but doesn't feel as  
clean as doing a null check.

--Chris


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


Re: Tapestry 4 ASO question

Posted by Howard Lewis Ship <hl...@gmail.com>.
Application State Object.  The generalization of "visit" and "global" in 4.0.

On 6/15/05, Erik Hatcher <er...@ehatchersolutions.com> wrote:
> What is an "ASO"?
> 
> 
> On Jun 15, 2005, at 1:03 AM, Chris Conrad wrote:
> 
> > I was wondering if there is a way to specify that my ASOs should be
> > set to null by default instead of Tapestry creating a new
> > instance?  I'd like to use an ASO to store logged in user
> > information.  If getUser() returns null then I know the user isn't
> > logged in.  Instead I need to do getUser.getId() == 0 which works,
> > but doesn't feel as clean as doing a null check.
> >
> > --Chris
> >
> >
> > ---------------------------------------------------------------------
> > 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
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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


Re: Tapestry 4 ASO question

Posted by Hugo Palma <hp...@digitalis.pt>.
I think Chris is refering to Application State Objects, right Chris ?
Anyway, i don't think that what you are saying is possible(although i 
never really tried doing that). What i usually do for implementing a 
functionality similar to what you want is adding a property "user" to 
the visit ASO. Before the user logs in that property is always null so 
you can check if a user is logged by a /getVisit().getUser() == null 
/statement. You can simplofy this even further by implementing in you 
base class a method like:

boolean isUserLogged()
{
    return getVisit().getUser() != null;
}


Hope this helped.

Cheers

Hugo


Erik Hatcher wrote:

> What is an "ASO"?
>
>
> On Jun 15, 2005, at 1:03 AM, Chris Conrad wrote:
>
>> I was wondering if there is a way to specify that my ASOs should be  
>> set to null by default instead of Tapestry creating a new  instance?  
>> I'd like to use an ASO to store logged in user  information.  If 
>> getUser() returns null then I know the user isn't  logged in.  
>> Instead I need to do getUser.getId() == 0 which works,  but doesn't 
>> feel as clean as doing a null check.
>>
>> --Chris
>>
>>
>> ---------------------------------------------------------------------
>> 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: Tapestry 4 ASO question

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
What is an "ASO"?


On Jun 15, 2005, at 1:03 AM, Chris Conrad wrote:

> I was wondering if there is a way to specify that my ASOs should be  
> set to null by default instead of Tapestry creating a new  
> instance?  I'd like to use an ASO to store logged in user  
> information.  If getUser() returns null then I know the user isn't  
> logged in.  Instead I need to do getUser.getId() == 0 which works,  
> but doesn't feel as clean as doing a null check.
>
> --Chris
>
>
> ---------------------------------------------------------------------
> 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: Tapestry 4 ASO question

Posted by Howard Lewis Ship <hl...@gmail.com>.
Defer by one level; the ASO can be an Authentication object with a
user property that starts null.

<inject property="authentication" type="state" object="authentiation"/>

ognl:authentication.user == null

On 6/15/05, Chris Conrad <cc...@vasoftware.com> wrote:
> I was wondering if there is a way to specify that my ASOs should be
> set to null by default instead of Tapestry creating a new instance?
> I'd like to use an ASO to store logged in user information.  If
> getUser() returns null then I know the user isn't logged in.  Instead
> I need to do getUser.getId() == 0 which works, but doesn't feel as
> clean as doing a null check.
> 
> --Chris
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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