Package org.apache.wicket
Class ThreadContext
- java.lang.Object
-
- org.apache.wicket.ThreadContext
-
public class ThreadContext extends Object
Holds thread local state for Wicket data.- Author:
- Matej Knopp
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ThreadContextdetach()Cleans theThreadContextand returns previous context.static booleanexists()Checks ifThreadContextexists for the current threadstatic ThreadContextget(boolean createIfDoesNotExist)INTERNAL METHODstatic ApplicationgetApplication()static RequestCyclegetRequestCycle()static SessiongetSession()static voidrestore(ThreadContext threadContext)Restores the contextstatic voidsetApplication(Application application)Binds the specified application to current thread.static voidsetRequestCycle(RequestCycle requestCycle)Binds theRequestCycleto current thread.static voidsetSession(Session session)Binds the session to current thread.
-
-
-
Method Detail
-
get
public static ThreadContext get(boolean createIfDoesNotExist)
INTERNAL METHOD- Parameters:
createIfDoesNotExist-- Returns:
- ThreadContext
-
exists
public static boolean exists()
Checks ifThreadContextexists for the current thread- Returns:
trueifThreadContextexists for the current thread
-
getApplication
public static Application getApplication()
- Returns:
Applicationbound to current thread
-
setApplication
public static void setApplication(Application application)
Binds the specified application to current thread.- Parameters:
application-
-
getRequestCycle
public static RequestCycle getRequestCycle()
- Returns:
RequestCyclebound to current thrad
-
setRequestCycle
public static void setRequestCycle(RequestCycle requestCycle)
Binds theRequestCycleto current thread.- Parameters:
requestCycle-
-
getSession
public static Session getSession()
- Returns:
Sessionbound to current thread
-
setSession
public static void setSession(Session session)
Binds the session to current thread.- Parameters:
session-
-
detach
public static ThreadContext detach()
Cleans theThreadContextand returns previous context.- Returns:
- old
ThreadContext
-
restore
public static void restore(ThreadContext threadContext)
Restores the context- Parameters:
threadContext-- See Also:
detach()
-
-