Package org.apache.wicket.pageStore
Class SerializedPage
- java.lang.Object
-
- org.apache.wicket.pageStore.SerializedPage
-
- All Implemented Interfaces:
Serializable
,IManageablePage
,IClusterable
public final class SerializedPage extends Object implements IManageablePage
A wrapper around a serialized page.An
IPageStore
might use this representation of a page internally, accept it inIPageStore.addPage(IPageContext, IManageablePage)
or delegate it to another store.Stores might pose restrictions on what type of pages they work with, see
CryptingPageStore
for an example.- See Also:
SerializingPageStore
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SerializedPage(int pageId, byte[] data)
Create a serialized page.SerializedPage(int pageId, String pageType, byte[] data)
Create a serialized page.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
detach()
Detaches model after use.byte[]
getData()
int
getPageId()
String
getPageType()
boolean
isPageStateless()
Gets whether the page is stateless.boolean
setFreezePageId(boolean freeze)
Sets whether or not the page is allowed to change its page id.String
toString()
-
-
-
Constructor Detail
-
SerializedPage
public SerializedPage(int pageId, byte[] data)
Create a serialized page.- Parameters:
pageId
- id of pagedata
-
-
SerializedPage
public SerializedPage(int pageId, String pageType, byte[] data)
Create a serialized page.- Parameters:
pageId
- id of pagepageType
- type of page, might benull
data
-
-
-
Method Detail
-
isPageStateless
public boolean isPageStateless()
Description copied from interface:IManageablePage
Gets whether the page is stateless. Components on stateless page must not render any stateful urls. Stateful urls are urls, which refer to a certain (current) page instance and don't contain enough information to reconstruct page if it's not available (page class).- Specified by:
isPageStateless
in interfaceIManageablePage
- Returns:
- Whether this page is stateless
-
getPageId
public int getPageId()
- Specified by:
getPageId
in interfaceIManageablePage
- Returns:
- A unique identifier for this page map entry
-
getPageType
public String getPageType()
-
getData
public byte[] getData()
-
detach
public void detach()
Description copied from interface:IManageablePage
Detaches model after use. This is generally used to null out transient references that can be re-attached later.- Specified by:
detach
in interfaceIManageablePage
-
setFreezePageId
public boolean setFreezePageId(boolean freeze)
Description copied from interface:IManageablePage
Sets whether or not the page is allowed to change its page id. Implementations of this interface usually change their page id once a change to the data structure is made and historical record of the current state needs to be kept (usually to be accessible via the back button). Keeping a historical record is usually achieved by simply incrementing the page id to the next unique number, so when the implementation is stored it is done so in a new slot. This method is useful when for some reason we do not want the implementation to change its page id under any circumstances. One concrete example is an AJAX request. Suppose the page with id 10 was written out with callbacks pointing to id 10. Suppose that the user executed some AJAX callbacks which have changed the page id to 15. Now, the user clicks a non-AJAX link that was never updated by an AJAX update and still points to id 10 - which causes the state of the page to be rolled back - which is usually undesirable as all changes made to the page by AJAX requests are lost. So, instead, whatever is invoking the execution of the AJAX request on the page can use this method to tell the page to not update its page id thereby solving the problem.- Specified by:
setFreezePageId
in interfaceIManageablePage
- Returns:
- previous state
-
-