| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <title>ServletContext</title> |
| <link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../script.js"></script> |
| |
| <link rel="shortcut icon" href="/img/jakarta-favicon.ico"> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="ServletContext"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6,"i7":6,"i8":6,"i9":6,"i10":6,"i11":6,"i12":6,"i13":6,"i14":6,"i15":6,"i16":6,"i17":6,"i18":6,"i19":6,"i20":6,"i21":6,"i22":6,"i23":6,"i24":6,"i25":6,"i26":6,"i27":6,"i28":6,"i29":6,"i30":6,"i31":6,"i32":6,"i33":6,"i34":6,"i35":6,"i36":6,"i37":6,"i38":6,"i39":6,"i40":38,"i41":6,"i42":38,"i43":6,"i44":6,"i45":38,"i46":6,"i47":6,"i48":6,"i49":38,"i50":6,"i51":6,"i52":6,"i53":6,"i54":6,"i55":6,"i56":6,"i57":6,"i58":6}; |
| var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],32:["t6","Deprecated 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/ServletContainerInitializer.html" title="interface in javax.servlet"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../javax/servlet/ServletContextAttributeEvent.html" title="class in javax.servlet"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../index.html?javax/servlet/ServletContext.html" target="_top">Frames</a></li> |
| <li><a href="ServletContext.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../allclasses-noframe.html">All 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: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li>Constr | </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>Constr | </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 ServletContext" class="title">Interface ServletContext</h2> |
| </div> |
| <div class="contentContainer"> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <br> |
| <pre>public interface <span class="typeNameLabel">ServletContext</span></pre> |
| <div class="block">Defines a set of methods that a servlet uses to communicate with its servlet container, for example, to get the MIME |
| type of a file, dispatch requests, or write to a log file. |
| |
| <p> |
| There is one context per "web application" per Java Virtual Machine. (A "web application" is a collection of servlets |
| and content installed under a specific subset of the server's URL namespace such as <code>/catalog</code> and |
| possibly installed via a <code>.war</code> file.) |
| |
| <p> |
| In the case of a web application marked "distributed" in its deployment descriptor, there will be one context |
| instance for each virtual machine. In this situation, the context cannot be used as a location to share global |
| information (because the information won't be truly global). Use an external resource like a database instead. |
| |
| <p> |
| The <code>ServletContext</code> object is contained within the <a href="../../javax/servlet/ServletConfig.html" title="interface in javax.servlet"><code>ServletConfig</code></a> object, which the Web server |
| provides the servlet when the servlet is initialized.</div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../javax/servlet/Servlet.html#getServletConfig--"><code>Servlet.getServletConfig()</code></a>, |
| <a href="../../javax/servlet/ServletConfig.html#getServletContext--"><code>ServletConfig.getServletContext()</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- =========== FIELD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field.summary"> |
| <!-- --> |
| </a> |
| <h3>Field Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation"> |
| <caption><span>Fields</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Field and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#ORDERED_LIBS">ORDERED_LIBS</a></span></code> |
| <div class="block">The name of the <code>ServletContext</code> attribute whose value (of type |
| <code>java.util.List<java.lang.String></code>) contains the list of names of JAR files in |
| <code>WEB-INF/lib</code> ordered by their web fragment names (with possible exclusions if |
| <code><absolute-ordering></code> without any <code><others/></code> is being used), or null if no |
| absolute or relative ordering has been specified</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#TEMPDIR">TEMPDIR</a></span></code> |
| <div class="block">The name of the <tt>ServletContext</tt> attribute which stores the private temporary directory (of type |
| <tt>java.io.File</tt>) provided by the servlet container for the <tt>ServletContext</tt></div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ========== 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"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </span></span><span id="t6" class="tableTab"><span><a href="javascript:show(32);">Deprecated Methods</a></span><span class="tabEnd"> </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><a href="../../javax/servlet/FilterRegistration.Dynamic.html" title="interface in javax.servlet">FilterRegistration.Dynamic</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#addFilter-java.lang.String-java.lang.Class-">addFilter</a></span>(java.lang.String filterName, |
| java.lang.Class<? extends <a href="../../javax/servlet/Filter.html" title="interface in javax.servlet">Filter</a>> filterClass)</code> |
| <div class="block">Adds the filter with the given name and class type to this servlet context.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code><a href="../../javax/servlet/FilterRegistration.Dynamic.html" title="interface in javax.servlet">FilterRegistration.Dynamic</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#addFilter-java.lang.String-javax.servlet.Filter-">addFilter</a></span>(java.lang.String filterName, |
| <a href="../../javax/servlet/Filter.html" title="interface in javax.servlet">Filter</a> filter)</code> |
| <div class="block">Registers the given filter instance with this ServletContext under the given <tt>filterName</tt>.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code><a href="../../javax/servlet/FilterRegistration.Dynamic.html" title="interface in javax.servlet">FilterRegistration.Dynamic</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#addFilter-java.lang.String-java.lang.String-">addFilter</a></span>(java.lang.String filterName, |
| java.lang.String className)</code> |
| <div class="block">Adds the filter with the given name and class name to this servlet context.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code><a href="../../javax/servlet/ServletRegistration.Dynamic.html" title="interface in javax.servlet">ServletRegistration.Dynamic</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#addJspFile-java.lang.String-java.lang.String-">addJspFile</a></span>(java.lang.String servletName, |
| java.lang.String jspFile)</code> |
| <div class="block">Adds the servlet with the given jsp file to this servlet context.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#addListener-java.lang.Class-">addListener</a></span>(java.lang.Class<? extends java.util.EventListener> listenerClass)</code> |
| <div class="block">Adds a listener of the given class type to this ServletContext.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#addListener-java.lang.String-">addListener</a></span>(java.lang.String className)</code> |
| <div class="block">Adds the listener with the given class name to this ServletContext.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code><T extends java.util.EventListener><br>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#addListener-T-">addListener</a></span>(T t)</code> |
| <div class="block">Adds the given listener to this ServletContext.</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code><a href="../../javax/servlet/ServletRegistration.Dynamic.html" title="interface in javax.servlet">ServletRegistration.Dynamic</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#addServlet-java.lang.String-java.lang.Class-">addServlet</a></span>(java.lang.String servletName, |
| java.lang.Class<? extends <a href="../../javax/servlet/Servlet.html" title="interface in javax.servlet">Servlet</a>> servletClass)</code> |
| <div class="block">Adds the servlet with the given name and class type to this servlet context.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code><a href="../../javax/servlet/ServletRegistration.Dynamic.html" title="interface in javax.servlet">ServletRegistration.Dynamic</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#addServlet-java.lang.String-javax.servlet.Servlet-">addServlet</a></span>(java.lang.String servletName, |
| <a href="../../javax/servlet/Servlet.html" title="interface in javax.servlet">Servlet</a> servlet)</code> |
| <div class="block">Registers the given servlet instance with this ServletContext under the given <tt>servletName</tt>.</div> |
| </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code><a href="../../javax/servlet/ServletRegistration.Dynamic.html" title="interface in javax.servlet">ServletRegistration.Dynamic</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#addServlet-java.lang.String-java.lang.String-">addServlet</a></span>(java.lang.String servletName, |
| java.lang.String className)</code> |
| <div class="block">Adds the servlet with the given name and class name to this servlet context.</div> |
| </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code><T extends <a href="../../javax/servlet/Filter.html" title="interface in javax.servlet">Filter</a>><br>T</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#createFilter-java.lang.Class-">createFilter</a></span>(java.lang.Class<T> clazz)</code> |
| <div class="block">Instantiates the given Filter class.</div> |
| </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code><T extends java.util.EventListener><br>T</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#createListener-java.lang.Class-">createListener</a></span>(java.lang.Class<T> clazz)</code> |
| <div class="block">Instantiates the given EventListener class.</div> |
| </td> |
| </tr> |
| <tr id="i12" class="altColor"> |
| <td class="colFirst"><code><T extends <a href="../../javax/servlet/Servlet.html" title="interface in javax.servlet">Servlet</a>><br>T</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#createServlet-java.lang.Class-">createServlet</a></span>(java.lang.Class<T> clazz)</code> |
| <div class="block">Instantiates the given Servlet class.</div> |
| </td> |
| </tr> |
| <tr id="i13" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#declareRoles-java.lang.String...-">declareRoles</a></span>(java.lang.String... roleNames)</code> |
| <div class="block">Declares role names that are tested using <code>isUserInRole</code>.</div> |
| </td> |
| </tr> |
| <tr id="i14" class="altColor"> |
| <td class="colFirst"><code>java.lang.Object</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getAttribute-java.lang.String-">getAttribute</a></span>(java.lang.String name)</code> |
| <div class="block">Returns the servlet container attribute with the given name, or <code>null</code> if there is no attribute by |
| that name.</div> |
| </td> |
| </tr> |
| <tr id="i15" class="rowColor"> |
| <td class="colFirst"><code>java.util.Enumeration<java.lang.String></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getAttributeNames--">getAttributeNames</a></span>()</code> |
| <div class="block">Returns an <code>Enumeration</code> containing the attribute names available within this ServletContext.</div> |
| </td> |
| </tr> |
| <tr id="i16" class="altColor"> |
| <td class="colFirst"><code>java.lang.ClassLoader</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getClassLoader--">getClassLoader</a></span>()</code> |
| <div class="block">Gets the class loader of the web application represented by this ServletContext.</div> |
| </td> |
| </tr> |
| <tr id="i17" class="rowColor"> |
| <td class="colFirst"><code><a href="../../javax/servlet/ServletContext.html" title="interface in javax.servlet">ServletContext</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getContext-java.lang.String-">getContext</a></span>(java.lang.String uripath)</code> |
| <div class="block">Returns a <code>ServletContext</code> object that corresponds to a specified URL on the server.</div> |
| </td> |
| </tr> |
| <tr id="i18" class="altColor"> |
| <td class="colFirst"><code>java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getContextPath--">getContextPath</a></span>()</code> |
| <div class="block">Returns the context path of the web application.</div> |
| </td> |
| </tr> |
| <tr id="i19" class="rowColor"> |
| <td class="colFirst"><code>java.util.Set<<a href="../../javax/servlet/SessionTrackingMode.html" title="enum in javax.servlet">SessionTrackingMode</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getDefaultSessionTrackingModes--">getDefaultSessionTrackingModes</a></span>()</code> |
| <div class="block">Gets the session tracking modes that are supported by default for this <tt>ServletContext</tt>.</div> |
| </td> |
| </tr> |
| <tr id="i20" class="altColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getEffectiveMajorVersion--">getEffectiveMajorVersion</a></span>()</code> |
| <div class="block">Gets the major version of the Servlet specification that the application represented by this ServletContext is |
| based on.</div> |
| </td> |
| </tr> |
| <tr id="i21" class="rowColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getEffectiveMinorVersion--">getEffectiveMinorVersion</a></span>()</code> |
| <div class="block">Gets the minor version of the Servlet specification that the application represented by this ServletContext is |
| based on.</div> |
| </td> |
| </tr> |
| <tr id="i22" class="altColor"> |
| <td class="colFirst"><code>java.util.Set<<a href="../../javax/servlet/SessionTrackingMode.html" title="enum in javax.servlet">SessionTrackingMode</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getEffectiveSessionTrackingModes--">getEffectiveSessionTrackingModes</a></span>()</code> |
| <div class="block">Gets the session tracking modes that are in effect for this <tt>ServletContext</tt>.</div> |
| </td> |
| </tr> |
| <tr id="i23" class="rowColor"> |
| <td class="colFirst"><code><a href="../../javax/servlet/FilterRegistration.html" title="interface in javax.servlet">FilterRegistration</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getFilterRegistration-java.lang.String-">getFilterRegistration</a></span>(java.lang.String filterName)</code> |
| <div class="block">Gets the FilterRegistration corresponding to the filter with the given <tt>filterName</tt>.</div> |
| </td> |
| </tr> |
| <tr id="i24" class="altColor"> |
| <td class="colFirst"><code>java.util.Map<java.lang.String,? extends <a href="../../javax/servlet/FilterRegistration.html" title="interface in javax.servlet">FilterRegistration</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getFilterRegistrations--">getFilterRegistrations</a></span>()</code> |
| <div class="block">Gets a (possibly empty) Map of the FilterRegistration objects (keyed by filter name) corresponding to all filters |
| registered with this ServletContext.</div> |
| </td> |
| </tr> |
| <tr id="i25" class="rowColor"> |
| <td class="colFirst"><code>java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getInitParameter-java.lang.String-">getInitParameter</a></span>(java.lang.String name)</code> |
| <div class="block">Returns a <code>String</code> containing the value of the named context-wide initialization parameter, or |
| <code>null</code> if the parameter does not exist.</div> |
| </td> |
| </tr> |
| <tr id="i26" class="altColor"> |
| <td class="colFirst"><code>java.util.Enumeration<java.lang.String></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getInitParameterNames--">getInitParameterNames</a></span>()</code> |
| <div class="block">Returns the names of the context's initialization parameters as an <code>Enumeration</code> of |
| <code>String</code> objects, or an empty <code>Enumeration</code> if the context has no initialization |
| parameters.</div> |
| </td> |
| </tr> |
| <tr id="i27" class="rowColor"> |
| <td class="colFirst"><code><a href="../../javax/servlet/descriptor/JspConfigDescriptor.html" title="interface in javax.servlet.descriptor">JspConfigDescriptor</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getJspConfigDescriptor--">getJspConfigDescriptor</a></span>()</code> |
| <div class="block">Gets the <code><jsp-config></code> related configuration that was aggregated from the <code>web.xml</code> |
| and <code>web-fragment.xml</code> descriptor files of the web application represented by this ServletContext.</div> |
| </td> |
| </tr> |
| <tr id="i28" class="altColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getMajorVersion--">getMajorVersion</a></span>()</code> |
| <div class="block">Returns the major version of Jakarta Servlet that this container supports.</div> |
| </td> |
| </tr> |
| <tr id="i29" class="rowColor"> |
| <td class="colFirst"><code>java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getMimeType-java.lang.String-">getMimeType</a></span>(java.lang.String file)</code> |
| <div class="block">Returns the MIME type of the specified file, or <code>null</code> if the MIME type is not known.</div> |
| </td> |
| </tr> |
| <tr id="i30" class="altColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getMinorVersion--">getMinorVersion</a></span>()</code> |
| <div class="block">Returns the minor version of Jakarta Servlet that this container supports.</div> |
| </td> |
| </tr> |
| <tr id="i31" class="rowColor"> |
| <td class="colFirst"><code><a href="../../javax/servlet/RequestDispatcher.html" title="interface in javax.servlet">RequestDispatcher</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getNamedDispatcher-java.lang.String-">getNamedDispatcher</a></span>(java.lang.String name)</code> |
| <div class="block">Returns a <a href="../../javax/servlet/RequestDispatcher.html" title="interface in javax.servlet"><code>RequestDispatcher</code></a> object that acts as a wrapper for the named servlet.</div> |
| </td> |
| </tr> |
| <tr id="i32" class="altColor"> |
| <td class="colFirst"><code>java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getRealPath-java.lang.String-">getRealPath</a></span>(java.lang.String path)</code> |
| <div class="block">Gets the <i>real</i> path corresponding to the given <i>virtual</i> path.</div> |
| </td> |
| </tr> |
| <tr id="i33" class="rowColor"> |
| <td class="colFirst"><code>java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getRequestCharacterEncoding--">getRequestCharacterEncoding</a></span>()</code> |
| <div class="block">Gets the request character encoding that are supported by default for this <tt>ServletContext</tt>.</div> |
| </td> |
| </tr> |
| <tr id="i34" class="altColor"> |
| <td class="colFirst"><code><a href="../../javax/servlet/RequestDispatcher.html" title="interface in javax.servlet">RequestDispatcher</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getRequestDispatcher-java.lang.String-">getRequestDispatcher</a></span>(java.lang.String path)</code> |
| <div class="block">Returns a <a href="../../javax/servlet/RequestDispatcher.html" title="interface in javax.servlet"><code>RequestDispatcher</code></a> object that acts as a wrapper for the resource located at the given path.</div> |
| </td> |
| </tr> |
| <tr id="i35" class="rowColor"> |
| <td class="colFirst"><code>java.net.URL</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getResource-java.lang.String-">getResource</a></span>(java.lang.String path)</code> |
| <div class="block">Returns a URL to the resource that is mapped to the given path.</div> |
| </td> |
| </tr> |
| <tr id="i36" class="altColor"> |
| <td class="colFirst"><code>java.io.InputStream</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getResourceAsStream-java.lang.String-">getResourceAsStream</a></span>(java.lang.String path)</code> |
| <div class="block">Returns the resource located at the named path as an <code>InputStream</code> object.</div> |
| </td> |
| </tr> |
| <tr id="i37" class="rowColor"> |
| <td class="colFirst"><code>java.util.Set<java.lang.String></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getResourcePaths-java.lang.String-">getResourcePaths</a></span>(java.lang.String path)</code> |
| <div class="block">Returns a directory-like listing of all the paths to resources within the web application whose longest sub-path |
| matches the supplied path argument.</div> |
| </td> |
| </tr> |
| <tr id="i38" class="altColor"> |
| <td class="colFirst"><code>java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getResponseCharacterEncoding--">getResponseCharacterEncoding</a></span>()</code> |
| <div class="block">Gets the response character encoding that are supported by default for this <tt>ServletContext</tt>.</div> |
| </td> |
| </tr> |
| <tr id="i39" class="rowColor"> |
| <td class="colFirst"><code>java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getServerInfo--">getServerInfo</a></span>()</code> |
| <div class="block">Returns the name and version of the servlet container on which the servlet is running.</div> |
| </td> |
| </tr> |
| <tr id="i40" class="altColor"> |
| <td class="colFirst"><code><a href="../../javax/servlet/Servlet.html" title="interface in javax.servlet">Servlet</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getServlet-java.lang.String-">getServlet</a></span>(java.lang.String name)</code> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> |
| <div class="block"><span class="deprecationComment">As of Java Servlet API 2.1, with no direct replacement. |
| |
| <p> |
| This method was originally defined to retrieve a servlet from a <code>ServletContext</code>. In this |
| version, this method always returns <code>null</code> and remains only to preserve binary |
| compatibility. This method will be permanently removed in a future version of Jakarta Servlets. |
| |
| <p> |
| In lieu of this method, servlets can share information using the <code>ServletContext</code> class |
| and can perform shared business logic by invoking methods on common non-servlet classes.</span></div> |
| </div> |
| </td> |
| </tr> |
| <tr id="i41" class="rowColor"> |
| <td class="colFirst"><code>java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getServletContextName--">getServletContextName</a></span>()</code> |
| <div class="block">Returns the name of this web application corresponding to this ServletContext as specified in the deployment |
| descriptor for this web application by the display-name element.</div> |
| </td> |
| </tr> |
| <tr id="i42" class="altColor"> |
| <td class="colFirst"><code>java.util.Enumeration<java.lang.String></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getServletNames--">getServletNames</a></span>()</code> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> |
| <div class="block"><span class="deprecationComment">As of Java Servlet API 2.1, with no replacement. |
| |
| <p> |
| This method was originally defined to return an <code>Enumeration</code> of all the servlet names |
| known to this context. In this version, this method always returns an empty <code>Enumeration</code> |
| and remains only to preserve binary compatibility. This method will be permanently removed in a |
| future version of Jakarta Servlets.</span></div> |
| </div> |
| </td> |
| </tr> |
| <tr id="i43" class="rowColor"> |
| <td class="colFirst"><code><a href="../../javax/servlet/ServletRegistration.html" title="interface in javax.servlet">ServletRegistration</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getServletRegistration-java.lang.String-">getServletRegistration</a></span>(java.lang.String servletName)</code> |
| <div class="block">Gets the ServletRegistration corresponding to the servlet with the given <tt>servletName</tt>.</div> |
| </td> |
| </tr> |
| <tr id="i44" class="altColor"> |
| <td class="colFirst"><code>java.util.Map<java.lang.String,? extends <a href="../../javax/servlet/ServletRegistration.html" title="interface in javax.servlet">ServletRegistration</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getServletRegistrations--">getServletRegistrations</a></span>()</code> |
| <div class="block">Gets a (possibly empty) Map of the ServletRegistration objects (keyed by servlet name) corresponding to all |
| servlets registered with this ServletContext.</div> |
| </td> |
| </tr> |
| <tr id="i45" class="rowColor"> |
| <td class="colFirst"><code>java.util.Enumeration<<a href="../../javax/servlet/Servlet.html" title="interface in javax.servlet">Servlet</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getServlets--">getServlets</a></span>()</code> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> |
| <div class="block"><span class="deprecationComment">As of Java Servlet API 2.0, with no replacement. |
| |
| <p> |
| This method was originally defined to return an <code>Enumeration</code> of all the servlets known to |
| this servlet context. In this version, this method always returns an empty enumeration and remains |
| only to preserve binary compatibility. This method will be permanently removed in a future version of |
| Jakarta Servlets.</span></div> |
| </div> |
| </td> |
| </tr> |
| <tr id="i46" class="altColor"> |
| <td class="colFirst"><code><a href="../../javax/servlet/SessionCookieConfig.html" title="interface in javax.servlet">SessionCookieConfig</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getSessionCookieConfig--">getSessionCookieConfig</a></span>()</code> |
| <div class="block">Gets the <a href="../../javax/servlet/SessionCookieConfig.html" title="interface in javax.servlet"><code>SessionCookieConfig</code></a> object through which various properties of the session tracking cookies |
| created on behalf of this <tt>ServletContext</tt> may be configured.</div> |
| </td> |
| </tr> |
| <tr id="i47" class="rowColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getSessionTimeout--">getSessionTimeout</a></span>()</code> |
| <div class="block">Gets the session timeout in minutes that are supported by default for this <tt>ServletContext</tt>.</div> |
| </td> |
| </tr> |
| <tr id="i48" class="altColor"> |
| <td class="colFirst"><code>java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#getVirtualServerName--">getVirtualServerName</a></span>()</code> |
| <div class="block">Returns the configuration name of the logical host on which the ServletContext is deployed.</div> |
| </td> |
| </tr> |
| <tr id="i49" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#log-java.lang.Exception-java.lang.String-">log</a></span>(java.lang.Exception exception, |
| java.lang.String msg)</code> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> |
| <div class="block"><span class="deprecationComment">As of Java Servlet API 2.1, use <a href="../../javax/servlet/ServletContext.html#log-java.lang.String-java.lang.Throwable-"><code>log(String message, Throwable throwable)</code></a> instead. |
| |
| <p> |
| This method was originally defined to write an exception's stack trace and an explanatory error |
| message to the servlet log file.</span></div> |
| </div> |
| </td> |
| </tr> |
| <tr id="i50" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#log-java.lang.String-">log</a></span>(java.lang.String msg)</code> |
| <div class="block">Writes the specified message to a servlet log file, usually an event log.</div> |
| </td> |
| </tr> |
| <tr id="i51" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#log-java.lang.String-java.lang.Throwable-">log</a></span>(java.lang.String message, |
| java.lang.Throwable throwable)</code> |
| <div class="block">Writes an explanatory message and a stack trace for a given <code>Throwable</code> exception to the servlet log |
| file.</div> |
| </td> |
| </tr> |
| <tr id="i52" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#removeAttribute-java.lang.String-">removeAttribute</a></span>(java.lang.String name)</code> |
| <div class="block">Removes the attribute with the given name from this ServletContext.</div> |
| </td> |
| </tr> |
| <tr id="i53" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#setAttribute-java.lang.String-java.lang.Object-">setAttribute</a></span>(java.lang.String name, |
| java.lang.Object object)</code> |
| <div class="block">Binds an object to a given attribute name in this ServletContext.</div> |
| </td> |
| </tr> |
| <tr id="i54" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#setInitParameter-java.lang.String-java.lang.String-">setInitParameter</a></span>(java.lang.String name, |
| java.lang.String value)</code> |
| <div class="block">Sets the context initialization parameter with the given name and value on this ServletContext.</div> |
| </td> |
| </tr> |
| <tr id="i55" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#setRequestCharacterEncoding-java.lang.String-">setRequestCharacterEncoding</a></span>(java.lang.String encoding)</code> |
| <div class="block">Sets the request character encoding for this ServletContext.</div> |
| </td> |
| </tr> |
| <tr id="i56" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#setResponseCharacterEncoding-java.lang.String-">setResponseCharacterEncoding</a></span>(java.lang.String encoding)</code> |
| <div class="block">Sets the response character encoding for this ServletContext.</div> |
| </td> |
| </tr> |
| <tr id="i57" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#setSessionTimeout-int-">setSessionTimeout</a></span>(int sessionTimeout)</code> |
| <div class="block">Sets the session timeout in minutes for this ServletContext.</div> |
| </td> |
| </tr> |
| <tr id="i58" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/servlet/ServletContext.html#setSessionTrackingModes-java.util.Set-">setSessionTrackingModes</a></span>(java.util.Set<<a href="../../javax/servlet/SessionTrackingMode.html" title="enum in javax.servlet">SessionTrackingMode</a>> sessionTrackingModes)</code> |
| <div class="block">Sets the session tracking modes that are to become effective for this <tt>ServletContext</tt>.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ FIELD DETAIL =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field.detail"> |
| <!-- --> |
| </a> |
| <h3>Field Detail</h3> |
| <a name="TEMPDIR"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>TEMPDIR</h4> |
| <pre>static final java.lang.String TEMPDIR</pre> |
| <div class="block">The name of the <tt>ServletContext</tt> attribute which stores the private temporary directory (of type |
| <tt>java.io.File</tt>) provided by the servlet container for the <tt>ServletContext</tt></div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../constant-values.html#javax.servlet.ServletContext.TEMPDIR">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="ORDERED_LIBS"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>ORDERED_LIBS</h4> |
| <pre>static final java.lang.String ORDERED_LIBS</pre> |
| <div class="block">The name of the <code>ServletContext</code> attribute whose value (of type |
| <code>java.util.List<java.lang.String></code>) contains the list of names of JAR files in |
| <code>WEB-INF/lib</code> ordered by their web fragment names (with possible exclusions if |
| <code><absolute-ordering></code> without any <code><others/></code> is being used), or null if no |
| absolute or relative ordering has been specified</div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../constant-values.html#javax.servlet.ServletContext.ORDERED_LIBS">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="getContextPath--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getContextPath</h4> |
| <pre>java.lang.String getContextPath()</pre> |
| <div class="block">Returns the context path of the web application. |
| |
| <p> |
| The context path is the portion of the request URI that is used to select the context of the request. The context |
| path always comes first in a request URI. If this context is the "root" context rooted at the base of the Web |
| server's URL name space, this path will be an empty string. Otherwise, if the context is not rooted at the root |
| of the server's name space, the path starts with a / character but does not end with a / character. |
| |
| <p> |
| It is possible that a servlet container may match a context by more than one context path. In such cases the |
| <a href="../../javax/servlet/http/HttpServletRequest.html#getContextPath--"><code>HttpServletRequest.getContextPath()</code></a> will return the actual context path used by the |
| request and it may differ from the path returned by this method. The context path returned by this method should |
| be considered as the prime or preferred context path of the application.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The context path of the web application, or "" for the root context</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 2.5</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../javax/servlet/http/HttpServletRequest.html#getContextPath--"><code>HttpServletRequest.getContextPath()</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getContext-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getContext</h4> |
| <pre><a href="../../javax/servlet/ServletContext.html" title="interface in javax.servlet">ServletContext</a> getContext(java.lang.String uripath)</pre> |
| <div class="block">Returns a <code>ServletContext</code> object that corresponds to a specified URL on the server. |
| |
| <p> |
| This method allows servlets to gain access to the context for various parts of the server, and as needed obtain |
| <a href="../../javax/servlet/RequestDispatcher.html" title="interface in javax.servlet"><code>RequestDispatcher</code></a> objects from the context. The given path must be begin with <tt>/</tt>, is interpreted |
| relative to the server's document root and is matched against the context roots of other web applications hosted |
| on this container. |
| |
| <p> |
| In a security conscious environment, the servlet container may return <code>null</code> for a given URL.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>uripath</code> - a <code>String</code> specifying the context path of another web application in the container.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the <code>ServletContext</code> object that corresponds to the named URL, or null if either none exists |
| or the container wishes to restrict this access.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../javax/servlet/RequestDispatcher.html" title="interface in javax.servlet"><code>RequestDispatcher</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getMajorVersion--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getMajorVersion</h4> |
| <pre>int getMajorVersion()</pre> |
| <div class="block">Returns the major version of Jakarta Servlet that this container supports. All implementations that |
| comply with Version 4.0 must have this method return the integer 4.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>4</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getMinorVersion--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getMinorVersion</h4> |
| <pre>int getMinorVersion()</pre> |
| <div class="block">Returns the minor version of Jakarta Servlet that this container supports. All implementations that |
| comply with Version 4.0 must have this method return the integer 0.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getEffectiveMajorVersion--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getEffectiveMajorVersion</h4> |
| <pre>int getEffectiveMajorVersion()</pre> |
| <div class="block">Gets the major version of the Servlet specification that the application represented by this ServletContext is |
| based on. |
| |
| <p> |
| The value returned may be different from <a href="../../javax/servlet/ServletContext.html#getMajorVersion--"><code>getMajorVersion()</code></a>, which returns the major version of the Servlet |
| specification supported by the Servlet container.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the major version of the Servlet specification that the application represented by this ServletContext is |
| based on</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getEffectiveMinorVersion--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getEffectiveMinorVersion</h4> |
| <pre>int getEffectiveMinorVersion()</pre> |
| <div class="block">Gets the minor version of the Servlet specification that the application represented by this ServletContext is |
| based on. |
| |
| <p> |
| The value returned may be different from <a href="../../javax/servlet/ServletContext.html#getMinorVersion--"><code>getMinorVersion()</code></a>, which returns the minor version of the Servlet |
| specification supported by the Servlet container.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the minor version of the Servlet specification that the application represented by this ServletContext is |
| based on</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getMimeType-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getMimeType</h4> |
| <pre>java.lang.String getMimeType(java.lang.String file)</pre> |
| <div class="block">Returns the MIME type of the specified file, or <code>null</code> if the MIME type is not known. The MIME type is |
| determined by the configuration of the servlet container, and may be specified in a web application deployment |
| descriptor. Common MIME types include <code>text/html</code> and <code>image/gif</code>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>file</code> - a <code>String</code> specifying the name of a file</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a <code>String</code> specifying the file's MIME type</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getResourcePaths-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getResourcePaths</h4> |
| <pre>java.util.Set<java.lang.String> getResourcePaths(java.lang.String path)</pre> |
| <div class="block">Returns a directory-like listing of all the paths to resources within the web application whose longest sub-path |
| matches the supplied path argument. |
| |
| <p> |
| Paths indicating subdirectory paths end with a <tt>/</tt>. |
| |
| <p> |
| The returned paths are all relative to the root of the web application, or relative to the |
| <tt>/META-INF/resources</tt> directory of a JAR file inside the web application's <tt>/WEB-INF/lib</tt> |
| directory, and have a leading <tt>/</tt>. |
| |
| <p> |
| The returned set is not backed by the <code>ServletContext</code> object, so changes in the returned set are not |
| reflected in the <code>ServletContext</code> object, and vice-versa. |
| </p> |
| |
| <p> |
| For example, for a web application containing: |
| |
| <pre> |
| <code> |
| /welcome.html |
| /catalog/index.html |
| /catalog/products.html |
| /catalog/offers/books.html |
| /catalog/offers/music.html |
| /customer/login.jsp |
| /WEB-INF/web.xml |
| /WEB-INF/classes/com.acme.OrderServlet.class |
| /WEB-INF/lib/catalog.jar!/META-INF/resources/catalog/moreOffers/books.html |
| </code> |
| </pre> |
| |
| <tt>getResourcePaths("/")</tt> would return <tt>{"/welcome.html", "/catalog/", "/customer/", "/WEB-INF/"}</tt>, |
| and <tt>getResourcePaths("/catalog/")</tt> would return <tt>{"/catalog/index.html", "/catalog/products.html", |
| "/catalog/offers/", "/catalog/moreOffers/"}</tt>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>path</code> - the partial path used to match the resources, which must start with a <tt>/</tt></dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a Set containing the directory listing, or null if there are no resources in the web application whose |
| path begins with the supplied path.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 2.3</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getResource-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getResource</h4> |
| <pre>java.net.URL getResource(java.lang.String path) |
| throws java.net.MalformedURLException</pre> |
| <div class="block">Returns a URL to the resource that is mapped to the given path. |
| |
| <p> |
| The path must begin with a <tt>/</tt> and is interpreted as relative to the current context root, or relative to |
| the <tt>/META-INF/resources</tt> directory of a JAR file inside the web application's <tt>/WEB-INF/lib</tt> |
| directory. This method will first search the document root of the web application for the requested resource, |
| before searching any of the JAR files inside <tt>/WEB-INF/lib</tt>. The order in which the JAR files inside |
| <tt>/WEB-INF/lib</tt> are searched is undefined. |
| |
| <p> |
| This method allows the servlet container to make a resource available to servlets from any source. Resources can |
| be located on a local or remote file system, in a database, or in a <code>.war</code> file. |
| |
| <p> |
| The servlet container must implement the URL handlers and <code>URLConnection</code> objects that are necessary |
| to access the resource. |
| |
| <p> |
| This method returns <code>null</code> if no resource is mapped to the pathname. |
| |
| <p> |
| Some containers may allow writing to the URL returned by this method using the methods of the URL class. |
| |
| <p> |
| The resource content is returned directly, so be aware that requesting a <code>.jsp</code> page returns the JSP |
| source code. Use a <code>RequestDispatcher</code> instead to include results of an execution. |
| |
| <p> |
| This method has a different purpose than <code>java.lang.Class.getResource</code>, which looks up resources based |
| on a class loader. This method does not use class loaders. |
| |
| <p> |
| This method bypasses both implicit (no direct access to WEB-INF or META-INF) and explicit (defined by the web |
| application) security constraints. Care should be taken both when constructing the path (e.g. avoid unsanitized |
| user provided data) and when using the result not to create a security vulnerability in the application.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>path</code> - a <code>String</code> specifying the path to the resource</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the resource located at the named path, or <code>null</code> if there is no resource at that path</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.net.MalformedURLException</code> - if the pathname is not given in the correct form</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getResourceAsStream-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getResourceAsStream</h4> |
| <pre>java.io.InputStream getResourceAsStream(java.lang.String path)</pre> |
| <div class="block">Returns the resource located at the named path as an <code>InputStream</code> object. |
| |
| <p> |
| The data in the <code>InputStream</code> can be of any type or length. The path must be specified according to |
| the rules given in <code>getResource</code>. This method returns <code>null</code> if no resource exists at the |
| specified path. |
| |
| <p> |
| Meta-information such as content length and content type that is available via <code>getResource</code> method is |
| lost when using this method. |
| |
| <p> |
| The servlet container must implement the URL handlers and <code>URLConnection</code> objects necessary to access |
| the resource. |
| |
| <p> |
| This method is different from <code>java.lang.Class.getResourceAsStream</code>, which uses a class loader. This |
| method allows servlet containers to make a resource available to a servlet from any location, without using a |
| class loader. |
| |
| <p> |
| This method bypasses both implicit (no direct access to WEB-INF or META-INF) and explicit (defined by the web |
| application) security constraints. Care should be taken both when constructing the path (e.g. avoid unsanitized |
| user provided data) and when using the result not to create a security vulnerability in the application.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>path</code> - a <code>String</code> specifying the path to the resource</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the <code>InputStream</code> returned to the servlet, or <code>null</code> if no resource exists at the |
| specified path</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getRequestDispatcher-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getRequestDispatcher</h4> |
| <pre><a href="../../javax/servlet/RequestDispatcher.html" title="interface in javax.servlet">RequestDispatcher</a> getRequestDispatcher(java.lang.String path)</pre> |
| <div class="block">Returns a <a href="../../javax/servlet/RequestDispatcher.html" title="interface in javax.servlet"><code>RequestDispatcher</code></a> object that acts as a wrapper for the resource located at the given path. A |
| <code>RequestDispatcher</code> object can be used to forward a request to the resource or to include the resource |
| in a response. The resource can be dynamic or static. |
| |
| <p> |
| The pathname must begin with a <tt>/</tt> and is interpreted as relative to the current context root. Use |
| <code>getContext</code> to obtain a <code>RequestDispatcher</code> for resources in foreign contexts. |
| |
| <p> |
| This method returns <code>null</code> if the <code>ServletContext</code> cannot return a |
| <code>RequestDispatcher</code>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>path</code> - a <code>String</code> specifying the pathname to the resource</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a <code>RequestDispatcher</code> object that acts as a wrapper for the resource at the specified path, or |
| <code>null</code> if the <code>ServletContext</code> cannot return a <code>RequestDispatcher</code></dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../javax/servlet/RequestDispatcher.html" title="interface in javax.servlet"><code>RequestDispatcher</code></a>, |
| <a href="../../javax/servlet/ServletContext.html#getContext-java.lang.String-"><code>getContext(java.lang.String)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getNamedDispatcher-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getNamedDispatcher</h4> |
| <pre><a href="../../javax/servlet/RequestDispatcher.html" title="interface in javax.servlet">RequestDispatcher</a> getNamedDispatcher(java.lang.String name)</pre> |
| <div class="block">Returns a <a href="../../javax/servlet/RequestDispatcher.html" title="interface in javax.servlet"><code>RequestDispatcher</code></a> object that acts as a wrapper for the named servlet. |
| |
| <p> |
| Servlets (and JSP pages also) may be given names via server administration or via a web application deployment |
| descriptor. A servlet instance can determine its name using <a href="../../javax/servlet/ServletConfig.html#getServletName--"><code>ServletConfig.getServletName()</code></a>. |
| |
| <p> |
| This method returns <code>null</code> if the <code>ServletContext</code> cannot return a |
| <code>RequestDispatcher</code> for any reason.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>name</code> - a <code>String</code> specifying the name of a servlet to wrap</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a <code>RequestDispatcher</code> object that acts as a wrapper for the named servlet, or |
| <code>null</code> if the <code>ServletContext</code> cannot return a <code>RequestDispatcher</code></dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../javax/servlet/RequestDispatcher.html" title="interface in javax.servlet"><code>RequestDispatcher</code></a>, |
| <a href="../../javax/servlet/ServletContext.html#getContext-java.lang.String-"><code>getContext(java.lang.String)</code></a>, |
| <a href="../../javax/servlet/ServletConfig.html#getServletName--"><code>ServletConfig.getServletName()</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getServlet-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getServlet</h4> |
| <pre>@Deprecated |
| <a href="../../javax/servlet/Servlet.html" title="interface in javax.servlet">Servlet</a> getServlet(java.lang.String name) |
| throws <a href="../../javax/servlet/ServletException.html" title="class in javax.servlet">ServletException</a></pre> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">As of Java Servlet API 2.1, with no direct replacement. |
| |
| <p> |
| This method was originally defined to retrieve a servlet from a <code>ServletContext</code>. In this |
| version, this method always returns <code>null</code> and remains only to preserve binary |
| compatibility. This method will be permanently removed in a future version of Jakarta Servlets. |
| |
| <p> |
| In lieu of this method, servlets can share information using the <code>ServletContext</code> class |
| and can perform shared business logic by invoking methods on common non-servlet classes.</span></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>name</code> - the servlet name</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the <code>javax.servlet.Servlet Servlet</code> with the given name</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 exception has occurred that interfaces with servlet's normal operation</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getServlets--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getServlets</h4> |
| <pre>@Deprecated |
| java.util.Enumeration<<a href="../../javax/servlet/Servlet.html" title="interface in javax.servlet">Servlet</a>> getServlets()</pre> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">As of Java Servlet API 2.0, with no replacement. |
| |
| <p> |
| This method was originally defined to return an <code>Enumeration</code> of all the servlets known to |
| this servlet context. In this version, this method always returns an empty enumeration and remains |
| only to preserve binary compatibility. This method will be permanently removed in a future version of |
| Jakarta Servlets.</span></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>an <code>Enumeration</code> of <code>javax.servlet.Servlet Servlet</code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getServletNames--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getServletNames</h4> |
| <pre>@Deprecated |
| java.util.Enumeration<java.lang.String> getServletNames()</pre> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">As of Java Servlet API 2.1, with no replacement. |
| |
| <p> |
| This method was originally defined to return an <code>Enumeration</code> of all the servlet names |
| known to this context. In this version, this method always returns an empty <code>Enumeration</code> |
| and remains only to preserve binary compatibility. This method will be permanently removed in a |
| future version of Jakarta Servlets.</span></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>an <code>Enumeration</code> of <code>javax.servlet.Servlet Servlet</code> names</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="log-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>log</h4> |
| <pre>void log(java.lang.String msg)</pre> |
| <div class="block">Writes the specified message to a servlet log file, usually an event log. The name and type of the servlet log |
| file is specific to the servlet container.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>msg</code> - a <code>String</code> specifying the message to be written to the log file</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="log-java.lang.Exception-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>log</h4> |
| <pre>@Deprecated |
| void log(java.lang.Exception exception, |
| java.lang.String msg)</pre> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">As of Java Servlet API 2.1, use <a href="../../javax/servlet/ServletContext.html#log-java.lang.String-java.lang.Throwable-"><code>log(String message, Throwable throwable)</code></a> instead. |
| |
| <p> |
| This method was originally defined to write an exception's stack trace and an explanatory error |
| message to the servlet log file.</span></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>exception</code> - the <code>Exception</code> error</dd> |
| <dd><code>msg</code> - a <code>String</code> that describes the exception</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="log-java.lang.String-java.lang.Throwable-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>log</h4> |
| <pre>void log(java.lang.String message, |
| java.lang.Throwable throwable)</pre> |
| <div class="block">Writes an explanatory message and a stack trace for a given <code>Throwable</code> exception to the servlet log |
| file. The name and type of the servlet log file is specific to the servlet container, usually an event log.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>message</code> - a <code>String</code> that describes the error or exception</dd> |
| <dd><code>throwable</code> - the <code>Throwable</code> error or exception</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getRealPath-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getRealPath</h4> |
| <pre>java.lang.String getRealPath(java.lang.String path)</pre> |
| <div class="block">Gets the <i>real</i> path corresponding to the given <i>virtual</i> path. |
| |
| <p> |
| For example, if <tt>path</tt> is equal to <tt>/index.html</tt>, this method will return the absolute file path on |
| the server's filesystem to which a request of the form |
| <tt>http://<host>:<port>/<contextPath>/index.html</tt> would be mapped, where |
| <tt><contextPath></tt> corresponds to the context path of this ServletContext. |
| |
| <p> |
| The real path returned will be in a form appropriate to the computer and operating system on which the servlet |
| container is running, including the proper path separators. |
| |
| <p> |
| Resources inside the <tt>/META-INF/resources</tt> directories of JAR files bundled in the application's |
| <tt>/WEB-INF/lib</tt> directory must be considered only if the container has unpacked them from their containing |
| JAR file, in which case the path to the unpacked location must be returned. |
| |
| <p> |
| This method returns <code>null</code> if the servlet container is unable to translate the given <i>virtual</i> |
| path to a <i>real</i> path.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>path</code> - the <i>virtual</i> path to be translated to a <i>real</i> path</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the <i>real</i> path, or <tt>null</tt> if the translation cannot be performed</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getServerInfo--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getServerInfo</h4> |
| <pre>java.lang.String getServerInfo()</pre> |
| <div class="block">Returns the name and version of the servlet container on which the servlet is running. |
| |
| <p> |
| The form of the returned string is <i>servername</i>/<i>versionnumber</i>. For example, the JavaServer Web |
| Development Kit may return the string <code>JavaServer Web Dev Kit/1.0</code>. |
| |
| <p> |
| The servlet container may return other optional information after the primary string in parentheses, for example, |
| <code>JavaServer Web Dev Kit/1.0 (JDK 1.1.6; Windows NT 4.0 x86)</code>.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a <code>String</code> containing at least the servlet container name and version number</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getInitParameter-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getInitParameter</h4> |
| <pre>java.lang.String getInitParameter(java.lang.String name)</pre> |
| <div class="block">Returns a <code>String</code> containing the value of the named context-wide initialization parameter, or |
| <code>null</code> if the parameter does not exist. |
| |
| <p> |
| This method can make available configuration information useful to an entire web application. For example, it can |
| provide a webmaster's email address or the name of a system that holds critical data.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>name</code> - a <code>String</code> containing the name of the parameter whose value is requested</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a <code>String</code> containing the value of the context's initialization parameter, or |
| <code>null</code> if the context's initialization parameter does not exist.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.NullPointerException</code> - if the argument <code>name</code> is <code>null</code></dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../javax/servlet/ServletConfig.html#getInitParameter-java.lang.String-"><code>ServletConfig.getInitParameter(java.lang.String)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getInitParameterNames--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getInitParameterNames</h4> |
| <pre>java.util.Enumeration<java.lang.String> getInitParameterNames()</pre> |
| <div class="block">Returns the names of the context's initialization parameters as an <code>Enumeration</code> of |
| <code>String</code> objects, or an empty <code>Enumeration</code> if the context has no initialization |
| parameters.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>an <code>Enumeration</code> of <code>String</code> objects containing the names of the context's |
| initialization parameters</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../javax/servlet/ServletConfig.html#getInitParameter-java.lang.String-"><code>ServletConfig.getInitParameter(java.lang.String)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setInitParameter-java.lang.String-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setInitParameter</h4> |
| <pre>boolean setInitParameter(java.lang.String name, |
| java.lang.String value)</pre> |
| <div class="block">Sets the context initialization parameter with the given name and value on this ServletContext.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>name</code> - the name of the context initialization parameter to set</dd> |
| <dd><code>value</code> - the value of the context initialization parameter to set</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>true if the context initialization parameter with the given name and value was set successfully on this |
| ServletContext, and false if it was not set because this ServletContext already contains a context |
| initialization parameter with a matching name</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.IllegalStateException</code> - if this ServletContext has already been initialized</dd> |
| <dd><code>java.lang.NullPointerException</code> - if the name parameter is <code>null</code></dd> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getAttribute-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getAttribute</h4> |
| <pre>java.lang.Object getAttribute(java.lang.String name)</pre> |
| <div class="block">Returns the servlet container attribute with the given name, or <code>null</code> if there is no attribute by |
| that name. |
| |
| <p> |
| An attribute allows a servlet container to give the servlet additional information not already provided by this |
| interface. See your server documentation for information about its attributes. A list of supported attributes can |
| be retrieved using <code>getAttributeNames</code>. |
| |
| <p> |
| The attribute is returned as a <code>java.lang.Object</code> or some subclass. |
| |
| <p> |
| Attribute names should follow the same convention as package names. The Jakarta Servlet specification reserves |
| names matching <code>java.*</code>, <code>javax.*</code>, and <code>sun.*</code>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>name</code> - a <code>String</code> specifying the name of the attribute</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>an <code>Object</code> containing the value of the attribute, or <code>null</code> if no attribute exists |
| matching the given name.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.NullPointerException</code> - if the argument <code>name</code> is <code>null</code></dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../javax/servlet/ServletContext.html#getAttributeNames--"><code>getAttributeNames()</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getAttributeNames--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getAttributeNames</h4> |
| <pre>java.util.Enumeration<java.lang.String> getAttributeNames()</pre> |
| <div class="block">Returns an <code>Enumeration</code> containing the attribute names available within this ServletContext. |
| |
| <p> |
| Use the <a href="../../javax/servlet/ServletContext.html#getAttribute-java.lang.String-"><code>getAttribute(java.lang.String)</code></a> method with an attribute name to get the value of an attribute.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>an <code>Enumeration</code> of attribute names</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../javax/servlet/ServletContext.html#getAttribute-java.lang.String-"><code>getAttribute(java.lang.String)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setAttribute-java.lang.String-java.lang.Object-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setAttribute</h4> |
| <pre>void setAttribute(java.lang.String name, |
| java.lang.Object object)</pre> |
| <div class="block">Binds an object to a given attribute name in this ServletContext. If the name specified is already used for an |
| attribute, this method will replace the attribute with the new to the new attribute. |
| <p> |
| If listeners are configured on the <code>ServletContext</code> the container notifies them accordingly. |
| <p> |
| If a null value is passed, the effect is the same as calling <code>removeAttribute()</code>. |
| |
| <p> |
| Attribute names should follow the same convention as package names. The Jakarta Servlet specification reserves |
| names matching <code>java.*</code>, <code>javax.*</code>, and <code>sun.*</code>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>name</code> - a <code>String</code> specifying the name of the attribute</dd> |
| <dd><code>object</code> - an <code>Object</code> representing the attribute to be bound</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.NullPointerException</code> - if the name parameter is <code>null</code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="removeAttribute-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>removeAttribute</h4> |
| <pre>void removeAttribute(java.lang.String name)</pre> |
| <div class="block">Removes the attribute with the given name from this ServletContext. After removal, subsequent calls to |
| <a href="../../javax/servlet/ServletContext.html#getAttribute-java.lang.String-"><code>getAttribute(java.lang.String)</code></a> to retrieve the attribute's value will return <code>null</code>. |
| |
| <p> |
| If listeners are configured on the <code>ServletContext</code> the container notifies them accordingly.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>name</code> - a <code>String</code> specifying the name of the attribute to be removed</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getServletContextName--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getServletContextName</h4> |
| <pre>java.lang.String getServletContextName()</pre> |
| <div class="block">Returns the name of this web application corresponding to this ServletContext as specified in the deployment |
| descriptor for this web application by the display-name element.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The name of the web application or null if no name has been declared in the deployment descriptor.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 2.3</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="addServlet-java.lang.String-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>addServlet</h4> |
| <pre><a href="../../javax/servlet/ServletRegistration.Dynamic.html" title="interface in javax.servlet">ServletRegistration.Dynamic</a> addServlet(java.lang.String servletName, |
| java.lang.String className)</pre> |
| <div class="block">Adds the servlet with the given name and class name to this servlet context. |
| |
| <p> |
| The registered servlet may be further configured via the returned <a href="../../javax/servlet/ServletRegistration.html" title="interface in javax.servlet"><code>ServletRegistration</code></a> object. |
| |
| <p> |
| The specified <tt>className</tt> will be loaded using the classloader associated with the application represented |
| by this ServletContext. |
| |
| <p> |
| If this ServletContext already contains a preliminary ServletRegistration for a servlet with the given |
| <tt>servletName</tt>, it will be completed (by assigning the given <tt>className</tt> to it) and returned. |
| |
| <p> |
| This method introspects the class with the given <tt>className</tt> for the |
| <a href="../../javax/servlet/annotation/ServletSecurity.html" title="annotation in javax.servlet.annotation"><code>ServletSecurity</code></a>, <a href="../../javax/servlet/annotation/MultipartConfig.html" title="annotation in javax.servlet.annotation"><code>MultipartConfig</code></a>, |
| <tt>javax.annotation.security.RunAs</tt>, and <tt>javax.annotation.security.DeclareRoles</tt> annotations. In |
| addition, this method supports resource injection if the class with the given <tt>className</tt> represents a |
| Managed Bean. See the Jakarta EE platform and CDI specifications for additional details about Managed Beans and |
| resource injection.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>servletName</code> - the name of the servlet</dd> |
| <dd><code>className</code> - the fully qualified class name of the servlet</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a ServletRegistration object that may be used to further configure the registered servlet, or |
| <tt>null</tt> if this ServletContext already contains a complete ServletRegistration for a servlet with |
| the given <tt>servletName</tt></dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.IllegalStateException</code> - if this ServletContext has already been initialized</dd> |
| <dd><code>java.lang.IllegalArgumentException</code> - if <code>servletName</code> is null or an empty String</dd> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="addServlet-java.lang.String-javax.servlet.Servlet-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>addServlet</h4> |
| <pre><a href="../../javax/servlet/ServletRegistration.Dynamic.html" title="interface in javax.servlet">ServletRegistration.Dynamic</a> addServlet(java.lang.String servletName, |
| <a href="../../javax/servlet/Servlet.html" title="interface in javax.servlet">Servlet</a> servlet)</pre> |
| <div class="block">Registers the given servlet instance with this ServletContext under the given <tt>servletName</tt>. |
| |
| <p> |
| The registered servlet may be further configured via the returned <a href="../../javax/servlet/ServletRegistration.html" title="interface in javax.servlet"><code>ServletRegistration</code></a> object. |
| |
| <p> |
| If this ServletContext already contains a preliminary ServletRegistration for a servlet with the given |
| <tt>servletName</tt>, it will be completed (by assigning the class name of the given servlet instance to it) and |
| returned.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>servletName</code> - the name of the servlet</dd> |
| <dd><code>servlet</code> - the servlet instance to register</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a ServletRegistration object that may be used to further configure the given servlet, or <tt>null</tt> if |
| this ServletContext already contains a complete ServletRegistration for a servlet with the given |
| <tt>servletName</tt> or if the same servlet instance has already been registered with this or another |
| ServletContext in the same container</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.IllegalStateException</code> - if this ServletContext has already been initialized</dd> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dd><code>java.lang.IllegalArgumentException</code> - if the given servlet instance implements <a href="../../javax/servlet/SingleThreadModel.html" title="interface in javax.servlet"><code>SingleThreadModel</code></a>, or |
| <code>servletName</code> is null or an empty String</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="addServlet-java.lang.String-java.lang.Class-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>addServlet</h4> |
| <pre><a href="../../javax/servlet/ServletRegistration.Dynamic.html" title="interface in javax.servlet">ServletRegistration.Dynamic</a> addServlet(java.lang.String servletName, |
| java.lang.Class<? extends <a href="../../javax/servlet/Servlet.html" title="interface in javax.servlet">Servlet</a>> servletClass)</pre> |
| <div class="block">Adds the servlet with the given name and class type to this servlet context. |
| |
| <p> |
| The registered servlet may be further configured via the returned <a href="../../javax/servlet/ServletRegistration.html" title="interface in javax.servlet"><code>ServletRegistration</code></a> object. |
| |
| <p> |
| If this ServletContext already contains a preliminary ServletRegistration for a servlet with the given |
| <tt>servletName</tt>, it will be completed (by assigning the name of the given <tt>servletClass</tt> to it) and |
| returned. |
| |
| <p> |
| This method introspects the given <tt>servletClass</tt> for the <a href="../../javax/servlet/annotation/ServletSecurity.html" title="annotation in javax.servlet.annotation"><code>ServletSecurity</code></a>, |
| <a href="../../javax/servlet/annotation/MultipartConfig.html" title="annotation in javax.servlet.annotation"><code>MultipartConfig</code></a>, <tt>javax.annotation.security.RunAs</tt>, and |
| <tt>javax.annotation.security.DeclareRoles</tt> annotations. In addition, this method supports resource injection |
| if the given <tt>servletClass</tt> represents a Managed Bean. See the Jakarta EE platform and CDI specifications |
| for additional details about Managed Beans and resource injection.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>servletName</code> - the name of the servlet</dd> |
| <dd><code>servletClass</code> - the class object from which the servlet will be instantiated</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a ServletRegistration object that may be used to further configure the registered servlet, or |
| <tt>null</tt> if this ServletContext already contains a complete ServletRegistration for the given |
| <tt>servletName</tt></dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.IllegalStateException</code> - if this ServletContext has already been initialized</dd> |
| <dd><code>java.lang.IllegalArgumentException</code> - if <code>servletName</code> is null or an empty String</dd> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="addJspFile-java.lang.String-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>addJspFile</h4> |
| <pre><a href="../../javax/servlet/ServletRegistration.Dynamic.html" title="interface in javax.servlet">ServletRegistration.Dynamic</a> addJspFile(java.lang.String servletName, |
| java.lang.String jspFile)</pre> |
| <div class="block">Adds the servlet with the given jsp file to this servlet context. |
| |
| <p> |
| The registered servlet may be further configured via the returned <a href="../../javax/servlet/ServletRegistration.html" title="interface in javax.servlet"><code>ServletRegistration</code></a> object. |
| |
| <p> |
| If this ServletContext already contains a preliminary ServletRegistration for a servlet with the given |
| <tt>servletName</tt>, it will be completed (by assigning the given <tt>jspFile</tt> to it) and returned.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>servletName</code> - the name of the servlet</dd> |
| <dd><code>jspFile</code> - the full path to a JSP file within the web application beginning with a `/'.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a ServletRegistration object that may be used to further configure the registered servlet, or |
| <tt>null</tt> if this ServletContext already contains a complete ServletRegistration for a servlet with |
| the given <tt>servletName</tt></dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.IllegalStateException</code> - if this ServletContext has already been initialized</dd> |
| <dd><code>java.lang.IllegalArgumentException</code> - if <code>servletName</code> is null or an empty String</dd> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 4.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="createServlet-java.lang.Class-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>createServlet</h4> |
| <pre><T extends <a href="../../javax/servlet/Servlet.html" title="interface in javax.servlet">Servlet</a>> T createServlet(java.lang.Class<T> clazz) |
| throws <a href="../../javax/servlet/ServletException.html" title="class in javax.servlet">ServletException</a></pre> |
| <div class="block">Instantiates the given Servlet class. |
| |
| <p> |
| The returned Servlet instance may be further customized before it is registered with this ServletContext via a |
| call to <a href="../../javax/servlet/ServletContext.html#addServlet-java.lang.String-javax.servlet.Servlet-"><code>addServlet(String,Servlet)</code></a>. |
| |
| <p> |
| The given Servlet class must define a zero argument constructor, which is used to instantiate it. |
| |
| <p> |
| This method introspects the given <tt>clazz</tt> for the following annotations: |
| <a href="../../javax/servlet/annotation/ServletSecurity.html" title="annotation in javax.servlet.annotation"><code>ServletSecurity</code></a>, <a href="../../javax/servlet/annotation/MultipartConfig.html" title="annotation in javax.servlet.annotation"><code>MultipartConfig</code></a>, |
| <tt>javax.annotation.security.RunAs</tt>, and <tt>javax.annotation.security.DeclareRoles</tt>. In addition, this |
| method supports resource injection if the given <tt>clazz</tt> represents a Managed Bean. See the Jakarta EE |
| platform and CDI specifications for additional details about Managed Beans and resource injection.</div> |
| <dl> |
| <dt><span class="paramLabel">Type Parameters:</span></dt> |
| <dd><code>T</code> - the class of the Servlet to create</dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>clazz</code> - the Servlet class to instantiate</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the new Servlet instance</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 the given <tt>clazz</tt> fails to be instantiated</dd> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getServletRegistration-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getServletRegistration</h4> |
| <pre><a href="../../javax/servlet/ServletRegistration.html" title="interface in javax.servlet">ServletRegistration</a> getServletRegistration(java.lang.String servletName)</pre> |
| <div class="block">Gets the ServletRegistration corresponding to the servlet with the given <tt>servletName</tt>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>servletName</code> - the name of a servlet</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the (complete or preliminary) ServletRegistration for the servlet with the given <tt>servletName</tt>, or |
| null if no ServletRegistration exists under that name</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getServletRegistrations--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getServletRegistrations</h4> |
| <pre>java.util.Map<java.lang.String,? extends <a href="../../javax/servlet/ServletRegistration.html" title="interface in javax.servlet">ServletRegistration</a>> getServletRegistrations()</pre> |
| <div class="block">Gets a (possibly empty) Map of the ServletRegistration objects (keyed by servlet name) corresponding to all |
| servlets registered with this ServletContext. |
| |
| <p> |
| The returned Map includes the ServletRegistration objects corresponding to all declared and annotated servlets, |
| as well as the ServletRegistration objects corresponding to all servlets that have been added via one of the |
| <tt>addServlet</tt> and <tt>addJspFile</tt> methods. |
| |
| <p> |
| If permitted, any changes to the returned Map must not affect this ServletContext.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>Map of the (complete and preliminary) ServletRegistration objects corresponding to all servlets currently |
| registered with this ServletContext</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="addFilter-java.lang.String-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>addFilter</h4> |
| <pre><a href="../../javax/servlet/FilterRegistration.Dynamic.html" title="interface in javax.servlet">FilterRegistration.Dynamic</a> addFilter(java.lang.String filterName, |
| java.lang.String className)</pre> |
| <div class="block">Adds the filter with the given name and class name to this servlet context. |
| |
| <p> |
| The registered filter may be further configured via the returned <a href="../../javax/servlet/FilterRegistration.html" title="interface in javax.servlet"><code>FilterRegistration</code></a> object. |
| |
| <p> |
| The specified <tt>className</tt> will be loaded using the classloader associated with the application represented |
| by this ServletContext. |
| |
| <p> |
| If this ServletContext already contains a preliminary FilterRegistration for a filter with the given |
| <tt>filterName</tt>, it will be completed (by assigning the given <tt>className</tt> to it) and returned. |
| |
| <p> |
| This method supports resource injection if the class with the given <tt>className</tt> represents a Managed Bean. |
| See the Jakarta EE platform and CDI specifications for additional details about Managed Beans and resource |
| injection.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>filterName</code> - the name of the filter</dd> |
| <dd><code>className</code> - the fully qualified class name of the filter</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a FilterRegistration object that may be used to further configure the registered filter, or <tt>null</tt> |
| if this ServletContext already contains a complete FilterRegistration for a filter with the given |
| <tt>filterName</tt></dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.IllegalStateException</code> - if this ServletContext has already been initialized</dd> |
| <dd><code>java.lang.IllegalArgumentException</code> - if <code>filterName</code> is null or an empty String</dd> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="addFilter-java.lang.String-javax.servlet.Filter-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>addFilter</h4> |
| <pre><a href="../../javax/servlet/FilterRegistration.Dynamic.html" title="interface in javax.servlet">FilterRegistration.Dynamic</a> addFilter(java.lang.String filterName, |
| <a href="../../javax/servlet/Filter.html" title="interface in javax.servlet">Filter</a> filter)</pre> |
| <div class="block">Registers the given filter instance with this ServletContext under the given <tt>filterName</tt>. |
| |
| <p> |
| The registered filter may be further configured via the returned <a href="../../javax/servlet/FilterRegistration.html" title="interface in javax.servlet"><code>FilterRegistration</code></a> object. |
| |
| <p> |
| If this ServletContext already contains a preliminary FilterRegistration for a filter with the given |
| <tt>filterName</tt>, it will be completed (by assigning the class name of the given filter instance to it) and |
| returned.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>filterName</code> - the name of the filter</dd> |
| <dd><code>filter</code> - the filter instance to register</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a FilterRegistration object that may be used to further configure the given filter, or <tt>null</tt> if |
| this ServletContext already contains a complete FilterRegistration for a filter with the given |
| <tt>filterName</tt> or if the same filter instance has already been registered with this or another |
| ServletContext in the same container</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.IllegalStateException</code> - if this ServletContext has already been initialized</dd> |
| <dd><code>java.lang.IllegalArgumentException</code> - if <code>filterName</code> is null or an empty String</dd> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="addFilter-java.lang.String-java.lang.Class-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>addFilter</h4> |
| <pre><a href="../../javax/servlet/FilterRegistration.Dynamic.html" title="interface in javax.servlet">FilterRegistration.Dynamic</a> addFilter(java.lang.String filterName, |
| java.lang.Class<? extends <a href="../../javax/servlet/Filter.html" title="interface in javax.servlet">Filter</a>> filterClass)</pre> |
| <div class="block">Adds the filter with the given name and class type to this servlet context. |
| |
| <p> |
| The registered filter may be further configured via the returned <a href="../../javax/servlet/FilterRegistration.html" title="interface in javax.servlet"><code>FilterRegistration</code></a> object. |
| |
| <p> |
| If this ServletContext already contains a preliminary FilterRegistration for a filter with the given |
| <tt>filterName</tt>, it will be completed (by assigning the name of the given <tt>filterClass</tt> to it) and |
| returned. |
| |
| <p> |
| This method supports resource injection if the given <tt>filterClass</tt> represents a Managed Bean. See the Java |
| EE platform and CDI specifications for additional details about Managed Beans and resource injection.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>filterName</code> - the name of the filter</dd> |
| <dd><code>filterClass</code> - the class object from which the filter will be instantiated</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a FilterRegistration object that may be used to further configure the registered filter, or <tt>null</tt> |
| if this ServletContext already contains a complete FilterRegistration for a filter with the given |
| <tt>filterName</tt></dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.IllegalStateException</code> - if this ServletContext has already been initialized</dd> |
| <dd><code>java.lang.IllegalArgumentException</code> - if <code>filterName</code> is null or an empty String</dd> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="createFilter-java.lang.Class-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>createFilter</h4> |
| <pre><T extends <a href="../../javax/servlet/Filter.html" title="interface in javax.servlet">Filter</a>> T createFilter(java.lang.Class<T> clazz) |
| throws <a href="../../javax/servlet/ServletException.html" title="class in javax.servlet">ServletException</a></pre> |
| <div class="block">Instantiates the given Filter class. |
| |
| <p> |
| The returned Filter instance may be further customized before it is registered with this ServletContext via a |
| call to <a href="../../javax/servlet/ServletContext.html#addFilter-java.lang.String-javax.servlet.Filter-"><code>addFilter(String,Filter)</code></a>. |
| |
| <p> |
| The given Filter class must define a zero argument constructor, which is used to instantiate it. |
| |
| <p> |
| This method supports resource injection if the given <tt>clazz</tt> represents a Managed Bean. See the Jakarta EE |
| platform and CDI specifications for additional details about Managed Beans and resource injection.</div> |
| <dl> |
| <dt><span class="paramLabel">Type Parameters:</span></dt> |
| <dd><code>T</code> - the class of the Filter to create</dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>clazz</code> - the Filter class to instantiate</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the new Filter instance</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 the given <tt>clazz</tt> fails to be instantiated</dd> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getFilterRegistration-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getFilterRegistration</h4> |
| <pre><a href="../../javax/servlet/FilterRegistration.html" title="interface in javax.servlet">FilterRegistration</a> getFilterRegistration(java.lang.String filterName)</pre> |
| <div class="block">Gets the FilterRegistration corresponding to the filter with the given <tt>filterName</tt>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>filterName</code> - the name of a filter</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the (complete or preliminary) FilterRegistration for the filter with the given <tt>filterName</tt>, or |
| null if no FilterRegistration exists under that name</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getFilterRegistrations--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getFilterRegistrations</h4> |
| <pre>java.util.Map<java.lang.String,? extends <a href="../../javax/servlet/FilterRegistration.html" title="interface in javax.servlet">FilterRegistration</a>> getFilterRegistrations()</pre> |
| <div class="block">Gets a (possibly empty) Map of the FilterRegistration objects (keyed by filter name) corresponding to all filters |
| registered with this ServletContext. |
| |
| <p> |
| The returned Map includes the FilterRegistration objects corresponding to all declared and annotated filters, as |
| well as the FilterRegistration objects corresponding to all filters that have been added via one of the |
| <tt>addFilter</tt> methods. |
| |
| <p> |
| Any changes to the returned Map must not affect this ServletContext.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>Map of the (complete and preliminary) FilterRegistration objects corresponding to all filters currently |
| registered with this ServletContext</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getSessionCookieConfig--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getSessionCookieConfig</h4> |
| <pre><a href="../../javax/servlet/SessionCookieConfig.html" title="interface in javax.servlet">SessionCookieConfig</a> getSessionCookieConfig()</pre> |
| <div class="block">Gets the <a href="../../javax/servlet/SessionCookieConfig.html" title="interface in javax.servlet"><code>SessionCookieConfig</code></a> object through which various properties of the session tracking cookies |
| created on behalf of this <tt>ServletContext</tt> may be configured. |
| |
| <p> |
| Repeated invocations of this method will return the same <tt>SessionCookieConfig</tt> instance.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the <tt>SessionCookieConfig</tt> object through which various properties of the session tracking cookies |
| created on behalf of this <tt>ServletContext</tt> may be configured</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setSessionTrackingModes-java.util.Set-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setSessionTrackingModes</h4> |
| <pre>void setSessionTrackingModes(java.util.Set<<a href="../../javax/servlet/SessionTrackingMode.html" title="enum in javax.servlet">SessionTrackingMode</a>> sessionTrackingModes)</pre> |
| <div class="block">Sets the session tracking modes that are to become effective for this <tt>ServletContext</tt>. |
| |
| <p> |
| The given <tt>sessionTrackingModes</tt> replaces any session tracking modes set by a previous invocation of this |
| method on this <tt>ServletContext</tt>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>sessionTrackingModes</code> - the set of session tracking modes to become effective for this |
| <tt>ServletContext</tt></dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.IllegalStateException</code> - if this ServletContext has already been initialized</dd> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dd><code>java.lang.IllegalArgumentException</code> - if <tt>sessionTrackingModes</tt> specifies a combination of |
| <tt>SessionTrackingMode.SSL</tt> with a session tracking mode other than |
| <tt>SessionTrackingMode.SSL</tt>, or if <tt>sessionTrackingModes</tt> |
| specifies a session tracking mode that is not supported by the servlet |
| container</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getDefaultSessionTrackingModes--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getDefaultSessionTrackingModes</h4> |
| <pre>java.util.Set<<a href="../../javax/servlet/SessionTrackingMode.html" title="enum in javax.servlet">SessionTrackingMode</a>> getDefaultSessionTrackingModes()</pre> |
| <div class="block">Gets the session tracking modes that are supported by default for this <tt>ServletContext</tt>. |
| |
| <p> |
| The returned set is not backed by the <code>ServletContext</code> object, so changes in the returned set are not |
| reflected in the <code>ServletContext</code> object, and vice-versa. |
| </p></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>set of the session tracking modes supported by default for this <tt>ServletContext</tt></dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getEffectiveSessionTrackingModes--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getEffectiveSessionTrackingModes</h4> |
| <pre>java.util.Set<<a href="../../javax/servlet/SessionTrackingMode.html" title="enum in javax.servlet">SessionTrackingMode</a>> getEffectiveSessionTrackingModes()</pre> |
| <div class="block">Gets the session tracking modes that are in effect for this <tt>ServletContext</tt>. |
| |
| <p> |
| The session tracking modes in effect are those provided to <a href="../../javax/servlet/ServletContext.html#setSessionTrackingModes-java.util.Set-"><code>setSessionTrackingModes</code></a>. |
| |
| <p> |
| The returned set is not backed by the <code>ServletContext</code> object, so changes in the returned set are not |
| reflected in the <code>ServletContext</code> object, and vice-versa. |
| </p></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>set of the session tracking modes in effect for this <tt>ServletContext</tt></dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="addListener-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>addListener</h4> |
| <pre>void addListener(java.lang.String className)</pre> |
| <div class="block">Adds the listener with the given class name to this ServletContext. |
| |
| <p> |
| The class with the given name will be loaded using the classloader associated with the application represented by |
| this ServletContext, and must implement one or more of the following interfaces: |
| <ul> |
| <li><a href="../../javax/servlet/ServletContextAttributeListener.html" title="interface in javax.servlet"><code>ServletContextAttributeListener</code></a> |
| <li><a href="../../javax/servlet/ServletRequestListener.html" title="interface in javax.servlet"><code>ServletRequestListener</code></a> |
| <li><a href="../../javax/servlet/ServletRequestAttributeListener.html" title="interface in javax.servlet"><code>ServletRequestAttributeListener</code></a> |
| <li><a href="../../javax/servlet/http/HttpSessionAttributeListener.html" title="interface in javax.servlet.http"><code>HttpSessionAttributeListener</code></a> |
| <li><a href="../../javax/servlet/http/HttpSessionIdListener.html" title="interface in javax.servlet.http"><code>HttpSessionIdListener</code></a> |
| <li><a href="../../javax/servlet/http/HttpSessionListener.html" title="interface in javax.servlet.http"><code>HttpSessionListener</code></a> |
| </ul> |
| |
| <p> |
| If this ServletContext was passed to <a href="../../javax/servlet/ServletContainerInitializer.html#onStartup-java.util.Set-javax.servlet.ServletContext-"><code>ServletContainerInitializer.onStartup(java.util.Set<java.lang.Class<?>>, javax.servlet.ServletContext)</code></a>, then the class with the given |
| name may also implement <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a>, in addition to the interfaces listed above. |
| |
| <p> |
| As part of this method call, the container must load the class with the specified class name to ensure that it |
| implements one of the required interfaces. |
| |
| <p> |
| If the class with the given name implements a listener interface whose invocation order corresponds to the |
| declaration order (i.e., if it implements <a href="../../javax/servlet/ServletRequestListener.html" title="interface in javax.servlet"><code>ServletRequestListener</code></a>, <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a>, or |
| <a href="../../javax/servlet/http/HttpSessionListener.html" title="interface in javax.servlet.http"><code>HttpSessionListener</code></a>), then the new listener will be added to the end of the ordered |
| list of listeners of that interface. |
| |
| <p> |
| This method supports resource injection if the class with the given <tt>className</tt> represents a Managed Bean. |
| See the Jakarta EE platform and CDI specifications for additional details about Managed Beans and resource |
| injection.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>className</code> - the fully qualified class name of the listener</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.IllegalArgumentException</code> - if the class with the given name does not implement any of the above |
| interfaces, or if it implements <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> and this |
| ServletContext was not passed to |
| <a href="../../javax/servlet/ServletContainerInitializer.html#onStartup-java.util.Set-javax.servlet.ServletContext-"><code>ServletContainerInitializer.onStartup(java.util.Set<java.lang.Class<?>>, javax.servlet.ServletContext)</code></a></dd> |
| <dd><code>java.lang.IllegalStateException</code> - if this ServletContext has already been initialized</dd> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="addListener-java.util.EventListener-"> |
| <!-- --> |
| </a><a name="addListener-T-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>addListener</h4> |
| <pre><T extends java.util.EventListener> void addListener(T t)</pre> |
| <div class="block">Adds the given listener to this ServletContext. |
| |
| <p> |
| The given listener must be an instance of one or more of the following interfaces: |
| <ul> |
| <li><a href="../../javax/servlet/ServletContextAttributeListener.html" title="interface in javax.servlet"><code>ServletContextAttributeListener</code></a> |
| <li><a href="../../javax/servlet/ServletRequestListener.html" title="interface in javax.servlet"><code>ServletRequestListener</code></a> |
| <li><a href="../../javax/servlet/ServletRequestAttributeListener.html" title="interface in javax.servlet"><code>ServletRequestAttributeListener</code></a> |
| <li><a href="../../javax/servlet/http/HttpSessionAttributeListener.html" title="interface in javax.servlet.http"><code>HttpSessionAttributeListener</code></a> |
| <li><a href="../../javax/servlet/http/HttpSessionIdListener.html" title="interface in javax.servlet.http"><code>HttpSessionIdListener</code></a> |
| <li><a href="../../javax/servlet/http/HttpSessionListener.html" title="interface in javax.servlet.http"><code>HttpSessionListener</code></a> |
| </ul> |
| |
| <p> |
| If this ServletContext was passed to <a href="../../javax/servlet/ServletContainerInitializer.html#onStartup-java.util.Set-javax.servlet.ServletContext-"><code>ServletContainerInitializer.onStartup(java.util.Set<java.lang.Class<?>>, javax.servlet.ServletContext)</code></a>, then the given listener may |
| also be an instance of <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a>, in addition to the interfaces listed above. |
| |
| <p> |
| If the given listener is an instance of a listener interface whose invocation order corresponds to the |
| declaration order (i.e., if it is an instance of <a href="../../javax/servlet/ServletRequestListener.html" title="interface in javax.servlet"><code>ServletRequestListener</code></a>, <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a>, |
| or <a href="../../javax/servlet/http/HttpSessionListener.html" title="interface in javax.servlet.http"><code>HttpSessionListener</code></a>), then the listener will be added to the end of the ordered |
| list of listeners of that interface.</div> |
| <dl> |
| <dt><span class="paramLabel">Type Parameters:</span></dt> |
| <dd><code>T</code> - the class of the EventListener to add</dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>t</code> - the listener to be added</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.IllegalArgumentException</code> - if the given listener is not an instance of any of the above interfaces, or |
| if it is an instance of <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> and this |
| ServletContext was not passed to |
| <a href="../../javax/servlet/ServletContainerInitializer.html#onStartup-java.util.Set-javax.servlet.ServletContext-"><code>ServletContainerInitializer.onStartup(java.util.Set<java.lang.Class<?>>, javax.servlet.ServletContext)</code></a></dd> |
| <dd><code>java.lang.IllegalStateException</code> - if this ServletContext has already been initialized</dd> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="addListener-java.lang.Class-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>addListener</h4> |
| <pre>void addListener(java.lang.Class<? extends java.util.EventListener> listenerClass)</pre> |
| <div class="block">Adds a listener of the given class type to this ServletContext. |
| |
| <p> |
| The given <tt>listenerClass</tt> must implement one or more of the following interfaces: |
| <ul> |
| <li><a href="../../javax/servlet/ServletContextAttributeListener.html" title="interface in javax.servlet"><code>ServletContextAttributeListener</code></a> |
| <li><a href="../../javax/servlet/ServletRequestListener.html" title="interface in javax.servlet"><code>ServletRequestListener</code></a> |
| <li><a href="../../javax/servlet/ServletRequestAttributeListener.html" title="interface in javax.servlet"><code>ServletRequestAttributeListener</code></a> |
| <li><a href="../../javax/servlet/http/HttpSessionAttributeListener.html" title="interface in javax.servlet.http"><code>HttpSessionAttributeListener</code></a> |
| <li><a href="../../javax/servlet/http/HttpSessionIdListener.html" title="interface in javax.servlet.http"><code>HttpSessionIdListener</code></a> |
| <li><a href="../../javax/servlet/http/HttpSessionListener.html" title="interface in javax.servlet.http"><code>HttpSessionListener</code></a> |
| </ul> |
| |
| <p> |
| If this ServletContext was passed to <a href="../../javax/servlet/ServletContainerInitializer.html#onStartup-java.util.Set-javax.servlet.ServletContext-"><code>ServletContainerInitializer.onStartup(java.util.Set<java.lang.Class<?>>, javax.servlet.ServletContext)</code></a>, then the given |
| <tt>listenerClass</tt> may also implement <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a>, in addition to the interfaces listed |
| above. |
| |
| <p> |
| If the given <tt>listenerClass</tt> implements a listener interface whose invocation order corresponds to the |
| declaration order (i.e., if it implements <a href="../../javax/servlet/ServletRequestListener.html" title="interface in javax.servlet"><code>ServletRequestListener</code></a>, <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a>, or |
| <a href="../../javax/servlet/http/HttpSessionListener.html" title="interface in javax.servlet.http"><code>HttpSessionListener</code></a>), then the new listener will be added to the end of the ordered |
| list of listeners of that interface. |
| |
| <p> |
| This method supports resource injection if the given <tt>listenerClass</tt> represents a Managed Bean. See the |
| Jakarta EE platform and CDI specifications for additional details about Managed Beans and resource injection.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>listenerClass</code> - the listener class to be instantiated</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.IllegalArgumentException</code> - if the given <tt>listenerClass</tt> does not implement any of the above |
| interfaces, or if it implements <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> and this |
| ServletContext was not passed to |
| <a href="../../javax/servlet/ServletContainerInitializer.html#onStartup-java.util.Set-javax.servlet.ServletContext-"><code>ServletContainerInitializer.onStartup(java.util.Set<java.lang.Class<?>>, javax.servlet.ServletContext)</code></a></dd> |
| <dd><code>java.lang.IllegalStateException</code> - if this ServletContext has already been initialized</dd> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="createListener-java.lang.Class-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>createListener</h4> |
| <pre><T extends java.util.EventListener> T createListener(java.lang.Class<T> clazz) |
| throws <a href="../../javax/servlet/ServletException.html" title="class in javax.servlet">ServletException</a></pre> |
| <div class="block">Instantiates the given EventListener class. |
| |
| <p> |
| The specified EventListener class must implement at least one of the <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a>, |
| <a href="../../javax/servlet/ServletContextAttributeListener.html" title="interface in javax.servlet"><code>ServletContextAttributeListener</code></a>, <a href="../../javax/servlet/ServletRequestListener.html" title="interface in javax.servlet"><code>ServletRequestListener</code></a>, <a href="../../javax/servlet/ServletRequestAttributeListener.html" title="interface in javax.servlet"><code>ServletRequestAttributeListener</code></a>, |
| <a href="../../javax/servlet/http/HttpSessionAttributeListener.html" title="interface in javax.servlet.http"><code>HttpSessionAttributeListener</code></a>, <a href="../../javax/servlet/http/HttpSessionIdListener.html" title="interface in javax.servlet.http"><code>HttpSessionIdListener</code></a>, or |
| <a href="../../javax/servlet/http/HttpSessionListener.html" title="interface in javax.servlet.http"><code>HttpSessionListener</code></a> interfaces. |
| |
| <p> |
| The returned EventListener instance may be further customized before it is registered with this ServletContext |
| via a call to <a href="../../javax/servlet/ServletContext.html#addListener-T-"><code>addListener(EventListener)</code></a>. |
| |
| <p> |
| The given EventListener class must define a zero argument constructor, which is used to instantiate it. |
| |
| <p> |
| This method supports resource injection if the given <tt>clazz</tt> represents a Managed Bean. See the Jakarta EE |
| platform and CDI specifications for additional details about Managed Beans and resource injection.</div> |
| <dl> |
| <dt><span class="paramLabel">Type Parameters:</span></dt> |
| <dd><code>T</code> - the class of the EventListener to create</dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>clazz</code> - the EventListener class to instantiate</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the new EventListener instance</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 the given <tt>clazz</tt> fails to be instantiated</dd> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dd><code>java.lang.IllegalArgumentException</code> - if the specified EventListener class does not implement any of the |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a>, <a href="../../javax/servlet/ServletContextAttributeListener.html" title="interface in javax.servlet"><code>ServletContextAttributeListener</code></a>, |
| <a href="../../javax/servlet/ServletRequestListener.html" title="interface in javax.servlet"><code>ServletRequestListener</code></a>, <a href="../../javax/servlet/ServletRequestAttributeListener.html" title="interface in javax.servlet"><code>ServletRequestAttributeListener</code></a>, |
| <a href="../../javax/servlet/http/HttpSessionAttributeListener.html" title="interface in javax.servlet.http"><code>HttpSessionAttributeListener</code></a>, |
| <a href="../../javax/servlet/http/HttpSessionIdListener.html" title="interface in javax.servlet.http"><code>HttpSessionIdListener</code></a>, or |
| <a href="../../javax/servlet/http/HttpSessionListener.html" title="interface in javax.servlet.http"><code>HttpSessionListener</code></a> interfaces.</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getJspConfigDescriptor--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getJspConfigDescriptor</h4> |
| <pre><a href="../../javax/servlet/descriptor/JspConfigDescriptor.html" title="interface in javax.servlet.descriptor">JspConfigDescriptor</a> getJspConfigDescriptor()</pre> |
| <div class="block">Gets the <code><jsp-config></code> related configuration that was aggregated from the <code>web.xml</code> |
| and <code>web-fragment.xml</code> descriptor files of the web application represented by this ServletContext.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the <code><jsp-config></code> related configuration that was aggregated from the |
| <code>web.xml</code> and <code>web-fragment.xml</code> descriptor files of the web application |
| represented by this ServletContext, or null if no such configuration exists</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <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/descriptor/JspConfigDescriptor.html" title="interface in javax.servlet.descriptor"><code>JspConfigDescriptor</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getClassLoader--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getClassLoader</h4> |
| <pre>java.lang.ClassLoader getClassLoader()</pre> |
| <div class="block">Gets the class loader of the web application represented by this ServletContext. |
| |
| <p> |
| If a security manager exists, and the caller's class loader is not the same as, or an ancestor of the requested |
| class loader, then the security manager's <code>checkPermission</code> method is called with a |
| <code>RuntimePermission("getClassLoader")</code> permission to check whether access to the requested class loader |
| should be granted.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the class loader of the web application represented by this ServletContext</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dd><code>java.lang.SecurityException</code> - if a security manager denies access to the requested class loader</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="declareRoles-java.lang.String...-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>declareRoles</h4> |
| <pre>void declareRoles(java.lang.String... roleNames)</pre> |
| <div class="block">Declares role names that are tested using <code>isUserInRole</code>. |
| |
| <p> |
| Roles that are implicitly declared as a result of their use within the |
| <a href="../../javax/servlet/ServletRegistration.Dynamic.html#setServletSecurity-javax.servlet.ServletSecurityElement-"><code>setServletSecurity</code></a> or |
| <a href="../../javax/servlet/ServletRegistration.Dynamic.html#setRunAsRole-java.lang.String-"><code>setRunAsRole</code></a> methods of the <a href="../../javax/servlet/ServletRegistration.html" title="interface in javax.servlet"><code>ServletRegistration</code></a> |
| interface need not be declared.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>roleNames</code> - the role names being declared</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dd><code>java.lang.IllegalArgumentException</code> - if any of the argument roleNames is null or the empty string</dd> |
| <dd><code>java.lang.IllegalStateException</code> - if the ServletContext has already been initialized</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getVirtualServerName--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getVirtualServerName</h4> |
| <pre>java.lang.String getVirtualServerName()</pre> |
| <div class="block">Returns the configuration name of the logical host on which the ServletContext is deployed. |
| |
| Servlet containers may support multiple logical hosts. This method must return the same name for all the servlet |
| contexts deployed on a logical host, and the name returned by this method must be distinct, stable per logical |
| host, and suitable for use in associating server configuration information with the logical host. The returned |
| value is NOT expected or required to be equivalent to a network address or hostname of the logical host.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a <code>String</code> containing the configuration name of the logical host on which the servlet context |
| is deployed.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 3.1</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getSessionTimeout--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getSessionTimeout</h4> |
| <pre>int getSessionTimeout()</pre> |
| <div class="block">Gets the session timeout in minutes that are supported by default for this <tt>ServletContext</tt>.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the session timeout in minutes that are supported by default for this <tt>ServletContext</tt></dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 4.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setSessionTimeout-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setSessionTimeout</h4> |
| <pre>void setSessionTimeout(int sessionTimeout)</pre> |
| <div class="block">Sets the session timeout in minutes for this ServletContext.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>sessionTimeout</code> - session timeout in minutes</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.IllegalStateException</code> - if this ServletContext has already been initialized</dd> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 4.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getRequestCharacterEncoding--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getRequestCharacterEncoding</h4> |
| <pre>java.lang.String getRequestCharacterEncoding()</pre> |
| <div class="block">Gets the request character encoding that are supported by default for this <tt>ServletContext</tt>. This method |
| returns null if no request encoding character encoding has been specified in deployment descriptor or container |
| specific configuration (for all web applications in the container).</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the request character encoding that are supported by default for this <tt>ServletContext</tt></dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 4.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setRequestCharacterEncoding-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setRequestCharacterEncoding</h4> |
| <pre>void setRequestCharacterEncoding(java.lang.String encoding)</pre> |
| <div class="block">Sets the request character encoding for this ServletContext.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>encoding</code> - request character encoding</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.IllegalStateException</code> - if this ServletContext has already been initialized</dd> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 4.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getResponseCharacterEncoding--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getResponseCharacterEncoding</h4> |
| <pre>java.lang.String getResponseCharacterEncoding()</pre> |
| <div class="block">Gets the response character encoding that are supported by default for this <tt>ServletContext</tt>. This method |
| returns null if no response encoding character encoding has been specified in deployment descriptor or container |
| specific configuration (for all web applications in the container).</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the request character encoding that are supported by default for this <tt>ServletContext</tt></dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 4.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setResponseCharacterEncoding-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>setResponseCharacterEncoding</h4> |
| <pre>void setResponseCharacterEncoding(java.lang.String encoding)</pre> |
| <div class="block">Sets the response character encoding for this ServletContext.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>encoding</code> - response character encoding</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.IllegalStateException</code> - if this ServletContext has already been initialized</dd> |
| <dd><code>java.lang.UnsupportedOperationException</code> - if this ServletContext was passed to the |
| <a href="../../javax/servlet/ServletContextListener.html#contextInitialized-javax.servlet.ServletContextEvent-"><code>ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)</code></a> method of a |
| <a href="../../javax/servlet/ServletContextListener.html" title="interface in javax.servlet"><code>ServletContextListener</code></a> that was neither declared in |
| <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated with |
| <a href="../../javax/servlet/annotation/WebListener.html" title="annotation in javax.servlet.annotation"><code>WebListener</code></a></dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Servlet 4.0</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/ServletContainerInitializer.html" title="interface in javax.servlet"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../javax/servlet/ServletContextAttributeEvent.html" title="class in javax.servlet"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../index.html?javax/servlet/ServletContext.html" target="_top">Frames</a></li> |
| <li><a href="ServletContext.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../allclasses-noframe.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> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li>Constr | </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>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </body> |
| </html> |