| <!DOCTYPE HTML> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc --> |
| <title>ThreadContext (Apache Shiro :: Core 1.9.1 API)</title> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../jquery/jquery-ui.css" title="Style"> |
| <script type="text/javascript" src="../../../../script.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jszip/dist/jszip.min.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script> |
| <!--[if IE]> |
| <script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script> |
| <![endif]--> |
| <script type="text/javascript" src="../../../../jquery/jquery-3.5.1.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jquery-ui.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="ThreadContext (Apache Shiro :: Core 1.9.1 API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var data = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9,"i6":9,"i7":9,"i8":9,"i9":9,"i10":9,"i11":9}; |
| var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| var pathtoroot = "../../../../"; |
| var useModuleDirectories = true; |
| loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <header role="banner"> |
| <nav role="navigation"> |
| <div class="fixedNav"><!-- Matomo --> <script> var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ /* We explicitly disable cookie tracking to avoid privacy issues */ _paq.push(['disableCookies']); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="//matomo.privacy.apache.org/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', '2']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); </script> <!-- End Matomo Code --> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a id="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/ThreadContext.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../allclasses.html">All Classes</a></li> |
| </ul> |
| <ul class="navListSearch"> |
| <li><label for="search">SEARCH:</label> |
| <input type="text" id="search" value="search" disabled="disabled"> |
| <input type="reset" id="reset" value="reset" disabled="disabled"> |
| </li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| </div> |
| <div class="navPadding"> </div> |
| <script type="text/javascript"><!-- |
| $('.navPadding').css('padding-top', $('.fixedNav').css("height")); |
| //--> |
| </script> |
| </nav> |
| </header> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <main role="main"> |
| <div class="header"> |
| <div class="subTitle"><span class="packageLabelInType">Package</span> <a href="package-summary.html">org.apache.shiro.util</a></div> |
| <h2 title="Class ThreadContext" class="title">Class ThreadContext</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">java.lang.Object</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.apache.shiro.util.ThreadContext</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <pre>public abstract class <a href="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.46">ThreadContext</a> |
| extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></pre> |
| <div class="block">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="https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html?is-external=true" title="class or interface in java.util" class="externalLink"><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></div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.1</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="#remove()"><code>remove()</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- =========== FIELD SUMMARY =========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="field.summary"> |
| <!-- --> |
| </a> |
| <h3>Field Summary</h3> |
| <table class="memberSummary"> |
| <caption><span>Fields</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colSecond" scope="col">Field</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#SECURITY_MANAGER_KEY">SECURITY_MANAGER_KEY</a></span></code></th> |
| <td class="colLast"> </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#SUBJECT_KEY">SUBJECT_KEY</a></span></code></th> |
| <td class="colLast"> </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </section> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="constructor.summary"> |
| <!-- --> |
| </a> |
| <h3>Constructor Summary</h3> |
| <table class="memberSummary"> |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier</th> |
| <th class="colSecond" scope="col">Constructor</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>protected </code></td> |
| <th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E()">ThreadContext</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Default no-argument constructor.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </section> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colSecond" scope="col">Method</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#bind(org.apache.shiro.mgt.SecurityManager)">bind</a></span>​(<a href="../mgt/SecurityManager.html" title="interface in org.apache.shiro.mgt">SecurityManager</a> securityManager)</code></th> |
| <td class="colLast"> |
| <div class="block">Convenience method that simplifies binding the application's SecurityManager instance to the ThreadContext.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#bind(org.apache.shiro.subject.Subject)">bind</a></span>​(<a href="../subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</a> subject)</code></th> |
| <td class="colLast"> |
| <div class="block">Convenience method that simplifies binding a Subject to the ThreadContext.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#get(java.lang.Object)">get</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a> key)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the object for the specified <code>key</code> that is bound to |
| the current thread.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util" class="externalLink">Map</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>,​<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getResources()">getResources</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the ThreadLocal Map.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>static <a href="../mgt/SecurityManager.html" title="interface in org.apache.shiro.mgt">SecurityManager</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getSecurityManager()">getSecurityManager</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Convenience method that simplifies retrieval of the application's SecurityManager instance from the current |
| thread.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code>static <a href="../subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getSubject()">getSubject</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Convenience method that simplifies retrieval of a thread-bound Subject.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#put(java.lang.Object,java.lang.Object)">put</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a> key, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a> value)</code></th> |
| <td class="colLast"> |
| <div class="block">Binds <tt>value</tt> for the given <code>key</code> to the current thread.</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#remove()">remove</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ThreadLocal.html?is-external=true#remove()" title="class or interface in java.lang" class="externalLink"><code>Remove</code></a>s the underlying <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ThreadLocal.html?is-external=true" title="class or interface in java.lang" class="externalLink"><code>ThreadLocal</code></a> from the thread.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#remove(java.lang.Object)">remove</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a> key)</code></th> |
| <td class="colLast"> |
| <div class="block">Unbinds the value for the given <code>key</code> from the current |
| thread.</div> |
| </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setResources(java.util.Map)">setResources</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util" class="externalLink">Map</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>,​<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>> newResources)</code></th> |
| <td class="colLast"> |
| <div class="block">Allows a caller to explicitly set the entire resource map.</div> |
| </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code>static <a href="../mgt/SecurityManager.html" title="interface in org.apache.shiro.mgt">SecurityManager</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#unbindSecurityManager()">unbindSecurityManager</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Convenience method that simplifies removal of the application's SecurityManager instance from the thread.</div> |
| </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code>static <a href="../subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#unbindSubject()">unbindSubject</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Convenience method that simplifies removal of a thread-local Subject from the thread.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a id="methods.inherited.from.class.java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></h3> |
| <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang" class="externalLink">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang" class="externalLink">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang" class="externalLink">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang" class="externalLink">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang" class="externalLink">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang" class="externalLink">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang" class="externalLink">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang" class="externalLink">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long,int)" title="class or interface in java.lang" class="externalLink">wait</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ FIELD DETAIL =========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="field.detail"> |
| <!-- --> |
| </a> |
| <h3>Field Detail</h3> |
| <a id="SECURITY_MANAGER_KEY"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>SECURITY_MANAGER_KEY</h4> |
| <pre>public static final <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> <a href="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.53">SECURITY_MANAGER_KEY</a></pre> |
| </li> |
| </ul> |
| <a id="SUBJECT_KEY"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>SUBJECT_KEY</h4> |
| <pre>public static final <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> <a href="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.54">SUBJECT_KEY</a></pre> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="constructor.detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a id="<init>()"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>ThreadContext</h4> |
| <pre>protected <a href="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.61">ThreadContext</a>()</pre> |
| <div class="block">Default no-argument constructor.</div> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| <!-- ============ METHOD DETAIL ========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a id="getResources()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getResources</h4> |
| <pre class="methodSignature">public static <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util" class="externalLink">Map</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>,​<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>> <a href="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.70">getResources</a>()</pre> |
| <div class="block">Returns the ThreadLocal Map. This Map is used internally to bind objects |
| to the current thread by storing each object under a unique key.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the map of bound resources</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="setResources(java.util.Map)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setResources</h4> |
| <pre class="methodSignature">public static void <a href="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.86">setResources</a>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util" class="externalLink">Map</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>,​<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>> newResources)</pre> |
| <div class="block">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="#getResources()"><code>getResources()</code></a> method, which will give you the existing state.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>newResources</code> - the resources to replace the existing <a href="#getResources()"><code>resources</code></a>.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>1.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="get(java.lang.Object)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>get</h4> |
| <pre class="methodSignature">public static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a> <a href="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.123">get</a>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a> key)</pre> |
| <div class="block">Returns the object for the specified <code>key</code> that is bound to |
| the current thread.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>key</code> - the key that identifies the value to return</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the object keyed by <code>key</code> or <code>null</code> if |
| no value exists for the specified <code>key</code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="put(java.lang.Object,java.lang.Object)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>put</h4> |
| <pre class="methodSignature">public static void <a href="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.153">put</a>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a> key, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a> value)</pre> |
| <div class="block">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></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>key</code> - The key with which to identify the <code>value</code>.</dd> |
| <dd><code>value</code> - The value to bind to the thread.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalArgumentException</a></code> - if the <code>key</code> argument is <tt>null</tt>.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="remove(java.lang.Object)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>remove</h4> |
| <pre class="methodSignature">public static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a> <a href="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.181">remove</a>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a> key)</pre> |
| <div class="block">Unbinds the value for the given <code>key</code> from the current |
| thread.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>key</code> - The key identifying the value bound to the current thread.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the object unbound or <tt>null</tt> if there was nothing bound |
| under the specified <tt>key</tt> name.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="remove()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>remove</h4> |
| <pre class="methodSignature">public static void <a href="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.202">remove</a>()</pre> |
| <div class="block"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ThreadLocal.html?is-external=true#remove()" title="class or interface in java.lang" class="externalLink"><code>Remove</code></a>s the underlying <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ThreadLocal.html?is-external=true" title="class or interface in java.lang" class="externalLink"><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.</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>1.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getSecurityManager()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getSecurityManager</h4> |
| <pre class="methodSignature">public static <a href="../mgt/SecurityManager.html" title="interface in org.apache.shiro.mgt">SecurityManager</a> <a href="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.221">getSecurityManager</a>()</pre> |
| <div class="block">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="#unbindSecurityManager()"><code>unbindSecurityManager()</code></a> instead.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the Subject object bound to the thread, or <tt>null</tt> if there isn't one bound.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.9</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="bind(org.apache.shiro.mgt.SecurityManager)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>bind</h4> |
| <pre class="methodSignature">public static void <a href="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.242">bind</a>​(<a href="../mgt/SecurityManager.html" title="interface in org.apache.shiro.mgt">SecurityManager</a> securityManager)</pre> |
| <div class="block">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></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>securityManager</code> - the application's SecurityManager instance to bind to the thread. If the argument is |
| null, nothing will be done.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.9</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="unbindSecurityManager()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>unbindSecurityManager</h4> |
| <pre class="methodSignature">public static <a href="../mgt/SecurityManager.html" title="interface in org.apache.shiro.mgt">SecurityManager</a> <a href="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.263">unbindSecurityManager</a>()</pre> |
| <div class="block">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 convenient 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="#getSecurityManager()"><code>getSecurityManager()</code></a> method instead.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the application's SecurityManager instance previously bound to the thread, or <tt>null</tt> if there |
| was none bound.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.9</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getSubject()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getSubject</h4> |
| <pre class="methodSignature">public static <a href="../subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</a> <a href="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.280">getSubject</a>()</pre> |
| <div class="block">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="#unbindSubject()"><code>unbindSubject()</code></a> instead.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the Subject object bound to the thread, or <tt>null</tt> if there isn't one bound.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.2</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="bind(org.apache.shiro.subject.Subject)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>bind</h4> |
| <pre class="methodSignature">public static void <a href="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.300">bind</a>​(<a href="../subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</a> subject)</pre> |
| <div class="block">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></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>subject</code> - the Subject object to bind to the thread. If the argument is null, nothing will be done.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.2</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="unbindSubject()"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>unbindSubject</h4> |
| <pre class="methodSignature">public static <a href="../subject/Subject.html" title="interface in org.apache.shiro.subject">Subject</a> <a href="../../../../src-html/org/apache/shiro/util/ThreadContext.html#line.320">unbindSubject</a>()</pre> |
| <div class="block">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 convenient 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="#getSubject()"><code>getSubject()</code></a> method for that purpose.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the Subject object previously bound to the thread, or <tt>null</tt> if there was none bound.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>0.2</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </main> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <footer role="contentinfo"> |
| <nav role="navigation"> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a id="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/ThreadContext.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../allclasses.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </nav> |
| <p class="legalCopy"><small>Copyright © 2004–2022 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> |
| </footer> |
| </body> |
| </html> |