Java Doc for Session.java in  » J2EE » wicket » wicket » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » wicket » wicket 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   wicket.Session

All known Subclasses:   wicket.protocol.http.WebSession,
Session
abstract public class Session implements Serializable(Code)
Holds information about a user session, including some fixed number of most recent pages (and all their nested component information).
  • Access via RequestCycle - The Session for a RequestCycle can be retrieved by calling RequestCycle.getSession .
  • Access via Component - If a RequestCycle object is not available, the Session can be retrieved for a Component by calling 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 Page.getSession .
  • Access via Thread Local - In the odd case where neither a RequestCycle nor a Component is available, the currently active Session for the calling thread can be retrieved by calling the static method Session.get(). This last form should only be used if the first two forms cannot be used since thread local access can involve a potentially more expensive hash map lookup.
  • Locale - A session has a Locale property to support localization. The Locale for a session can be set by calling Session.setLocale(Locale) . The Locale for a Session determines how localized resources are found and loaded.
  • Style - Besides having an appearance based on locale, resources can also have different looks in the same locale (a.k.a. "skins"). The style for a session determines the look which is used within the appopriate locale. The session style ("skin") can be set with the setStyle() method.
  • Resource Loading - Based on the Session locale and style, searching for resources occurs in the following order (where sourcePath is set via the ApplicationSettings object for the current Application, and style and locale are Session properties):
      1. [sourcePath]/name[style][locale].[extension]
      2. [sourcePath]/name[locale].[extension]
      3. [sourcePath]/name[style].[extension]
      4. [sourcePath]/name.[extension]
      5. [classPath]/name[style][locale].[extension]
      6. [classPath]/name[locale].[extension]
      7. [classPath]/name[style].[extension]
      8. [classPath]/name.[extension]
  • Session Properties - Arbitrary objects can be attached to a Session by installing a session factory on your Application class which creates custom Session subclasses that have typesafe properties specific to the application (see 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.
  • Class Resolver - Sessions have a class resolver ( IClassResolver ) implementation that is used to locate classes for components such as pages.
  • Page Factory - A pluggable implementation of IPageFactory is used to instantiate pages for the session.
  • Removal - Pages can be removed from the Session forcibly by calling remove(Page) or removeAll(), although such an action should rarely be necessary.
  • Flash Messages- Flash messages are messages that are stored in session and are removed after they are displayed to the user. Session acts as a store for these messages because they can last across requests.
    author:
       Jonathan Locke
    author:
       Eelco Hillenius
    author:
       Igor Vaynberg (ivaynberg)

Inner Class :public static interface IPageMapVisitor

Field Summary
final public static  StringSESSION_ATTRIBUTE_NAME
    
final static  StringpageMapEntryAttributePrefix
    

Constructor Summary
protected  Session(Application application)
     Constructor.

Method Summary
final  voidcleanupFeedbackMessages()
     Removes any rendered feedback messages as well as compacts memory.
final public  voidclear()
     Removes all pages from the session.
final public synchronized  PageMapcreateAutoPageMap()
     Automatically creates a page map, giving it a session unique name.
final public synchronized  StringcreateAutoPageMapName()
     With this call you can create a pagemap name but not create the pagemap itself already.
protected  voiddetach()
     Any detach logic for session subclasses.
final protected  voiddirty()
    
 voiddirtyPage(Page page)
    
 voiddirtyPageMap(PageMap map)
    
final public  voiderror(String message)
    
public static  booleanexists()
    
public static  Sessionget()
     Get the session for the calling thread.
final public  ApplicationgetApplication()
     Get the application that is currently working with this session.
final protected  ObjectgetAttribute(String name)
    
final protected  ListgetAttributeNames()
    
public  IAuthorizationStrategygetAuthorizationStrategy()
    
final public  IClassResolvergetClassResolver()
    
public  ClientInfogetClientInfo()
     Gets the client info object for this session.
final public  IConvertergetConverter()
     Gets the converter instance.
final public  PageMapgetDefaultPageMap()
    
 ListgetDirtyObjectsList()
    
final public  FeedbackMessagesgetFeedbackMessages()
    
final public  StringgetId()
    
public  LocalegetLocale()
     Get this session's locale.
final public  SerializablegetMetaData(MetaDataKey key)
     Gets metadata for this session using the given key.
final public  PagegetPage(String pageMapName, String path, int versionNumber)
     THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
final public  IPageFactorygetPageFactory()
    
final public  IPageFactorygetPageFactory(Page page)
    
final public  ListgetPageMaps()
    
abstract protected  IRequestCycleFactorygetRequestCycleFactory()
    
protected  ISessionStoregetSessionStore()
     Gets the session store.
final public  longgetSizeInBytes()
    
final public  StringgetStyle()
     Get the style (see wicket.Session ).
final public  voidinfo(String message)
    
final public  voidinit()
    
public  voidinvalidate()
     Invalidates this session.
final public  PageMapnewPageMap(String name)
    
final public  RequestCyclenewRequestCycle(Request request, Response response)
     THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
final public  PageMappageMapForName(String pageMapName, boolean autoCreate)
     Gets a page map for the given name, automatically creating it if need be.
final protected  voidremoveAttribute(String name)
     Removes the attribute with the given name.
final public  voidremovePageMap(PageMap pageMap)
    
final  voidrequestDetached()
     INTERNAL API.
public static  voidset(Session session)
     THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
final public  voidsetApplication(Application application)
     THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
final protected  voidsetAttribute(String name, Object value)
     Adds or replaces the attribute with the given name and value.
final public  voidsetClientInfo(ClientInfo clientInfo)
     THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
final public  voidsetLocale(Locale locale)
     Set the locale for this session.
final public  voidsetMetaData(MetaDataKey key, Serializable object)
     Sets the metadata for this session using the given key.
final public  SessionsetStyle(String style)
     Set the style (see wicket.Session ).
Parameters:
  style - The style to set.
final public  voidtouch(Page page)
     THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
public static  voidunset()
     THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
protected  voidupdate()
     Updates the session, e.g.
final public  voidvisitPageMaps(IPageMapVisitor visitor)
    
final public  voidwarn(String message)
    

Field Detail
SESSION_ATTRIBUTE_NAME
final public static String SESSION_ATTRIBUTE_NAME(Code)
Name of session attribute under which this session is stored



pageMapEntryAttributePrefix
final static String pageMapEntryAttributePrefix(Code)
Prefix for attributes holding page map entries




Constructor Detail
Session
protected Session(Application application)(Code)
Constructor.
Parameters:
  application - The application that this is a session of




Method Detail
cleanupFeedbackMessages
final void cleanupFeedbackMessages()(Code)
Removes any rendered feedback messages as well as compacts memory. This method is usually called at the end of the request cycle processing.



clear
final public void clear()(Code)
Removes all pages from the session. Although this method should rarely be needed, it is available (possibly for security reasons).



createAutoPageMap
final public synchronized PageMap createAutoPageMap()(Code)
Automatically creates a page map, giving it a session unique name. Created PageMap



createAutoPageMapName
final public synchronized String createAutoPageMapName()(Code)
With this call you can create a pagemap name but not create the pagemap itself already. It will give the first pagemap name where it couldn't find a current pagemap for. It will return the same name if you call it 2 times in a row. The created pagemap name



detach
protected void detach()(Code)
Any detach logic for session subclasses. This is called on the end of handling a request, when the RequestCycle is about to be detached from the current thread.



dirty
final protected void dirty()(Code)
Marks session state as dirty



dirtyPage
void dirtyPage(Page page)(Code)

Parameters:
  page - The page to add to dirty objects list



dirtyPageMap
void dirtyPageMap(PageMap map)(Code)

Parameters:
  map - The page map to add to dirty objects list



error
final public void error(String message)(Code)
Registers an error feedback message for this session
Parameters:
  message - The feedback message



exists
public static boolean exists()(Code)
Checks if the Session threadlocal is set in this thread true if Session.get can return the instance of session,false otherwise



get
public static Session get()(Code)
Get the session for the calling thread. Session for calling thread



getApplication
final public Application getApplication()(Code)
Get the application that is currently working with this session. Returns the application.



getAttribute
final protected Object getAttribute(String name)(Code)
Gets the attribute value with the given name
Parameters:
  name - The name of the attribute to store The value of the attribute



getAttributeNames
final protected List getAttributeNames()(Code)
List of attributes for this session



getAuthorizationStrategy
public IAuthorizationStrategy getAuthorizationStrategy()(Code)
The authorization strategy for this session



getClassResolver
final public IClassResolver getClassResolver()(Code)
The class resolver for this Session



getClientInfo
public ClientInfo getClientInfo()(Code)
Gets the client info object for this session. This method lazily gets the new agent info object for this session. It uses any cached or set ( Session.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. the client info object based on this request



getConverter
final public IConverter getConverter()(Code)
Gets the converter instance. This method returns the cached converter for the current locale. Whenever the locale is changed, the cached value is cleared and the converter will be recreated for the new locale on a next request. the converter



getDefaultPageMap
final public PageMap getDefaultPageMap()(Code)
The default page map



getDirtyObjectsList
List getDirtyObjectsList()(Code)
The current thread dirty objects list



getFeedbackMessages
final public FeedbackMessages getFeedbackMessages()(Code)
Gets feedback messages stored in session unmodifiable list of feedback messages



getId
final public String getId()(Code)
Gets the unique id for this session from the underlying SessionStore The unique id for this session



getLocale
public Locale getLocale()(Code)
Get this session's locale. This session's locale



getMetaData
final public Serializable getMetaData(MetaDataKey key)(Code)
Gets metadata for this session using the given key.
Parameters:
  key - The key for the data The metadata
See Also:   MetaDataKey



getPage
final public Page getPage(String pageMapName, String path, int versionNumber)(Code)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT. Get the page for the given path.
Parameters:
  pageMapName - The name of the page map where the page is
Parameters:
  path - Component path
Parameters:
  versionNumber - The version of the page required The page based on the first path component (the page id), or nullif the requested version of the page cannot be found.



getPageFactory
final public IPageFactory getPageFactory()(Code)
The page factory for this session



getPageFactory
final public IPageFactory getPageFactory(Page page)(Code)

Parameters:
  page - The page, or null if no page context is available The page factory for the page, or the default page factory ifpage was null



getPageMaps
final public List getPageMaps()(Code)
A list of all PageMaps in this session.



getRequestCycleFactory
abstract protected IRequestCycleFactory getRequestCycleFactory()(Code)
Request cycle factory for this kind of session.



getSessionStore
protected ISessionStore getSessionStore()(Code)
Gets the session store. the session store



getSizeInBytes
final public long getSizeInBytes()(Code)
Size of this session, including all the pagemaps it contains



getStyle
final public String getStyle()(Code)
Get the style (see wicket.Session ). Returns the style (see wicket.Session)



info
final public void info(String message)(Code)
Registers an informational feedback message for this session
Parameters:
  message - The feedback message



init
final public void init()(Code)
Set the session for each PageMap



invalidate
public void invalidate()(Code)
Invalidates this session.



newPageMap
final public PageMap newPageMap(String name)(Code)
Creates a new page map with a given name
Parameters:
  name - The name for the new page map The newly created page map



newRequestCycle
final public RequestCycle newRequestCycle(Request request, Response response)(Code)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT. Creates a new RequestCycle for the given request and response using the session's request cycle factory.
Parameters:
  request - The request
Parameters:
  response - The response The new request cycle.



pageMapForName
final public PageMap pageMapForName(String pageMapName, boolean autoCreate)(Code)
Gets a page map for the given name, automatically creating it if need be.
Parameters:
  pageMapName - Name of page map, or null for default page map
Parameters:
  autoCreate - True if the page map should be automatically created if itdoes not exist PageMap for name



removeAttribute
final protected void removeAttribute(String name)(Code)
Removes the attribute with the given name.
Parameters:
  name - the name of the attribute to remove



removePageMap
final public void removePageMap(PageMap pageMap)(Code)

Parameters:
  pageMap - Page map to remove



requestDetached
final void requestDetached()(Code)
INTERNAL API. The request cycle when detached will call this.



set
public static void set(Session session)(Code)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.

Sets session for calling thread.
Parameters:
  session - The session




setApplication
final public void setApplication(Application application)(Code)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.

Sets the application that this session is associated with.
Parameters:
  application - The application




setAttribute
final protected void setAttribute(String name, Object value)(Code)
Adds or replaces the attribute with the given name and value.
Parameters:
  name - The name of the attribute
Parameters:
  value - The value of the attribute



setClientInfo
final public void setClientInfo(ClientInfo clientInfo)(Code)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.

Sets the client info object for this session. This will only work when Session.getClientInfo() is not overriden.
Parameters:
  clientInfo - the client info object




setLocale
final public void setLocale(Locale locale)(Code)
Set the locale for this session.
Parameters:
  locale - New locale



setMetaData
final public void setMetaData(MetaDataKey key, Serializable object)(Code)
Sets the metadata for this session using the given key. If the metadata object is not of the correct type for the metadata key, an IllegalArgumentException will be thrown. For information on creating MetaDataKeys, see MetaDataKey .
Parameters:
  key - The singleton key for the metadata
Parameters:
  object - The metadata object
throws:
  IllegalArgumentException -
See Also:   MetaDataKey



setStyle
final public Session setStyle(String style)(Code)
Set the style (see wicket.Session ).
Parameters:
  style - The style to set. the Session object



touch
final public void touch(Page page)(Code)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.

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.
Parameters:
  page -




unset
public static void unset()(Code)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.

Clears the session for calling thread.




update
protected void update()(Code)
Updates the session, e.g. for replication purposes.



visitPageMaps
final public void visitPageMaps(IPageMapVisitor visitor)(Code)

Parameters:
  visitor - The visitor to call at each Page in this PageMap.



warn
final public void warn(String message)(Code)
Registers a warning feedback message for this session
Parameters:
  message - The feedback message



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.