|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectwicket.Session
public abstract class Session
Holds information about a user session, including some fixed number of most recent pages (and all their nested component information).
RequestCycle
can be retrieved by calling RequestCycle.getSession().
Component.getSession(). As currently implemented, each Component
does not itself have a reference to the session that contains it. However,
the Page component at the root of the containment hierarchy does have a
reference to the Session that holds the Page. So
Component.getSession() traverses the component hierarchy to the root
Page and then calls Component.getSession().
setLocale(Locale). The Locale for a Session determines how
localized resources are found and loaded.
Application for details). To discourage
non-typesafe access to Session properties, no setProperty() or getProperty()
method is provided. In a clustered environment, you should take care to call
the dirty() method when you change a property or youre own. This way the
session will be reset again in the http session so that the http session
knows the session is changed.
IClassResolver) implementation that is used to locate classes for
components such as pages.
IPageFactory
is used to instantiate pages for the session.
| Nested Class Summary | |
|---|---|
static interface |
Session.IPageMapVisitor
Visitor interface for visiting page maps |
| Field Summary | |
|---|---|
static java.lang.String |
SESSION_ATTRIBUTE_NAME
Name of session attribute under which this session is stored |
| Constructor Summary | |
|---|---|
protected |
Session(Application application)
Constructor. |
| Method Summary | |
|---|---|
void |
clear()
Removes all pages from the session. |
PageMap |
createAutoPageMap()
Automatically creates a page map, giving it a session unique name. |
java.lang.String |
createAutoPageMapName()
With this call you can create a pagemap name but not create the pagemap itself already. |
protected void |
detach()
Any detach logic for session subclasses. |
protected void |
dirty()
Marks session state as dirty |
void |
error(java.lang.String message)
Registers an error feedback message for this session |
static boolean |
exists()
Checks if the Session threadlocal is set in this thread |
static Session |
get()
Get the session for the calling thread. |
Application |
getApplication()
Get the application that is currently working with this session. |
protected java.lang.Object |
getAttribute(java.lang.String name)
Gets the attribute value with the given name |
protected java.util.List |
getAttributeNames()
|
IAuthorizationStrategy |
getAuthorizationStrategy()
|
IClassResolver |
getClassResolver()
|
ClientInfo |
getClientInfo()
Gets the client info object for this session. |
IConverter |
getConverter()
Gets the converter instance. |
PageMap |
getDefaultPageMap()
|
FeedbackMessages |
getFeedbackMessages()
Gets feedback messages stored in session |
java.lang.String |
getId()
Gets the unique id for this session from the underlying SessionStore |
java.util.Locale |
getLocale()
Get this session's locale. |
java.io.Serializable |
getMetaData(MetaDataKey key)
Gets metadata for this session using the given key. |
Page |
getPage(java.lang.String pageMapName,
java.lang.String path,
int versionNumber)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
IPageFactory |
getPageFactory()
|
IPageFactory |
getPageFactory(Page page)
|
java.util.List |
getPageMaps()
|
protected abstract IRequestCycleFactory |
getRequestCycleFactory()
|
protected ISessionStore |
getSessionStore()
Gets the session store. |
long |
getSizeInBytes()
|
java.lang.String |
getStyle()
Get the style (see Session). |
void |
info(java.lang.String message)
Registers an informational feedback message for this session |
void |
init()
Set the session for each PageMap |
void |
invalidate()
Invalidates this session. |
PageMap |
newPageMap(java.lang.String name)
Creates a new page map with a given name |
RequestCycle |
newRequestCycle(Request request,
Response response)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
PageMap |
pageMapForName(java.lang.String pageMapName,
boolean autoCreate)
Gets a page map for the given name, automatically creating it if need be. |
protected void |
removeAttribute(java.lang.String name)
Removes the attribute with the given name. |
void |
removePageMap(PageMap pageMap)
|
static void |
set(Session session)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
void |
setApplication(Application application)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
protected void |
setAttribute(java.lang.String name,
java.lang.Object value)
Adds or replaces the attribute with the given name and value. |
void |
setClientInfo(ClientInfo clientInfo)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
void |
setLocale(java.util.Locale locale)
Set the locale for this session. |
void |
setMetaData(MetaDataKey key,
java.io.Serializable object)
Sets the metadata for this session using the given key. |
Session |
setStyle(java.lang.String style)
Set the style (see Session). |
void |
touch(Page page)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
static void |
unset()
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
protected void |
update()
Updates the session, e.g. |
void |
visitPageMaps(Session.IPageMapVisitor visitor)
|
void |
warn(java.lang.String message)
Registers a warning feedback message for this session |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String SESSION_ATTRIBUTE_NAME
| Constructor Detail |
|---|
protected Session(Application application)
application - The application that this is a session of| Method Detail |
|---|
public static Session get()
public static boolean exists()
Session threadlocal is set in this thread
get() can return the instance of session,
false otherwisepublic static void set(Session session)
Sets session for calling thread.
session - The sessionpublic static void unset()
Clears the session for calling thread.
public final void clear()
public final Application getApplication()
public IAuthorizationStrategy getAuthorizationStrategy()
public final IClassResolver getClassResolver()
public ClientInfo getClientInfo()
setClientInfo(ClientInfo))
client info object or uses RequestCycle.newClientInfo() to get
the info object based on the current request when no client info object
was set yet, and then caches the returned object; we can expect the
client to stay the same for the whole session, and implementations of
RequestCycle.newClientInfo() might be relatively expensive.
public final PageMap getDefaultPageMap()
public final java.lang.String getId()
public java.util.Locale getLocale()
public final java.io.Serializable getMetaData(MetaDataKey key)
key - The key for the data
MetaDataKeypublic final Page getPage(java.lang.String pageMapName, java.lang.String path, int versionNumber)
pageMapName - The name of the page map where the page ispath - Component pathversionNumber - The version of the page required
public final IPageFactory getPageFactory()
public final IPageFactory getPageFactory(Page page)
page - The page, or null if no page context is available
public final PageMap pageMapForName(java.lang.String pageMapName, boolean autoCreate)
pageMapName - Name of page map, or null for default page mapautoCreate - True if the page map should be automatically created if it
does not exist
public final PageMap createAutoPageMap()
public final java.lang.String createAutoPageMapName()
public final java.util.List getPageMaps()
public final long getSizeInBytes()
public final java.lang.String getStyle()
public final void init()
public void invalidate()
public final PageMap newPageMap(java.lang.String name)
name - The name for the new page map
public final RequestCycle newRequestCycle(Request request, Response response)
request - The requestresponse - The response
public final void removePageMap(PageMap pageMap)
pageMap - Page map to removepublic final void setApplication(Application application)
Sets the application that this session is associated with.
application - The applicationpublic final void setClientInfo(ClientInfo clientInfo)
Sets the client info object for this session. This will only work when
getClientInfo() is not overriden.
clientInfo - the client info objectpublic final void setLocale(java.util.Locale locale)
locale - New localepublic final void setMetaData(MetaDataKey key, java.io.Serializable object)
MetaDataKey.
key - The singleton key for the metadataobject - The metadata object
java.lang.IllegalArgumentExceptionMetaDataKeypublic final Session setStyle(java.lang.String style)
Session).
style - The style to set.
public final void touch(Page page)
The page will be 'touched' in the session. If it wasn't added yet to the pagemap, it will be added to the page map else it will set this page to the front. If another page was removed because of this it will be cleaned up.
page - public final void visitPageMaps(Session.IPageMapVisitor visitor)
visitor - The visitor to call at each Page in this PageMap.public final void info(java.lang.String message)
message - The feedback messagepublic final void warn(java.lang.String message)
message - The feedback messagepublic final void error(java.lang.String message)
message - The feedback messagepublic final FeedbackMessages getFeedbackMessages()
public final IConverter getConverter()
protected void detach()
protected final void dirty()
protected final java.lang.Object getAttribute(java.lang.String name)
name - The name of the attribute to store
protected final java.util.List getAttributeNames()
protected abstract IRequestCycleFactory getRequestCycleFactory()
protected ISessionStore getSessionStore()
protected final void removeAttribute(java.lang.String name)
name - the name of the attribute to remove
protected final void setAttribute(java.lang.String name,
java.lang.Object value)
name - The name of the attributevalue - The value of the attributeprotected void update()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||