blob: 9796bef7397b1202b074af749a8257363804c067 [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>EnvironmentLoader (Apache Shiro :: Web 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="EnvironmentLoader (Apache Shiro :: Web 1.9.1 API)";
}
}
catch(err) {
}
//-->
var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":42,"i5":10,"i6":10,"i7":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"],32:["t6","Deprecated 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/EnvironmentLoader.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&nbsp;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:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</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">&nbsp;</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>&nbsp;<a href="package-summary.html">org.apache.shiro.web.env</a></div>
<h2 title="Class EnvironmentLoader" class="title">Class EnvironmentLoader</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.web.env.EnvironmentLoader</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>Direct Known Subclasses:</dt>
<dd><code><a href="EnvironmentLoaderListener.html" title="class in org.apache.shiro.web.env">EnvironmentLoaderListener</a></code></dd>
</dl>
<hr>
<pre>public class <a href="../../../../../src-html/org/apache/shiro/web/env/EnvironmentLoader.html#line.97">EnvironmentLoader</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">An <code>EnvironmentLoader</code> is responsible for loading a web application's Shiro <a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env"><code>WebEnvironment</code></a>
(which includes the web app's <a href="../mgt/WebSecurityManager.html" title="interface in org.apache.shiro.web.mgt"><code>WebSecurityManager</code></a>) into the
<code>ServletContext</code> at application startup.
<p/>
In Shiro 1.1 and earlier, the Shiro ServletFilter was responsible for creating the <code>WebSecurityManager</code> and
any additional objects (security filters, etc). However, any component not filtered by the Shiro Filter (such
as other context listeners) was not able to easily acquire the these objects to perform security operations.
<p/>
Due to this, in Shiro 1.2 and later, this <code>EnvironmentLoader</code> (or more likely, the
<a href="EnvironmentLoaderListener.html" title="class in org.apache.shiro.web.env"><code>EnvironmentLoaderListener</code></a> subclass) is the preferred mechanism to initialize
a Shiro environment. The Shiro Filter, while still required for request filtering, will not perform this
initialization at startup if the <code>EnvironmentLoader</code> (or listener) runs first.
<h2>Usage</h2>
This implementation will look for two servlet context <code>context-param</code>s in <code>web.xml</code>:
<code>shiroEnvironmentClass</code> and <code>shiroConfigLocations</code> that customize how the <code>WebEnvironment</code> instance
will be initialized.
<h3>shiroEnvironmentClass</h3>
The <code>shiroEnvironmentClass</code> <code>context-param</code>, if it exists, allows you to specify the
fully-qualified implementation class name of the <a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env"><code>WebEnvironment</code></a> to instantiate. For example:
<pre>
&lt;context-param&gt;
&lt;param-name&gt;shiroEnvironmentClass&lt;/param-name&gt;
&lt;param-value&gt;com.foo.bar.shiro.MyWebEnvironment&lt;/param-value&gt;
&lt;/context-param&gt;
</pre>
If not specified, the default value is the <a href="IniWebEnvironment.html" title="class in org.apache.shiro.web.env"><code>IniWebEnvironment</code></a> class, which assumes Shiro's default
<a href="http://shiro.apache.org/configuration.html">INI configuration format</a>
<h3>shiroConfigLocations</h3>
The <code>shiroConfigLocations</code> <code>context-param</code>, if it exists, allows you to specify the config location(s)
(resource path(s)) that will be relayed to the instantiated <a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env"><code>WebEnvironment</code></a>. For example:
<pre>
&lt;context-param&gt;
&lt;param-name&gt;shiroConfigLocations&lt;/param-name&gt;
&lt;param-value&gt;/WEB-INF/someLocation/shiro.ini&lt;/param-value&gt;
&lt;/context-param&gt;
</pre>
The <code>WebEnvironment</code> implementation must implement the <code>ResourceConfigurable</code> interface if it is to
acquire the <code>shiroConfigLocations</code> value.
<p/>
If this <code>context-param</code> is not specified, the <code>WebEnvironment</code> instance determines default resource
lookup behavior. For example, the <a href="IniWebEnvironment.html" title="class in org.apache.shiro.web.env"><code>IniWebEnvironment</code></a> will check the following two locations for INI config
by default (in order):
<ol>
<li>/WEB-INF/shiro.ini</li>
<li>classpath:shiro.ini</li>
</ol>
<h2>Web Security Enforcement</h2>
Using this loader will only initialize Shiro's environment in a web application - it will not filter web requests or
perform web-specific security operations. To do this, you must ensure that you have also configured the
<a href="../servlet/ShiroFilter.html" title="class in org.apache.shiro.web.servlet"><code>ShiroFilter</code></a> in <code>web.xml</code>.
<p/>
Finally, it should be noted that this implementation was based on ideas in Spring 3's
<code>org.springframework.web.context.ContextLoader</code> implementation - no need to reinvent the wheel for this common
behavior.</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.2</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="EnvironmentLoaderListener.html" title="class in org.apache.shiro.web.env"><code>EnvironmentLoaderListener</code></a>,
<a href="../servlet/ShiroFilter.html" title="class in org.apache.shiro.web.servlet"><code>ShiroFilter</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">&nbsp;</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="#CONFIG_LOCATIONS_PARAM">CONFIG_LOCATIONS_PARAM</a></span></code></th>
<td class="colLast">
<div class="block">Servlet Context config param for the resource path to use for configuring the <a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env"><code>WebEnvironment</code></a> instance:
<code>shiroConfigLocations</code></div>
</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="#ENVIRONMENT_ATTRIBUTE_KEY">ENVIRONMENT_ATTRIBUTE_KEY</a></span></code></th>
<td class="colLast">&nbsp;</td>
</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="#ENVIRONMENT_CLASS_PARAM">ENVIRONMENT_CLASS_PARAM</a></span></code></th>
<td class="colLast">
<div class="block">Servlet Context config param for specifying the <a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env"><code>WebEnvironment</code></a> implementation class to use:
<code>shiroEnvironmentClass</code></div>
</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">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Constructor</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E()">EnvironmentLoader</a></span>()</code></th>
<td class="colLast">&nbsp;</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">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t6" class="tableTab"><span><a href="javascript:show(32);">Deprecated Methods</a></span><span class="tabEnd">&nbsp;</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>protected <a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env">WebEnvironment</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#createEnvironment(javax.servlet.ServletContext)">createEnvironment</a></span>&#8203;(<a href="https://docs.oracle.com/javaee/5/api/javax/servlet/ServletContext.html?is-external=true" title="class or interface in javax.servlet" class="externalLink">ServletContext</a>&nbsp;sc)</code></th>
<td class="colLast">
<div class="block">Instantiates a <a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env"><code>WebEnvironment</code></a> based on the specified ServletContext.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>protected void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#customizeEnvironment(org.apache.shiro.web.env.WebEnvironment)">customizeEnvironment</a></span>&#8203;(<a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env">WebEnvironment</a>&nbsp;environment)</code></th>
<td class="colLast">
<div class="block">Any additional customization of the Environment can be by overriding this method.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#destroyEnvironment(javax.servlet.ServletContext)">destroyEnvironment</a></span>&#8203;(<a href="https://docs.oracle.com/javaee/5/api/javax/servlet/ServletContext.html?is-external=true" title="class or interface in javax.servlet" class="externalLink">ServletContext</a>&nbsp;servletContext)</code></th>
<td class="colLast">
<div class="block">Destroys the <a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env"><code>WebEnvironment</code></a> for the given servlet context.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>protected <a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env">WebEnvironment</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#determineWebEnvironment(javax.servlet.ServletContext)">determineWebEnvironment</a></span>&#8203;(<a href="https://docs.oracle.com/javaee/5/api/javax/servlet/ServletContext.html?is-external=true" title="class or interface in javax.servlet" class="externalLink">ServletContext</a>&nbsp;servletContext)</code></th>
<td class="colLast">
<div class="block">Return the WebEnvironment implementation class to use, based on the order of:
A custom WebEnvironment class - specified in the <code>servletContext</code> <a href="#ENVIRONMENT_ATTRIBUTE_KEY"><code>ENVIRONMENT_ATTRIBUTE_KEY</code></a> property
<code>ServiceLoader.load(WebEnvironment.class)</code> - (if more then one instance is found a <code>ConfigurationException</code> will be thrown
A call to <a href="#getDefaultWebEnvironmentClass()"><code>getDefaultWebEnvironmentClass()</code></a> (default: <a href="IniWebEnvironment.html" title="class in org.apache.shiro.web.env"><code>IniWebEnvironment</code></a>)
</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>protected <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a>&lt;?&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#determineWebEnvironmentClass(javax.servlet.ServletContext)">determineWebEnvironmentClass</a></span>&#8203;(<a href="https://docs.oracle.com/javaee/5/api/javax/servlet/ServletContext.html?is-external=true" title="class or interface in javax.servlet" class="externalLink">ServletContext</a>&nbsp;servletContext)</code></th>
<td class="colLast">
<div class="block"><span class="deprecatedLabel">Deprecated.</span>
<div class="deprecationComment">This method is not longer used by Shiro, and will be removed in future versions,
use <a href="#determineWebEnvironment(javax.servlet.ServletContext)"><code>determineWebEnvironment(ServletContext)</code></a> or <a href="#determineWebEnvironment(javax.servlet.ServletContext)"><code>determineWebEnvironment(ServletContext)</code></a></div>
</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>protected void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#finalizeEnvironment(org.apache.shiro.web.env.WebEnvironment)">finalizeEnvironment</a></span>&#8203;(<a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env">WebEnvironment</a>&nbsp;environment)</code></th>
<td class="colLast">
<div class="block">Any additional cleanup of the Environment can be done by overriding this method.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>protected <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a>&lt;? extends <a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env">WebEnvironment</a>&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getDefaultWebEnvironmentClass()">getDefaultWebEnvironmentClass</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the default WebEnvironment class, which is unless overridden: <a href="IniWebEnvironment.html" title="class in org.apache.shiro.web.env"><code>IniWebEnvironment</code></a>.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code><a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env">WebEnvironment</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#initEnvironment(javax.servlet.ServletContext)">initEnvironment</a></span>&#8203;(<a href="https://docs.oracle.com/javaee/5/api/javax/servlet/ServletContext.html?is-external=true" title="class or interface in javax.servlet" class="externalLink">ServletContext</a>&nbsp;servletContext)</code></th>
<td class="colLast">
<div class="block">Initializes Shiro's <a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env"><code>WebEnvironment</code></a> instance for the specified <code>ServletContext</code> based on the
<a href="#CONFIG_LOCATIONS_PARAM"><code>CONFIG_LOCATIONS_PARAM</code></a> value.</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&nbsp;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="ENVIRONMENT_CLASS_PARAM">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ENVIRONMENT_CLASS_PARAM</h4>
<pre>public static final&nbsp;<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/web/env/EnvironmentLoader.html#line.103">ENVIRONMENT_CLASS_PARAM</a></pre>
<div class="block">Servlet Context config param for specifying the <a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env"><code>WebEnvironment</code></a> implementation class to use:
<code>shiroEnvironmentClass</code></div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#org.apache.shiro.web.env.EnvironmentLoader.ENVIRONMENT_CLASS_PARAM">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="CONFIG_LOCATIONS_PARAM">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>CONFIG_LOCATIONS_PARAM</h4>
<pre>public static final&nbsp;<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/web/env/EnvironmentLoader.html#line.109">CONFIG_LOCATIONS_PARAM</a></pre>
<div class="block">Servlet Context config param for the resource path to use for configuring the <a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env"><code>WebEnvironment</code></a> instance:
<code>shiroConfigLocations</code></div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#org.apache.shiro.web.env.EnvironmentLoader.CONFIG_LOCATIONS_PARAM">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="ENVIRONMENT_ATTRIBUTE_KEY">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>ENVIRONMENT_ATTRIBUTE_KEY</h4>
<pre>public static final&nbsp;<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/web/env/EnvironmentLoader.html#line.111">ENVIRONMENT_ATTRIBUTE_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="&lt;init&gt;()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>EnvironmentLoader</h4>
<pre>public&nbsp;<a href="../../../../../src-html/org/apache/shiro/web/env/EnvironmentLoader.html#line.97">EnvironmentLoader</a>()</pre>
</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="initEnvironment(javax.servlet.ServletContext)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>initEnvironment</h4>
<pre class="methodSignature">public&nbsp;<a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env">WebEnvironment</a>&nbsp;<a href="../../../../../src-html/org/apache/shiro/web/env/EnvironmentLoader.html#line.124">initEnvironment</a>&#8203;(<a href="https://docs.oracle.com/javaee/5/api/javax/servlet/ServletContext.html?is-external=true" title="class or interface in javax.servlet" class="externalLink">ServletContext</a>&nbsp;servletContext)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalStateException</a></pre>
<div class="block">Initializes Shiro's <a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env"><code>WebEnvironment</code></a> instance for the specified <code>ServletContext</code> based on the
<a href="#CONFIG_LOCATIONS_PARAM"><code>CONFIG_LOCATIONS_PARAM</code></a> value.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>servletContext</code> - current servlet context</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the new Shiro <code>WebEnvironment</code> instance.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang" class="externalLink">IllegalStateException</a></code> - if an existing WebEnvironment has already been initialized and associated with
the specified <code>ServletContext</code>.</dd>
</dl>
</li>
</ul>
<a id="determineWebEnvironmentClass(javax.servlet.ServletContext)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>determineWebEnvironmentClass</h4>
<pre class="methodSignature"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang" class="externalLink">@Deprecated</a>
protected&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a>&lt;?&gt;&nbsp;<a href="../../../../../src-html/org/apache/shiro/web/env/EnvironmentLoader.html#line.175">determineWebEnvironmentClass</a>&#8203;(<a href="https://docs.oracle.com/javaee/5/api/javax/servlet/ServletContext.html?is-external=true" title="class or interface in javax.servlet" class="externalLink">ServletContext</a>&nbsp;servletContext)</pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span>
<div class="deprecationComment">This method is not longer used by Shiro, and will be removed in future versions,
use <a href="#determineWebEnvironment(javax.servlet.ServletContext)"><code>determineWebEnvironment(ServletContext)</code></a> or <a href="#determineWebEnvironment(javax.servlet.ServletContext)"><code>determineWebEnvironment(ServletContext)</code></a></div>
</div>
<div class="block">Return the WebEnvironment implementation class to use, either the default
<a href="IniWebEnvironment.html" title="class in org.apache.shiro.web.env"><code>IniWebEnvironment</code></a> or a custom class if specified.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>servletContext</code> - current servlet context</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the WebEnvironment implementation class to use</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="#ENVIRONMENT_CLASS_PARAM"><code>ENVIRONMENT_CLASS_PARAM</code></a>,
<a href="IniWebEnvironment.html" title="class in org.apache.shiro.web.env"><code>IniWebEnvironment</code></a>,
<a href="#determineWebEnvironment(javax.servlet.ServletContext)"><code>determineWebEnvironment(ServletContext)</code></a>,
<a href="#getDefaultWebEnvironmentClass()"><code>getDefaultWebEnvironmentClass()</code></a></dd>
</dl>
</li>
</ul>
<a id="getDefaultWebEnvironmentClass()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getDefaultWebEnvironmentClass</h4>
<pre class="methodSignature">protected&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a>&lt;? extends <a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env">WebEnvironment</a>&gt;&nbsp;<a href="../../../../../src-html/org/apache/shiro/web/env/EnvironmentLoader.html#line.230">getDefaultWebEnvironmentClass</a>()</pre>
<div class="block">Returns the default WebEnvironment class, which is unless overridden: <a href="IniWebEnvironment.html" title="class in org.apache.shiro.web.env"><code>IniWebEnvironment</code></a>.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the default WebEnvironment class.</dd>
</dl>
</li>
</ul>
<a id="determineWebEnvironment(javax.servlet.ServletContext)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>determineWebEnvironment</h4>
<pre class="methodSignature">protected&nbsp;<a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env">WebEnvironment</a>&nbsp;<a href="../../../../../src-html/org/apache/shiro/web/env/EnvironmentLoader.html#line.248">determineWebEnvironment</a>&#8203;(<a href="https://docs.oracle.com/javaee/5/api/javax/servlet/ServletContext.html?is-external=true" title="class or interface in javax.servlet" class="externalLink">ServletContext</a>&nbsp;servletContext)</pre>
<div class="block">Return the WebEnvironment implementation class to use, based on the order of:
<ul>
<li>A custom WebEnvironment class - specified in the <code>servletContext</code> <a href="#ENVIRONMENT_ATTRIBUTE_KEY"><code>ENVIRONMENT_ATTRIBUTE_KEY</code></a> property</li>
<li><code>ServiceLoader.load(WebEnvironment.class)</code> - (if more then one instance is found a <code>ConfigurationException</code> will be thrown</li>
<li>A call to <a href="#getDefaultWebEnvironmentClass()"><code>getDefaultWebEnvironmentClass()</code></a> (default: <a href="IniWebEnvironment.html" title="class in org.apache.shiro.web.env"><code>IniWebEnvironment</code></a>)</li>
</ul></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>servletContext</code> - current servlet context</dd>
<dd><code>servletContext</code> - the <code>servletContext</code> to query the <code>ENVIRONMENT_ATTRIBUTE_KEY</code> property from</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the WebEnvironment implementation class to use</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="#ENVIRONMENT_CLASS_PARAM"><code>ENVIRONMENT_CLASS_PARAM</code></a></dd>
</dl>
</li>
</ul>
<a id="createEnvironment(javax.servlet.ServletContext)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createEnvironment</h4>
<pre class="methodSignature">protected&nbsp;<a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env">WebEnvironment</a>&nbsp;<a href="../../../../../src-html/org/apache/shiro/web/env/EnvironmentLoader.html#line.285">createEnvironment</a>&#8203;(<a href="https://docs.oracle.com/javaee/5/api/javax/servlet/ServletContext.html?is-external=true" title="class or interface in javax.servlet" class="externalLink">ServletContext</a>&nbsp;sc)</pre>
<div class="block">Instantiates a <a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env"><code>WebEnvironment</code></a> based on the specified ServletContext.
<p/>
This implementation <a href="#determineWebEnvironmentClass(javax.servlet.ServletContext)"><code>determines</code></a> a
<a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env"><code>WebEnvironment</code></a> implementation class to use. That class is instantiated, configured, and returned.
<p/>
This allows custom <code>WebEnvironment</code> implementations to be specified via a ServletContext init-param if
desired. If not specified, the default <a href="IniWebEnvironment.html" title="class in org.apache.shiro.web.env"><code>IniWebEnvironment</code></a> implementation will be used.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>sc</code> - current servlet context</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the constructed Shiro WebEnvironment instance</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="MutableWebEnvironment.html" title="interface in org.apache.shiro.web.env"><code>MutableWebEnvironment</code></a>,
<code>ResourceConfigurable</code></dd>
</dl>
</li>
</ul>
<a id="customizeEnvironment(org.apache.shiro.web.env.WebEnvironment)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>customizeEnvironment</h4>
<pre class="methodSignature">protected&nbsp;void&nbsp;<a href="../../../../../src-html/org/apache/shiro/web/env/EnvironmentLoader.html#line.323">customizeEnvironment</a>&#8203;(<a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env">WebEnvironment</a>&nbsp;environment)</pre>
<div class="block">Any additional customization of the Environment can be by overriding this method. For example setup shared
resources, etc. By default this method does nothing.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>environment</code> - </dd>
</dl>
</li>
</ul>
<a id="destroyEnvironment(javax.servlet.ServletContext)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>destroyEnvironment</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;<a href="../../../../../src-html/org/apache/shiro/web/env/EnvironmentLoader.html#line.331">destroyEnvironment</a>&#8203;(<a href="https://docs.oracle.com/javaee/5/api/javax/servlet/ServletContext.html?is-external=true" title="class or interface in javax.servlet" class="externalLink">ServletContext</a>&nbsp;servletContext)</pre>
<div class="block">Destroys the <a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env"><code>WebEnvironment</code></a> for the given servlet context.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>servletContext</code> - the ServletContext attributed to the WebSecurityManager</dd>
</dl>
</li>
</ul>
<a id="finalizeEnvironment(org.apache.shiro.web.env.WebEnvironment)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>finalizeEnvironment</h4>
<pre class="methodSignature">protected&nbsp;void&nbsp;<a href="../../../../../src-html/org/apache/shiro/web/env/EnvironmentLoader.html#line.350">finalizeEnvironment</a>&#8203;(<a href="WebEnvironment.html" title="interface in org.apache.shiro.web.env">WebEnvironment</a>&nbsp;environment)</pre>
<div class="block">Any additional cleanup of the Environment can be done by overriding this method. For example clean up shared
resources, etc. By default this method does nothing.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>environment</code> - </dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.3</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/EnvironmentLoader.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&nbsp;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:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</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 &#169; 2004&#x2013;2022 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</footer>
</body>
</html>