Using Object#finalize() for this type of thing is generally NOT a good idea;
it may get called much later than you would "expect", if at all.

Regards - Cemal
http://jWeekend.co.uk


Nino.Martinez wrote:
> 
> Thanks for the example..
> 
> I just think it feels very weird to go around wicket in order to achieve 
> this, because the pojo I have are already attached to the wicket 
> session(so I would have double overhead for this). However it could be 
> the case that it's not simply possible from withing wicket. If not, it 
> would be practical to have a method that you could override on wicket 
> session called onBeforeCreate and onBeforeDestroy or something along 
> those lines. Could I use finalize for this?
> 
> 
> 
> sander v F wrote:
>> You could also use a HttpSessionListener for knowing when a session is
>> destroyed. The problem is indeed that you can't get the attributes when
>> the
>> session is invalidated, but you can get the sessionId. So you could use a
>> Map to register the session id with the Pojo you would like to update. So
>> when the session get's destroyed you can update the Pojo.
>>
>> See
>> http://www.stardeveloper.com/articles/display.html?article=2001112001&page=1for
>> an example with the HttpSessionListener.
>>
>>
>>
>>
>> 2008/4/16, Nino Saturnino Martinez Vazquez Wael
>> <[EMAIL PROTECTED]>:
>>   
>>> So what do you think?
>>>
>>> Im not sure how common a case this is ?
>>>
>>>
>>> regards Nino
>>>
>>> Nino Saturnino Martinez Vazquez Wael wrote:
>>>
>>>     
>>>> Hmm, that feels a bit hacky.. Then I'll need to implement a way of
>>>> tracking sessions, and I saw something about keeping references to
>>>> destroyed
>>>> sessions arent that great.
>>>>
>>>> It might be me that's just way of context(not knowing all of the
>>>> internals), but should something like this be easy todo in wicket?
>>>>
>>>> Like maybe have a onDestroy or onExpire(or both?) in session class?
>>>> However I have no idea on how much overhead this would bring to
>>>> applications
>>>> that does not use the feature.
>>>>
>>>>
>>>> regards Nino
>>>>
>>>> Johan Compagner wrote:
>>>>
>>>>       
>>>>> attached to a session of the session that is just invalided/expired?
>>>>> That wont work. You cant get to a http sessions attributes when it is
>>>>> invalidated.
>>>>>
>>>>> To know which session id's are destroyed:
>>>>>
>>>>> public void sessionDestroyed(String sessionId) of WebApplication
>>>>>
>>>>> johan
>>>>>
>>>>>
>>>>> On Tue, Apr 15, 2008 at 9:07 AM, Nino Saturnino Martinez Vazquez Wael
>>>>> <
>>>>> [EMAIL PROTECTED]> wrote:
>>>>>
>>>>>
>>>>>
>>>>>         
>>>>>> Hi
>>>>>>
>>>>>> I've checked a little around, but could not find anything directly.
>>>>>> This
>>>>>> is what I want todo:
>>>>>>
>>>>>> When a user either logs out or expire I want to update a pojo
>>>>>> attached to
>>>>>> session.
>>>>>>
>>>>>> So does anyone have an example on how todo this(if possible)?
>>>>>>
>>>>>> --
>>>>>> -Wicket for love
>>>>>>
>>>>>> Nino Martinez Wael
>>>>>> Java Specialist @ Jayway DK
>>>>>> http://www.jayway.dk
>>>>>> +45 2936 7684
>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>           
>>>>>
>>>>>         
>>>>       
>>> --
>>> -Wicket for love
>>>
>>> Nino Martinez Wael
>>> Java Specialist @ Jayway DK
>>> http://www.jayway.dk
>>> +45 2936 7684
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>     
>>
>>   
> 
> -- 
> -Wicket for love
> 
> Nino Martinez Wael
> Java Specialist @ Jayway DK
> http://www.jayway.dk
> +45 2936 7684
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Notification-on-session-destroyed--tp16696441p16719102.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to