blob: d20d500d7d1efc91442ba5c396858766cf83c929 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>ServletContainerInitializer</title>
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="ServletContainerInitializer";
}
}
catch(err) {
}
//-->
var methods = {"i0":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</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">
<li><a href="../../javax/servlet/ServletConfig.html" title="interface in javax.servlet"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../javax/servlet/ServletContext.html" title="interface in javax.servlet"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?javax/servlet/ServletContainerInitializer.html" target="_top">Frames</a></li>
<li><a href="ServletContainerInitializer.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../allclasses-noframe.html">All&nbsp;Classes</a></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>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">javax.servlet</div>
<h2 title="Interface ServletContainerInitializer" class="title">Interface ServletContainerInitializer</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public interface <span class="typeNameLabel">ServletContainerInitializer</span></pre>
<div class="block">Interface which allows a library/runtime to be notified of a web
application's startup phase and perform any required programmatic
registration of servlets, filters, and listeners in response to it.
<p>Implementations of this interface may be annotated with
<a href="../../javax/servlet/annotation/HandlesTypes.html" title="annotation in javax.servlet.annotation"><code>HandlesTypes</code></a>, in order to
receive (at their <a href="../../javax/servlet/ServletContainerInitializer.html#onStartup-java.util.Set-javax.servlet.ServletContext-"><code>onStartup(java.util.Set&lt;java.lang.Class&lt;?&gt;&gt;, javax.servlet.ServletContext)</code></a> method) the Set of application
classes that implement, extend, or have been annotated with the class
types specified by the annotation.
<p>If an implementation of this interface does not use <tt>HandlesTypes</tt>
annotation, or none of the application classes match the ones specified
by the annotation, the container must pass a <tt>null</tt> Set of classes
to <a href="../../javax/servlet/ServletContainerInitializer.html#onStartup-java.util.Set-javax.servlet.ServletContext-"><code>onStartup(java.util.Set&lt;java.lang.Class&lt;?&gt;&gt;, javax.servlet.ServletContext)</code></a>.
<p>When examining the classes of an application to see if they match
any of the criteria specified by the <tt>HandlesTypes</tt> annotation
of a <tt>ServletContainerInitializer</tt>, the container may run into
classloading problems if any of the application's optional JAR
files are missing. Because the container is not in a position to decide
whether these types of classloading failures will prevent
the application from working correctly, it must ignore them,
while at the same time providing a configuration option that would
log them.
<p>Implementations of this interface must be declared by a JAR file
resource located inside the <tt>META-INF/services</tt> directory and
named for the fully qualified class name of this interface, and will be
discovered using the runtime's service provider lookup mechanism
or a container specific mechanism that is semantically equivalent to
it. In either case, <tt>ServletContainerInitializer</tt> services from web
fragment JAR files excluded from an absolute ordering must be ignored,
and the order in which these services are discovered must follow the
application's classloading delegation model.</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Servlet 3.0</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../javax/servlet/annotation/HandlesTypes.html" title="annotation in javax.servlet.annotation"><code>HandlesTypes</code></a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<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="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContainerInitializer.html#onStartup-java.util.Set-javax.servlet.ServletContext-">onStartup</a></span>(java.util.Set&lt;java.lang.Class&lt;?&gt;&gt;&nbsp;c,
<a href="../../javax/servlet/ServletContext.html" title="interface in javax.servlet">ServletContext</a>&nbsp;ctx)</code>
<div class="block">Notifies this <tt>ServletContainerInitializer</tt> of the startup
of the application represented by the given <tt>ServletContext</tt>.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="onStartup-java.util.Set-javax.servlet.ServletContext-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>onStartup</h4>
<pre>void&nbsp;onStartup(java.util.Set&lt;java.lang.Class&lt;?&gt;&gt;&nbsp;c,
<a href="../../javax/servlet/ServletContext.html" title="interface in javax.servlet">ServletContext</a>&nbsp;ctx)
throws <a href="../../javax/servlet/ServletException.html" title="class in javax.servlet">ServletException</a></pre>
<div class="block">Notifies this <tt>ServletContainerInitializer</tt> of the startup
of the application represented by the given <tt>ServletContext</tt>.
<p>If this <tt>ServletContainerInitializer</tt> is bundled in a JAR
file inside the <tt>WEB-INF/lib</tt> directory of an application,
its <tt>onStartup</tt> method will be invoked only once during the
startup of the bundling application. If this
<tt>ServletContainerInitializer</tt> is bundled inside a JAR file
outside of any <tt>WEB-INF/lib</tt> directory, but still
discoverable as described above, its <tt>onStartup</tt> method
will be invoked every time an application is started.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>c</code> - the Set of application classes that extend, implement, or
have been annotated with the class types specified by the
<a href="../../javax/servlet/annotation/HandlesTypes.html" title="annotation in javax.servlet.annotation"><code>HandlesTypes</code></a> annotation,
or <tt>null</tt> if there are no matches, or this
<tt>ServletContainerInitializer</tt> has not been annotated with
<tt>HandlesTypes</tt></dd>
<dd><code>ctx</code> - the <tt>ServletContext</tt> of the web application that
is being started and in which the classes contained in <tt>c</tt>
were found</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/servlet/ServletException.html" title="class in javax.servlet">ServletException</a></code> - if an error has occurred</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</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">
<li><a href="../../javax/servlet/ServletConfig.html" title="interface in javax.servlet"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../javax/servlet/ServletContext.html" title="interface in javax.servlet"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?javax/servlet/ServletContainerInitializer.html" target="_top">Frames</a></li>
<li><a href="ServletContainerInitializer.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../allclasses-noframe.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>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>