Detach Model Objects when user leaves page

2012-06-14 Thread brazz
Hi,

i have a list view with content from a Repository that is input to a
wicket DataProvider with ModelObject. 
I get the content of the repository from a webservice. 
I don't want to load the data from the webservice after each request, but
the model gets detached after each request and accordingly my Repository
(which is connected to the webservice) is empty after each request (because
its objects are set to null in the detachment process).

Now, is there a way to influence a LoadableDetachableModel in a way that it
gets detached after the user leaves the page/accesses another page. I tried
to overwrite the detach-method but without success.

As a workaround i'm using the session to store my repository but then i
don't have an indication when the data isn't needed any more. I think about
time based expiration of session data (time based cache mechanism like in
guava library), but i think this is rather cumbersome. Detaching the model
object after the user leaves the page would be more elegant.

Thanks for any suggestions or hints how you fixed this scenario.




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Detach-Model-Objects-when-user-leaves-page-tp4649977.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Detach Model Objects when user leaves page

2012-06-14 Thread Thomas Götz
How would you notice if the user leaves the page? If you have only Wicket 
controlled Links on your page then you could null your Repository data in 
their onclick() implementation (if you do a setResponsePage(someOtherPage).
If there's also non-Wicket links on your page, well, you would probably have to 
use some JS magic (+ AJAX) to react upon page leave event. I don't like either 
of those solutions but would prefer a cache including expiry strategy instead. 
About how much data are we talking here? Isn't it possible to do some kind of 
paging or do you need to fetch the whole dataset?

   -Tom



On 14.06.2012 at 16:57 brazz wrote:

 Hi,
 
 i have a list view with content from a Repository that is input to a
 wicket DataProvider with ModelObject. 
 I get the content of the repository from a webservice. 
 I don't want to load the data from the webservice after each request, but
 the model gets detached after each request and accordingly my Repository
 (which is connected to the webservice) is empty after each request (because
 its objects are set to null in the detachment process).
 
 Now, is there a way to influence a LoadableDetachableModel in a way that it
 gets detached after the user leaves the page/accesses another page. I tried
 to overwrite the detach-method but without success.
 
 As a workaround i'm using the session to store my repository but then i
 don't have an indication when the data isn't needed any more. I think about
 time based expiration of session data (time based cache mechanism like in
 guava library), but i think this is rather cumbersome. Detaching the model
 object after the user leaves the page would be more elegant.
 
 Thanks for any suggestions or hints how you fixed this scenario.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Detach Model Objects when user leaves page

2012-06-14 Thread brazz
Hi Thomas,

thanks for your reply. Data is not that much, but i think it's no good
practice to have data in memory that is not used any more. So i'd like to
have a general solution to this. 

Your right, the user could leave the page by any means. But for me it would
be enough to discard the data when the user goes to one of my (other) wicket
pages. Maybe i should have a look at the seam framework which adresses
conversation scope...

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Detach-Model-Objects-when-user-leaves-page-tp4649977p4649982.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Detach Model Objects when user leaves page

2012-06-14 Thread brazz
Thanks for the link! 

I think i will give this one a try:
https://www.42lines.net/2011/11/15/integrating-cdi-into-wicket/



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Detach-Model-Objects-when-user-leaves-page-tp4649977p4649990.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org