Package org.apache.wicket.pageStore
Class DefaultPageContext
- java.lang.Object
-
- org.apache.wicket.pageStore.DefaultPageContext
-
- All Implemented Interfaces:
IPageContext
public class DefaultPageContext extends java.lang.Object implements IPageContext
Default page context usingRequestCycle.getRequest()andSession.get().- Author:
- Juergen Donnerstag, svenmeier
-
-
Constructor Summary
Constructors Constructor Description DefaultPageContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> TgetRequestData(MetaDataKey<T> key, java.util.function.Supplier<T> defaultValue)Get data from the current request cycle.<T extends java.io.Serializable>
TgetSessionAttribute(java.lang.String key, java.util.function.Supplier<T> defaultValue)Get an attribute from the session.<T extends java.io.Serializable>
TgetSessionData(MetaDataKey<T> key, java.util.function.Supplier<T> defaultValue)Get metadata from the session.java.lang.StringgetSessionId(boolean bind)Get the identifier of the session.
-
-
-
Method Detail
-
getSessionId
public java.lang.String getSessionId(boolean bind)
Description copied from interface:IPageContextGet the identifier of the session.- Specified by:
getSessionIdin interfaceIPageContext- Parameters:
bind- should the session be bound- Returns:
- session id, might be
nullif not bound yet - See Also:
org.apache.wicket.pageStore.IPageContext#getSessionId()
-
getSessionAttribute
public <T extends java.io.Serializable> T getSessionAttribute(java.lang.String key, java.util.function.Supplier<T> defaultValue)Description copied from interface:IPageContextGet an attribute from the session.
Binds the session if not already set and supplied default value is notnull.- Specified by:
getSessionAttributein interfaceIPageContext- Parameters:
key- keydefaultValue- default value to use if not present- Returns:
- value
- See Also:
Session.getAttribute(String)
-
getSessionData
public <T extends java.io.Serializable> T getSessionData(MetaDataKey<T> key, java.util.function.Supplier<T> defaultValue)
Description copied from interface:IPageContextGet metadata from the session.
Binds the session if not already set and supplied default value is notnull.- Specified by:
getSessionDatain interfaceIPageContext- Parameters:
key- keydefaultValue- default value to use if not present- Returns:
- value
- See Also:
Session.getMetaData(MetaDataKey)
-
getRequestData
public <T> T getRequestData(MetaDataKey<T> key, java.util.function.Supplier<T> defaultValue)
Description copied from interface:IPageContextGet data from the current request cycle.- Specified by:
getRequestDatain interfaceIPageContext- Parameters:
key- keydefaultValue- default value to use if not present- See Also:
RequestCycle.getMetaData(MetaDataKey)
-
-