public class UIContext extends Object
| Constructor and Description |
|---|
UIContext() |
| Modifier and Type | Method and Description |
|---|---|
static javax.servlet.http.Cookie |
createLoginCookie(long l) |
static boolean |
deleteLoginCookie(IRequestContext rci) |
static javax.servlet.http.Cookie |
findCookie(String name)
Find a cookie if it exists, return null otherwise.
|
static String |
findCookieValue(String name) |
static ConversationContext |
getCurrentConversation() |
static Page |
getCurrentPage() |
static IUser |
getCurrentUser()
Return the currently-known logged in user, or null if unknown/not logged in.
|
static IUser |
getLoggedInUser()
This returns the currently logged in user.
|
static IRequestContext |
getRequestContext() |
static <T> T |
getSessionAttribute(Class<T> clz,
String attrName)
Returns session value of expected type.
|
static <T> T |
getSessionAttribute(Class<T> clz,
String attrName,
T defaultValue)
Returns session value of expected type.
|
static void |
internalClear()
This CLEARS all "current state" threadlocals.
|
static IRequestContext |
internalGetContext() |
static IUser |
internalGetLoggedInUser(IRequestContext rx)
UNSTABLE INTERFACE.
|
static Page |
internalGetPage() |
static void |
internalSet(IRequestContext rc)
Called when a new request is to be made current, or when the request has
ended.
|
static void |
internalSet(Page pg) |
static boolean |
login(String userid,
String password)
Logs in a user.
|
static void |
logout()
Logs out a user.
|
static void |
registerTempFile(File tmpf)
Register a file as a file/directory to be deleted when the conversation terminates.
|
static void |
setCookie(String name,
String value,
int maxage)
Set a new or overwrite an existing cookie.
|
static void |
setSessionAttribute(String attrName,
Object value)
Sets session attribute value.
|
public static final String LOGIN_KEY
@Nonnull public static IRequestContext getRequestContext()
public static void internalSet(@Nonnull IRequestContext rc) throws Exception
rc - Exceptionpublic static void internalClear()
public static void internalSet(Page pg)
@Nullable public static IRequestContext internalGetContext()
@Nonnull public static ConversationContext getCurrentConversation()
@Nullable public static IUser getCurrentUser()
@Nonnull public static IUser getLoggedInUser()
public static void registerTempFile(@Nonnull File tmpf)
tmpf - public static IUser internalGetLoggedInUser(IRequestContext rx) throws Exception
rci - Exceptionpublic static boolean login(String userid, String password) throws Exception
userid - password - Exceptionpublic static javax.servlet.http.Cookie createLoginCookie(long l)
throws Exception
Exceptionpublic static boolean deleteLoginCookie(IRequestContext rci) throws Exception
Exception@Nullable public static javax.servlet.http.Cookie findCookie(@Nonnull String name)
name - public static void setCookie(@Nonnull String name, String value, int maxage)
name - value - maxage - Max age, in seconds.public static <T> T getSessionAttribute(Class<T> clz, String attrName, T defaultValue)
clz - attrName - defaultValue - public static <T> T getSessionAttribute(Class<T> clz, String attrName)
clz - attrName - Copyright © 2017 etc.to. All rights reserved.