|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.fatwire.system.SessionFactory
public final class SessionFactory
This is a factory to create new Session instances or obtain ones already created.
New Session instances are always created for a user, by way of invokingSessionFactory.newSession(java.lang.String, java.lang.String)
.
Session instances are meant to last the lifetime of the thread of execution.
It is not advisable to cache an instance of Session and use it across threads.
When Asset API is used in a Content Server managed JSP template, it is advised to obtain an instance of Session
that is already created by Content Server by calling SessionFactory.getSession()
instead of creating a new Session.
The Session obtained by this mechanism is created with the privileges of the user executing the request.
Obtaining Session in this way inside a JSP template is essential to getting the page log cache dependencies correctly.
While it is possible to obtain a new Session and use it within a JSP page, it is not advised.
Please note that SessionFactory.getSession()
is only meaningful when used in a JSP page managed by Content Server.
A stand alone JSP page, just as a stand alone Java program, will need to invoke SessionFactory.newSession(java.lang.String, java.lang.String)
to start using asset API.
Method Summary | |
---|---|
static Session |
getSession()
Gets handle to a Session instance using context information registered with the current thread. |
static Session |
getSession(ICS ics)
This methods gets a session with an existing ics. |
static Session |
newSession(java.lang.String username,
java.lang.String password)
This method creates a new Session backed by given user's privileges. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Session getSession()
java.lang.IllegalStateException
- if Content Server is not registered.public static Session newSession(java.lang.String username, java.lang.String password)
username
- the usernamepassword
- the password
java.lang.IllegalStateException
- if Content Server session cannot be created
java.lang.SecurityException
- if user authentication failspublic static Session getSession(ICS ics)
ics
- the user ics
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |