Add more docs about stateless
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/4fd3a774 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/4fd3a774 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/4fd3a774 Branch: refs/heads/reference-guide Commit: 4fd3a774dc976766fce7ee47b89c54f15e62c5d2 Parents: 259e7e4 Author: Martin Tzvetanov Grigorov <[email protected]> Authored: Fri Jan 25 15:16:38 2013 +0200 Committer: Martin Tzvetanov Grigorov <[email protected]> Committed: Fri Jan 25 15:16:38 2013 +0200 ---------------------------------------------------------------------- documentation/source/stateless.rst | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/4fd3a774/documentation/source/stateless.rst ---------------------------------------------------------------------- diff --git a/documentation/source/stateless.rst b/documentation/source/stateless.rst index 6f60a57..f488117 100644 --- a/documentation/source/stateless.rst +++ b/documentation/source/stateless.rst @@ -1,26 +1,31 @@ Stateless pages =============== -By nature a page is stateless, i.e. a new instance is created for each request and discarded at the end. A stateful page is stored in a some storage for later use. For example, clicking on an Link [#]_ request needs to -A page becomes stateful as soon as a stateful behavior or component is added in the tree. +Being stateful +-------------- -A Component [#]_ declares that it needs to be stateful by returning *false* in #getStatelessHint() method:: +By nature a page is stateless, i.e. a new instance is created for each request and discarded at the end. A page becomes stateful as soon as a stateful behavior or component is added in the tree. Stateful pages are stored in a storage for later use, i.e. in following requests the same page instance is reused instead of creating a new instance. Technically, the page may be deserialized so it is not always the same JVM instance but the important thing is that any state/data in the page will be preserved. + +A `Component <http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/Component.html>`_ declares that it needs to be stateful by returning *false* in #getStatelessHint() method:: protected boolean getStatelessHint() { return false; } -and Behavior [#]_ by overriding:: +and `Behavior <http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/Behavior.html>`_ by overriding:: public boolean getStatelessHint(Component component) { return false; } -and org.apache.wicket.Behavior can be marked as stateful by overriding their -.. [#] org.apache.wicket.markup.html.link.Link -.. [#] org.apache.wicket.Component -.. [#] org.apache.wicket.Behavior +Example +------- + + + + +For example, click on an `Link <http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/markup/html/link/Link.html>`_ will lead to a request that will try to find the Page object that contains this link, then find the link itself in that page and finally execute its `#onClick()` method.
