blob: a78f1ea9dc5e008ae1d9bf922e5c02083bb7590d [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_65) on Tue Feb 25 18:15:51 EST 2014 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
ThreadContext (Apache Shiro 1.2.3 API)
</TITLE>
<META NAME="date" CONTENT="2014-02-25">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="ThreadContext (Apache Shiro 1.2.3 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ThreadContext.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../org/apache/shiro/util/StringUtils.html" title="class in org.apache.shiro.util"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../org/apache/shiro/util/ThreadState.html" title="interface in org.apache.shiro.util"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?org/apache/shiro/util/ThreadContext.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="ThreadContext.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.shiro.util</FONT>
<BR>
Class ThreadContext</H2>
<PRE>
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
<IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.shiro.util.ThreadContext</B>
</PRE>
<HR>
<DL>
<DT><PRE>public abstract class <A HREF="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.45"><B>ThreadContext</B></A><DT>extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></DL>
</PRE>
<P>
A ThreadContext provides a means of binding and unbinding objects to the
current thread based on key/value pairs.
<p/>
<p>An internal <A HREF="http://java.sun.com/javase/6/docs/api/java/util/HashMap.html?is-external=true" title="class or interface in java.util"><CODE>HashMap</CODE></A> is used to maintain the key/value pairs
for each thread.</p>
<p/>
<p>If the desired behavior is to ensure that bound data is not shared across
threads in a pooled or reusable threaded environment, the application (or more likely a framework) must
bind and remove any necessary values at the beginning and end of stack
execution, respectively (i.e. individually explicitly or all via the <tt>clear</tt> method).</p>
<P>
<P>
<DL>
<DT><B>Since:</B></DT>
<DD>0.1</DD>
<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/shiro/util/ThreadContext.html#remove()"><CODE>remove()</CODE></A></DL>
<HR>
<P>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/util/ThreadContext.html#SECURITY_MANAGER_KEY">SECURITY_MANAGER_KEY</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/util/ThreadContext.html#SUBJECT_KEY">SUBJECT_KEY</A></B></CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected </CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/util/ThreadContext.html#ThreadContext()">ThreadContext</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default no-argument constructor.</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/util/ThreadContext.html#bind(org.apache.shiro.mgt.SecurityManager)">bind</A></B>(<A HREF="../../../../org/apache/shiro/mgt/SecurityManager.html" title="interface in org.apache.shiro.mgt">SecurityManager</A>&nbsp;securityManager)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Convenience method that simplifies binding the application's SecurityManager instance to the ThreadContext.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/util/ThreadContext.html#bind(org.apache.shiro.subject.Subject)">bind</A></B>(<A HREF="../../../../org/apache/shiro/subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</A>&nbsp;subject)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Convenience method that simplifies binding a Subject to the ThreadContext.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/util/ThreadContext.html#get(java.lang.Object)">get</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>&nbsp;key)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the object for the specified <code>key</code> that is bound to
the current thread.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>,<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>&gt;</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/util/ThreadContext.html#getResources()">getResources</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the ThreadLocal Map.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../org/apache/shiro/mgt/SecurityManager.html" title="interface in org.apache.shiro.mgt">SecurityManager</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/util/ThreadContext.html#getSecurityManager()">getSecurityManager</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Convenience method that simplifies retrieval of the application's SecurityManager instance from the current
thread.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../org/apache/shiro/subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/util/ThreadContext.html#getSubject()">getSubject</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Convenience method that simplifies retrieval of a thread-bound Subject.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/util/ThreadContext.html#put(java.lang.Object, java.lang.Object)">put</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>&nbsp;key,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>&nbsp;value)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Binds <tt>value</tt> for the given <code>key</code> to the current thread.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/util/ThreadContext.html#remove()">remove</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/ThreadLocal.html?is-external=true#remove()" title="class or interface in java.lang"><CODE>Remove</CODE></A>s the underlying <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/ThreadLocal.html?is-external=true" title="class or interface in java.lang"><CODE>ThreadLocal</CODE></A> from the thread.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/util/ThreadContext.html#remove(java.lang.Object)">remove</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>&nbsp;key)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Unbinds the value for the given <code>key</code> from the current
thread.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/util/ThreadContext.html#setResources(java.util.Map)">setResources</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>,<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>&gt;&nbsp;newResources)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Allows a caller to explicitly set the entire resource map.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../org/apache/shiro/mgt/SecurityManager.html" title="interface in org.apache.shiro.mgt">SecurityManager</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/util/ThreadContext.html#unbindSecurityManager()">unbindSecurityManager</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Convenience method that simplifies removal of the application's SecurityManager instance from the thread.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../org/apache/shiro/subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/shiro/util/ThreadContext.html#unbindSubject()">unbindSubject</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Convenience method that simplifies removal of a thread-local Subject from the thread.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="SECURITY_MANAGER_KEY"><!-- --></A><H3>
SECURITY_MANAGER_KEY</H3>
<PRE>
public static final <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <A HREF="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.52"><B>SECURITY_MANAGER_KEY</B></A></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="SUBJECT_KEY"><!-- --></A><H3>
SUBJECT_KEY</H3>
<PRE>
public static final <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <A HREF="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.53"><B>SUBJECT_KEY</B></A></PRE>
<DL>
<DL>
</DL>
</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="ThreadContext()"><!-- --></A><H3>
ThreadContext</H3>
<PRE>
protected <A HREF="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.60"><B>ThreadContext</B></A>()</PRE>
<DL>
<DD>Default no-argument constructor.
<P>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="getResources()"><!-- --></A><H3>
getResources</H3>
<PRE>
public static <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>,<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>&gt; <A HREF="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.69"><B>getResources</B></A>()</PRE>
<DL>
<DD>Returns the ThreadLocal Map. This Map is used internally to bind objects
to the current thread by storing each object under a unique key.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the map of bound resources</DL>
</DD>
</DL>
<HR>
<A NAME="setResources(java.util.Map)"><!-- --></A><H3>
setResources</H3>
<PRE>
public static void <A HREF="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.81"><B>setResources</B></A>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>,<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>&gt;&nbsp;newResources)</PRE>
<DL>
<DD>Allows a caller to explicitly set the entire resource map. This operation overwrites everything that existed
previously in the ThreadContext - if you need to retain what was on the thread prior to calling this method,
call the <A HREF="../../../../org/apache/shiro/util/ThreadContext.html#getResources()"><CODE>getResources()</CODE></A> method, which will give you the existing state.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>newResources</CODE> - the resources to replace the existing <A HREF="../../../../org/apache/shiro/util/ThreadContext.html#getResources()"><CODE>resources</CODE></A>.<DT><B>Since:</B></DT>
<DD>1.0</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="get(java.lang.Object)"><!-- --></A><H3>
get</H3>
<PRE>
public static <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> <A HREF="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.110"><B>get</B></A>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>&nbsp;key)</PRE>
<DL>
<DD>Returns the object for the specified <code>key</code> that is bound to
the current thread.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>key</CODE> - the key that identifies the value to return
<DT><B>Returns:</B><DD>the object keyed by <code>key</code> or <code>null</code> if
no value exists for the specified <code>key</code></DL>
</DD>
</DL>
<HR>
<A NAME="put(java.lang.Object, java.lang.Object)"><!-- --></A><H3>
put</H3>
<PRE>
public static void <A HREF="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.140"><B>put</B></A>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>&nbsp;key,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>&nbsp;value)</PRE>
<DL>
<DD>Binds <tt>value</tt> for the given <code>key</code> to the current thread.
<p/>
<p>A <tt>null</tt> <tt>value</tt> has the same effect as if <tt>remove</tt> was called for the given
<tt>key</tt>, i.e.:
<p/>
<pre>
if ( value == null ) {
remove( key );
}</pre>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>key</CODE> - The key with which to identify the <code>value</code>.<DD><CODE>value</CODE> - The value to bind to the thread.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if the <code>key</code> argument is <tt>null</tt>.</DL>
</DD>
</DL>
<HR>
<A NAME="remove(java.lang.Object)"><!-- --></A><H3>
remove</H3>
<PRE>
public static <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> <A HREF="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.167"><B>remove</B></A>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>&nbsp;key)</PRE>
<DL>
<DD>Unbinds the value for the given <code>key</code> from the current
thread.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>key</CODE> - The key identifying the value bound to the current thread.
<DT><B>Returns:</B><DD>the object unbound or <tt>null</tt> if there was nothing bound
under the specified <tt>key</tt> name.</DL>
</DD>
</DL>
<HR>
<A NAME="remove()"><!-- --></A><H3>
remove</H3>
<PRE>
public static void <A HREF="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.187"><B>remove</B></A>()</PRE>
<DL>
<DD><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/ThreadLocal.html?is-external=true#remove()" title="class or interface in java.lang"><CODE>Remove</CODE></A>s the underlying <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/ThreadLocal.html?is-external=true" title="class or interface in java.lang"><CODE>ThreadLocal</CODE></A> from the thread.
<p/>
This method is meant to be the final 'clean up' operation that is called at the end of thread execution to
prevent thread corruption in pooled thread environments.
<P>
<DD><DL>
<DT><B>Since:</B></DT>
<DD>1.0</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="getSecurityManager()"><!-- --></A><H3>
getSecurityManager</H3>
<PRE>
public static <A HREF="../../../../org/apache/shiro/mgt/SecurityManager.html" title="interface in org.apache.shiro.mgt">SecurityManager</A> <A HREF="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.206"><B>getSecurityManager</B></A>()</PRE>
<DL>
<DD>Convenience method that simplifies retrieval of the application's SecurityManager instance from the current
thread. If there is no SecurityManager bound to the thread (probably because framework code did not bind it
to the thread), this method returns <tt>null</tt>.
<p/>
It is merely a convenient wrapper for the following:
<p/>
<code>return (SecurityManager)get( SECURITY_MANAGER_KEY );</code>
<p/>
This method only returns the bound value if it exists - it does not remove it
from the thread. To remove it, one must call <A HREF="../../../../org/apache/shiro/util/ThreadContext.html#unbindSecurityManager()"><CODE>unbindSecurityManager()</CODE></A> instead.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the Subject object bound to the thread, or <tt>null</tt> if there isn't one bound.<DT><B>Since:</B></DT>
<DD>0.9</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="bind(org.apache.shiro.mgt.SecurityManager)"><!-- --></A><H3>
bind</H3>
<PRE>
public static void <A HREF="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.227"><B>bind</B></A>(<A HREF="../../../../org/apache/shiro/mgt/SecurityManager.html" title="interface in org.apache.shiro.mgt">SecurityManager</A>&nbsp;securityManager)</PRE>
<DL>
<DD>Convenience method that simplifies binding the application's SecurityManager instance to the ThreadContext.
<p/>
<p>The method's existence is to help reduce casting in code and to simplify remembering of
ThreadContext key names. The implementation is simple in that, if the SecurityManager is not <tt>null</tt>,
it binds it to the thread, i.e.:
<p/>
<pre>
if (securityManager != null) {
put( SECURITY_MANAGER_KEY, securityManager);
}</pre>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>securityManager</CODE> - the application's SecurityManager instance to bind to the thread. If the argument is
null, nothing will be done.<DT><B>Since:</B></DT>
<DD>0.9</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="unbindSecurityManager()"><!-- --></A><H3>
unbindSecurityManager</H3>
<PRE>
public static <A HREF="../../../../org/apache/shiro/mgt/SecurityManager.html" title="interface in org.apache.shiro.mgt">SecurityManager</A> <A HREF="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.248"><B>unbindSecurityManager</B></A>()</PRE>
<DL>
<DD>Convenience method that simplifies removal of the application's SecurityManager instance from the thread.
<p/>
The implementation just helps reduce casting and remembering of the ThreadContext key name, i.e it is
merely a conveient wrapper for the following:
<p/>
<code>return (SecurityManager)remove( SECURITY_MANAGER_KEY );</code>
<p/>
If you wish to just retrieve the object from the thread without removing it (so it can be retrieved later
during thread execution), use the <A HREF="../../../../org/apache/shiro/util/ThreadContext.html#getSecurityManager()"><CODE>getSecurityManager()</CODE></A> method instead.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the application's SecurityManager instance previously bound to the thread, or <tt>null</tt> if there
was none bound.<DT><B>Since:</B></DT>
<DD>0.9</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="getSubject()"><!-- --></A><H3>
getSubject</H3>
<PRE>
public static <A HREF="../../../../org/apache/shiro/subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</A> <A HREF="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.265"><B>getSubject</B></A>()</PRE>
<DL>
<DD>Convenience method that simplifies retrieval of a thread-bound Subject. If there is no
Subject bound to the thread, this method returns <tt>null</tt>. It is merely a convenient wrapper
for the following:
<p/>
<code>return (Subject)get( SUBJECT_KEY );</code>
<p/>
This method only returns the bound value if it exists - it does not remove it
from the thread. To remove it, one must call <A HREF="../../../../org/apache/shiro/util/ThreadContext.html#unbindSubject()"><CODE>unbindSubject()</CODE></A> instead.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the Subject object bound to the thread, or <tt>null</tt> if there isn't one bound.<DT><B>Since:</B></DT>
<DD>0.2</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="bind(org.apache.shiro.subject.Subject)"><!-- --></A><H3>
bind</H3>
<PRE>
public static void <A HREF="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.285"><B>bind</B></A>(<A HREF="../../../../org/apache/shiro/subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</A>&nbsp;subject)</PRE>
<DL>
<DD>Convenience method that simplifies binding a Subject to the ThreadContext.
<p/>
<p>The method's existence is to help reduce casting in your own code and to simplify remembering of
ThreadContext key names. The implementation is simple in that, if the Subject is not <tt>null</tt>,
it binds it to the thread, i.e.:
<p/>
<pre>
if (subject != null) {
put( SUBJECT_KEY, subject );
}</pre>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>subject</CODE> - the Subject object to bind to the thread. If the argument is null, nothing will be done.<DT><B>Since:</B></DT>
<DD>0.2</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="unbindSubject()"><!-- --></A><H3>
unbindSubject</H3>
<PRE>
public static <A HREF="../../../../org/apache/shiro/subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</A> <A HREF="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.305"><B>unbindSubject</B></A>()</PRE>
<DL>
<DD>Convenience method that simplifies removal of a thread-local Subject from the thread.
<p/>
The implementation just helps reduce casting and remembering of the ThreadContext key name, i.e it is
merely a conveient wrapper for the following:
<p/>
<code>return (Subject)remove( SUBJECT_KEY );</code>
<p/>
If you wish to just retrieve the object from the thread without removing it (so it can be retrieved later during
thread execution), you should use the <A HREF="../../../../org/apache/shiro/util/ThreadContext.html#getSubject()"><CODE>getSubject()</CODE></A> method for that purpose.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the Subject object previously bound to the thread, or <tt>null</tt> if there was none bound.<DT><B>Since:</B></DT>
<DD>0.2</DD>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ThreadContext.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../org/apache/shiro/util/StringUtils.html" title="class in org.apache.shiro.util"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../org/apache/shiro/util/ThreadState.html" title="interface in org.apache.shiro.util"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?org/apache/shiro/util/ThreadContext.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="ThreadContext.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright &#169; 2004-2014 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.
</BODY>
</HTML>