Hi Peter,
having read through your post several times now, I think I misunderstood the
point you were referring to. Just to make sure that I did get it right this
time, please take a look at the following exampe:
@ApplicationState
private ShopOrder _order;
Object onActivate {
if(_order.getCustomer()==null) <----
do something;
}
Was it that, you were talking about? Checking for a member of the ASO rather
than the whole ASO itself? Or is there something else magic that I have missed?
A slight disadvantage in that approach would be that by calling the
getCustomer()-Method on the ASO a new instance is created immediately even if
you do not need it. Wheras by checking just the ASOExistence nothing is
created. So I still encourage to check for ASOExistence. Especially if you take
in consideration Stephane´s usecase (session expiration). I would therefore
rewrite the code to the following:
@ApplicationState
private ShopOrder _order;
private boolean _orderExists;
Object onActivate {
if( !_orderExists) <----
do something;
}
Hope I did get it this time. If not please do not hesitate to correct me.
Cheers nillehammer
----- original Nachricht --------
Betreff: Re: T5 : session timeout
Gesendet: Do, 10. Apr 2008
Von: Peter Stavrinides<[EMAIL PROTECTED]>
>
> Hello Nille
>
> I think you are confused here, the check we are referring to is for a
> data object within an ASO and not for the ASO.
>
>
> nille hammer wrote:
> > Hello Peter, hello Stephane,
> >
> > according to Tapestry manual
> (http://tapestry.apache.org/tapestry5/tapestry-core/guide/appstate.html) the
> preferred way to check for ASO existence is to provide a boolean variable
> with the name of the ASO field suffixed Exists alongside with your
> ASO-variable (e.g. private MyAso myState; private boolean myStateExists).
> >
> > Stepane, you´re right. I have found myself copying the same check for
> existence of an ASO into several onActivate-methods. As those pages extend
> an AbstractPage-class in the base package, I´ll try to move the check there
> and come back with results this evening.
> >
> > Greetz nillehammer
> >
> > ----- original Nachricht --------
> >
> > Betreff: Re: T5 : session timeout
> > Gesendet: Do, 10. Apr 2008
> > Von: Peter Stavrinides<[EMAIL PROTECTED]>
> >
> >
> >> Hi Stephane
> >>
> >> One approach is to store this data transiently in an ASO. (This data
> >> object needs to be serializable though, but using soft references works
> >> great). In your getter method be sure to check if its null and if so
> >> reinitialize it)... Inject the ASO in your pages and never worry about
> >> data activation in pages. This is the real value of IoC. However, bear
> >> in mind when using persisted data if it becomes large, it gets expensive
>
> >> to carry around in a high volume application, so you loose scalability.
> >>
> >> Stephane Decleire wrote:
> >>
> >>> Hi,
> >>>
> >>> I would like to know how do you handle session timeout with T5 or if
> >>> there is a "design pattern" for this case.
> >>> When a session timeout occurs, a lot of pages won't work because of a
> >>> lack of data (for example, normaly setted before returning the page).
> >>> So i need to write a piece of code in the activation event of almost
> >>> of my pages. In T4, i would have writen it in a parent page and would
> >>> have subclassed all the pages from it. In T5 should i consider writing
> >>> a mixin or something else ?
> >>>
> >>> Thanks in advance.
> >>>
> >>> Stephane
> >>>
> >>>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >>
> >
> > --- original Nachricht Ende ----
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--- original Nachricht Ende ----
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]