public class ThreadContext
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static short |
HTTP_SESSION
session types
|
static short |
INTERNAL_SESSION |
static short |
RMI_SESSION |
static short |
WEBDAV_SESSION |
static short |
WEBSERVICE_SESSION |
Constructor and Description |
---|
ThreadContext() |
Modifier and Type | Method and Description |
---|---|
static void |
addThreadLocale(java.lang.ThreadLocal<?> local) |
static void |
clean()
Clean the thread context.
|
static java.lang.Object |
getAttribute(java.lang.Object key)
Gets the value identified by the passed key
|
java.util.Iterator<java.lang.Object> |
getAttributeKeys()
Returns an iterator over all keys which were added via method
setAttribute(Object, Object) |
static java.lang.String |
getSessionId()
Get the thread sessionId.
|
static ThreadLocal2<java.lang.String> |
getSessions()
Get the sessions.
|
static short |
getSessionType()
Get the type of the Session
|
static java.util.Locale |
getThreadLocale()
Get the thread locale.
|
static <T extends java.security.Principal> |
getThreadPrincipal()
Get the thread principal, the user who performs the action.
|
static javax.servlet.http.HttpServletRequest |
getThreadRequest()
Get the HttpServletRequest of this thread.
|
static java.util.TimeZone |
getThreadTimeZone()
Get the thread TimeZone
|
static boolean |
isPrivileged()
Is the thread privileged.
|
static void |
removeAttribute(java.lang.Object key)
Removes the key-value pair identified by the passed key
|
static void |
setAttribute(java.lang.Object key,
java.lang.Object value)
Adds a key-value pair to the thread's context.
|
static void |
setPrivileged()
Set the thread privileged.
|
static void |
setSessionId(java.lang.String s)
Set the session id of the thread.
|
static void |
setSessionType(short s)
Set the type of this thread.
|
static void |
setThreadLocale(java.util.Locale l)
Set the locale of the thread.
|
static void |
setThreadPrincipal(java.security.Principal p)
Set the principal of the thread.
|
static void |
setThreadRequest(javax.servlet.http.HttpServletRequest req)
Set the HttpServletRequest of the thread.
|
static void |
setThreadTimeZone(java.util.TimeZone t)
Set the TimeZone of the thread.
|
static java.lang.AutoCloseable |
switchThreadPrincipal(java.security.Principal p)
Change the principal of the thread.
|
public static final short HTTP_SESSION
public static final short RMI_SESSION
public static final short INTERNAL_SESSION
public static final short WEBDAV_SESSION
public static final short WEBSERVICE_SESSION
public static void setThreadLocale(java.util.Locale l)
l
- a locale objectpublic static java.util.Locale getThreadLocale()
public static void setThreadPrincipal(java.security.Principal p)
p
- a Principal objectpublic static java.lang.AutoCloseable switchThreadPrincipal(java.security.Principal p)
p
- a Principal objectAutoCloseable
may be used in combination with a try-with-resources
statement
try(AutoCloseable
closable = switchThreadPrincipal(Principal)
) {
...
}
public static <T extends java.security.Principal> T getThreadPrincipal()
public static void setSessionId(java.lang.String s)
s
- a string objectpublic static java.lang.String getSessionId()
public static void setThreadTimeZone(java.util.TimeZone t)
t
- a TimeZone objectpublic static java.util.TimeZone getThreadTimeZone()
public static ThreadLocal2<java.lang.String> getSessions()
public static void setPrivileged()
public static boolean isPrivileged()
public static void setThreadRequest(javax.servlet.http.HttpServletRequest req)
req
- a HttpServletRequest objectpublic static javax.servlet.http.HttpServletRequest getThreadRequest()
public static short getSessionType()
public static void setSessionType(short s)
s
- either HTTP_SESSION, RMI_SESSION or INTERNAL_SESSIONpublic static void setAttribute(java.lang.Object key, java.lang.Object value)
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified keypublic static java.lang.Object getAttribute(java.lang.Object key)
key
- key whose value should be retrievedpublic static void removeAttribute(java.lang.Object key)
key
- key whose value should be removedpublic java.util.Iterator<java.lang.Object> getAttributeKeys()
setAttribute(Object, Object)
public static void clean()
public static void addThreadLocale(java.lang.ThreadLocal<?> local)
@enterprise 9.0.33982 Copyright © 2001-2023 Groiss Informatics GmbH. All Rights Reserved.