开发者

Custom Scoped Bean JSF 2.0

开发者_开发知识库Hi I have a bean and I want to define it as a CustomScoped Bean based on time, I mean I want to destroy the bean after a specific period of idle time. I mean if the user is not working with his/her own instance of the bean, the bean should be destroyed. Yes, each user needs to have its own instance, so it will be a kind of SessionScoped Bean which will be removed from Session after a while...


This blog entry of the JSF 2.0 lead developer Ryan Lubke contains an example in flavor of a WAR.


If you can use CDI (JSR-299), you could use the Conversation Scope, make it long lived, and set the conversation timeout to your desired value. This would save you from having to write your own custom scope. As an added bonus, you get all the other great things that come with CDI.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜