By default the value for the Persist annotation is the empty string. When this is true, then the actual strategy to be used is determined by a search up the component hiearchy.
For each component, the meta-data property tapestry.persistence-strategy is checked. This can be specified using the Meta annotation.
If the value is non-blank, then that strategy is used. This allows a component to control the persistence strategy used inside any sub-components (that don't explicitly use a different strategy).
In any case, if no component provides the meta data, then the ultimate default, "session", is used.
If you reach a point where you know that all data for a page can be discarded, you can do exactly that.
The method discardPersistentFieldChanges() of ComponentResources will discard all persistent fields for the page, regardless of which strategy is used to store the property. This will not affect the page in memory, but takes effect for subsequent requests.
The Servlet API was designed with the intention that there would be only a modest amount of server-side state, and that the stored values would be individual numbers and strings, and thus, immutable.
Many web frameworks do not use the HttpSession this way, and store large and mutable objects in the session.
This is not an issue for single servers, but in a cluster, anything stored in the session must be serialized to a bytestream and distributed to other servers within the cluster, and restored there.
Most application servers perform the serialization and distribution as part of HttpSession.setAttribute().
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-30936-3.html
其实我作为大陆人十分理解台胞和香港人的关切
>2
不行了不行了我受不了新表情的诱惑了还有四天我就升级