public final class SessionFactory extends Object
SessionFactory.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.Modifier and Type | Method and Description |
---|---|
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(String username, String password)
This method creates a new Session backed by given user's privileges.
|
public static Session getSession()
IllegalStateException
- if Content Server is not registered.public static Session newSession(String username, String password)
username
- the usernamepassword
- the passwordIllegalStateException
- if Content Server session cannot be createdSecurityException
- if user authentication fails