Wicket、页面堆栈和内存使用情况 [英] Wicket, page stack, and memory usage

查看:33
本文介绍了Wicket、页面堆栈和内存使用情况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Wicket 应用程序序列化和缓存所有页面以支持有状态组件,以及支持后退按钮,以及其他可能的原因.我有一个应用程序,它使用 setResponsePage 在屏幕之间导航.在很短的时间内会话变得相当大,因为所有先前的页面都存储在会话中.在大多数情况下,出于显而易见的原因,我只需要会话包含当前页面,也许还有最后 2 或 3 个页面,以便使用浏览器的后退按钮轻松导航.

A Wicket application serializes and caches all pages to support stateful components, as well as for supporting the back button, among other possible reasons. I have an application which uses setResponsePage to navigate from screen to screen. Over a pretty short amount of time the session gets rather large because all of the prior pages are stored in the session. For the most part, I only need the session to contain the current page, for obvious reasons, and perhaps the last 2 or 3 pages to allow easy navigation using the browser's back button.

我可以在导航离开页面后强制使其过期,并且我知道我不想使用后退按钮返回到该版本的页面吗?更一般地说,在 Wicket 中处理会话增长的推荐方法是什么?

Can I force a page to expire after I have navigated away from it and I know that I don't want to use to back button to that version of the page? More generally what is the recommended way to deal with session growth in Wicket?

推荐答案

http://apache-wicket.1842946.n4.nabble.com/Wicket-Session-grows-too-big-real-fast-td1875816.html

如果您在页面上使用大量域对象,这些域对象最终会与其他域对象紧密耦合,请务必避免对这些对象进行序列化!

If you use loads of domain objects on your page, which are eventually tightly coupled to other domain objects, be sure to avoid serialization for these!

看看用于包装域对象的 LoadableDetachableModelDataView 和 IDataProvider 用于显示域对象列表

Have a look at LoadableDetachableModel for wrapping domaing objects DataView and IDataProvider for displaying list of domain objects

您不应将域对象填充到组件的实例变量中.为了在匿名子类中使用它们,您不应将域对象引用设为 final.您不应仅将域对象列表传递给 ListView.

Thou shalt not stuff domain objects into instance variables of components. Thou shalt not make domain object references final in order to use them in anonymous subclasses. Thou shalt not pass a mere List of domain objects to a ListView.

也许,在您的 Application 类中继承 WbeRequestCycle 时,您可能会在页面映射中获得对页面生命周期的控制......不过还没有尝试过

Perhaps, when subclassing WbeRequestCycle in your Application class, you might gain control of a page's lifetime in the pagemap... haven't tried it, though

这篇关于Wicket、页面堆栈和内存使用情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆