001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements.  See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership.  The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License.  You may obtain a copy of the License at
009     *
010     *  http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing,
013     * software distributed under the License is distributed on an
014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     * KIND, either express or implied.  See the License for the
016     * specific language governing permissions and limitations
017     * under the License.
018     */
019    
020    package javax.servlet;
021    
022    import java.io.InputStream;
023    import java.net.MalformedURLException;
024    import java.net.URL;
025    import java.util.Enumeration;
026    import java.util.EventListener;
027    import java.util.Map;
028    import java.util.Set;
029    
030    import javax.servlet.descriptor.JspConfigDescriptor;
031    
032    
033    /**
034     * Defines a set of methods that a servlet uses to communicate with its
035     * servlet container, for example, to get the MIME type of a file, dispatch
036     * requests, or write to a log file.
037     * <p/>
038     * <p>There is one context per "web application" per Java Virtual Machine.  (A
039     * "web application" is a collection of servlets and content installed under a
040     * specific subset of the server's URL namespace such as <code>/catalog</code>
041     * and possibly installed via a <code>.war</code> file.)
042     * <p/>
043     * <p>In the case of a web
044     * application marked "distributed" in its deployment descriptor, there will
045     * be one context instance for each virtual machine.  In this situation, the
046     * context cannot be used as a location to share global information (because
047     * the information won't be truly global).  Use an external resource like
048     * a database instead.
049     * <p/>
050     * <p>The <code>ServletContext</code> object is contained within
051     * the {@link ServletConfig} object, which the Web server provides the
052     * servlet when the servlet is initialized.
053     *
054     * @version $Rev: 901916 $ $Date: 2010-01-21 18:12:17 -0500 (Thu, 21 Jan 2010) $
055     * @see Servlet#getServletConfig
056     * @see ServletConfig#getServletContext
057     */
058    
059    public interface ServletContext {
060    
061        /**
062         * @since Servlet 3.0
063         */
064        String ORDERED_LIBS = "javax.servlet.context.orderedLibs";
065        /**
066         * @since Servlet 3.0
067         */
068        String TEMPDIR = "javax.servlet.context.tempdir";
069    
070        /**
071         * @return context path for this web app or "" for the / context
072         * @since Servlet 2.5
073         */
074        String getContextPath();
075    
076        /**
077         * Returns a <code>ServletContext</code> object that
078         * corresponds to a specified URL on the server.
079         * <p/>
080         * <p>This method allows servlets to gain
081         * access to the context for various parts of the server, and as
082         * needed obtain {@link RequestDispatcher} objects from the context.
083         * The given path must be begin with "/", is interpreted relative
084         * to the server's document root and is matched against the context roots of
085         * other web applications hosted on this container.
086         * <p/>
087         * <p>In a security conscious environment, the servlet container may
088         * return <code>null</code> for a given URL.
089         *
090         * @param uripath a <code>String</code> specifying the context path of
091         *                another web application in the container.
092         * @return the <code>ServletContext</code> object that
093         *         corresponds to the named URL, or null if either
094         *         none exists or the container wishes to restrict
095         *         this access.
096         * @see RequestDispatcher
097         */
098        ServletContext getContext(String uripath);
099    
100        /**
101         * Returns the major version of the Java Servlet API that this
102         * servlet container supports. All implementations that comply
103         * with Version 3.0 must have this method
104         * return the integer 3.
105         *
106         * @return 3
107         */
108        int getMajorVersion();
109    
110        /**
111         * Returns the minor version of the Servlet API that this
112         * servlet container supports. All implementations that comply
113         * with Version 3.0 must have this method
114         * return the integer 0.
115         *
116         * @return 0
117         */
118        int getMinorVersion();
119    
120        /**
121         * Returns the MIME type of the specified file, or <code>null</code> if
122         * the MIME type is not known. The MIME type is determined
123         * by the configuration of the servlet container, and may be specified
124         * in a web application deployment descriptor. Common MIME
125         * types are <code>"text/html"</code> and <code>"image/gif"</code>.
126         *
127         * @param file a <code>String</code> specifying the name
128         *             of a file
129         * @return a <code>String</code> specifying the file's MIME type
130         */
131        String getMimeType(String file);
132    
133        /**
134         * Returns a directory-like listing of all the paths to resources within the web application whose longest sub-path
135         * matches the supplied path argument. Paths indicating subdirectory paths end with a '/'. The returned paths are all
136         * relative to the root of the web application and have a leading '/'. For example, for a web application
137         * containing<br><br>
138         * <p/>
139         * /welcome.html<br>
140         * /catalog/index.html<br>
141         * /catalog/products.html<br>
142         * /catalog/offers/books.html<br>
143         * /catalog/offers/music.html<br>
144         * /customer/login.jsp<br>
145         * /WEB-INF/web.xml<br>
146         * /WEB-INF/classes/com.acme.OrderServlet.class,<br><br>
147         * <p/>
148         * getResourcePaths("/") returns {"/welcome.html", "/catalog/", "/customer/", "/WEB-INF/"}<br>
149         * getResourcePaths("/catalog/") returns {"/catalog/index.html", "/catalog/products.html", "/catalog/offers/"}.<br>
150         *
151         * @param path the partial path used to match the resources,
152         *             which must start with a /
153         * @return a Set containing the directory listing, or null if there are no resources in the web application whose path
154         *         begins with the supplied path.
155         * @since Servlet 2.3
156         */
157        Set<String> getResourcePaths(String path);
158    
159        /**
160         * Returns a URL to the resource that is mapped to a specified
161         * path. The path must begin with a "/" and is interpreted
162         * as relative to the current context root.
163         * <p/>
164         * <p>This method allows the servlet container to make a resource
165         * available to servlets from any source. Resources
166         * can be located on a local or remote
167         * file system, in a database, or in a <code>.war</code> file.
168         * <p/>
169         * <p>The servlet container must implement the URL handlers
170         * and <code>URLConnection</code> objects that are necessary
171         * to access the resource.
172         * <p/>
173         * <p>This method returns <code>null</code>
174         * if no resource is mapped to the pathname.
175         * <p/>
176         * <p>Some containers may allow writing to the URL returned by
177         * this method using the methods of the URL class.
178         * <p/>
179         * <p>The resource content is returned directly, so be aware that
180         * requesting a <code>.jsp</code> page returns the JSP source code.
181         * Use a <code>RequestDispatcher</code> instead to include results of
182         * an execution.
183         * <p/>
184         * <p>This method has a different purpose than
185         * <code>java.lang.Class.getResource</code>,
186         * which looks up resources based on a class loader. This
187         * method does not use class loaders.
188         *
189         * @param path a <code>String</code> specifying
190         *             the path to the resource
191         * @return the resource located at the named path,
192         *         or <code>null</code> if there is no resource
193         *         at that path
194         * @throws MalformedURLException if the pathname is not given in
195         *                               the correct form
196         */
197        URL getResource(String path) throws MalformedURLException;
198    
199        /**
200         * Returns the resource located at the named path as
201         * an <code>InputStream</code> object.
202         * <p/>
203         * <p>The data in the <code>InputStream</code> can be
204         * of any type or length. The path must be specified according
205         * to the rules given in <code>getResource</code>.
206         * This method returns <code>null</code> if no resource exists at
207         * the specified path.
208         * <p/>
209         * <p>Meta-information such as content length and content type
210         * that is available via <code>getResource</code>
211         * method is lost when using this method.
212         * <p/>
213         * <p>The servlet container must implement the URL handlers
214         * and <code>URLConnection</code> objects necessary to access
215         * the resource.
216         * <p/>
217         * <p>This method is different from
218         * <code>java.lang.Class.getResourceAsStream</code>,
219         * which uses a class loader. This method allows servlet containers
220         * to make a resource available
221         * to a servlet from any location, without using a class loader.
222         *
223         * @param path a <code>String</code> specifying the path
224         *             to the resource
225         * @return the <code>InputStream</code> returned to the
226         *         servlet, or <code>null</code> if no resource
227         *         exists at the specified path
228         */
229        InputStream getResourceAsStream(String path);
230    
231        /**
232         * Returns a {@link RequestDispatcher} object that acts
233         * as a wrapper for the resource located at the given path.
234         * A <code>RequestDispatcher</code> object can be used to forward
235         * a request to the resource or to include the resource in a response.
236         * The resource can be dynamic or static.
237         * <p/>
238         * <p>The pathname must begin with a "/" and is interpreted as relative
239         * to the current context root.  Use <code>getContext</code> to obtain
240         * a <code>RequestDispatcher</code> for resources in foreign contexts.
241         * This method returns <code>null</code> if the <code>ServletContext</code>
242         * cannot return a <code>RequestDispatcher</code>.
243         *
244         * @param path a <code>String</code> specifying the pathname
245         *             to the resource
246         * @return a <code>RequestDispatcher</code> object
247         *         that acts as a wrapper for the resource
248         *         at the specified path, or <code>null</code> if
249         *         the <code>ServletContext</code> cannot return
250         *         a <code>RequestDispatcher</code>
251         * @see RequestDispatcher
252         * @see ServletContext#getContext
253         */
254        RequestDispatcher getRequestDispatcher(String path);
255    
256        /**
257         * Returns a {@link RequestDispatcher} object that acts
258         * as a wrapper for the named servlet.
259         * <p/>
260         * <p>Servlets (and JSP pages also) may be given names via server
261         * administration or via a web application deployment descriptor.
262         * A servlet instance can determine its name using
263         * {@link ServletConfig#getServletName}.
264         * <p/>
265         * <p>This method returns <code>null</code> if the
266         * <code>ServletContext</code>
267         * cannot return a <code>RequestDispatcher</code> for any reason.
268         *
269         * @param name a <code>String</code> specifying the name
270         *             of a servlet to wrap
271         * @return a <code>RequestDispatcher</code> object
272         *         that acts as a wrapper for the named servlet,
273         *         or <code>null</code> if the <code>ServletContext</code>
274         *         cannot return a <code>RequestDispatcher</code>
275         * @see RequestDispatcher
276         * @see ServletContext#getContext
277         * @see ServletConfig#getServletName
278         */
279        RequestDispatcher getNamedDispatcher(String name);
280    
281        /**
282         * @deprecated As of Java Servlet API 2.1, with no direct replacement.
283         *             <p/>
284         *             <p>This method was originally defined to retrieve a servlet
285         *             from a <code>ServletContext</code>. In this version, this method
286         *             always returns <code>null</code> and remains only to preserve
287         *             binary compatibility. This method will be permanently removed
288         *             in a future version of the Java Servlet API.
289         *             <p/>
290         *             <p>In lieu of this method, servlets can share information using the
291         *             <code>ServletContext</code> class and can perform shared business logic
292         *             by invoking methods on common non-servlet classes.
293         */
294        Servlet getServlet(String name) throws ServletException;
295    
296        /**
297         * @deprecated As of Java Servlet API 2.0, with no replacement.
298         *             <p/>
299         *             <p>This method was originally defined to return an <code>Enumeration</code>
300         *             of all the servlets known to this servlet context. In this
301         *             version, this method always returns an empty enumeration and
302         *             remains only to preserve binary compatibility. This method
303         *             will be permanently removed in a future version of the Java
304         *             Servlet API.
305         */
306        Enumeration<Servlet> getServlets();
307    
308        /**
309         * @deprecated As of Java Servlet API 2.1, with no replacement.
310         *             <p/>
311         *             <p>This method was originally defined to return an
312         *             <code>Enumeration</code>
313         *             of all the servlet names known to this context. In this version,
314         *             this method always returns an empty <code>Enumeration</code> and
315         *             remains only to preserve binary compatibility. This method will
316         *             be permanently removed in a future version of the Java Servlet API.
317         */
318        Enumeration<String> getServletNames();
319    
320        /**
321         * Writes the specified message to a servlet log file, usually
322         * an event log. The name and type of the servlet log file is
323         * specific to the servlet container.
324         *
325         * @param msg a <code>String</code> specifying the
326         *            message to be written to the log file
327         */
328        void log(String msg);
329    
330        /**
331         * @deprecated As of Java Servlet API 2.1, use
332         *             {@link #log(String message, Throwable throwable)}
333         *             instead.
334         *             <p/>
335         *             <p>This method was originally defined to write an
336         *             exception's stack trace and an explanatory error message
337         *             to the servlet log file.
338         */
339        void log(Exception exception, String msg);
340    
341        /**
342         * Writes an explanatory message and a stack trace
343         * for a given <code>Throwable</code> exception
344         * to the servlet log file. The name and type of the servlet log
345         * file is specific to the servlet container, usually an event log.
346         *
347         * @param message   a <code>String</code> that
348         *                  describes the error or exception
349         * @param throwable the <code>Throwable</code> error
350         *                  or exception
351         */
352        void log(String message, Throwable throwable);
353    
354        /**
355         * Returns a <code>String</code> containing the real path
356         * for a given virtual path. For example, the path "/index.html"
357         * returns the absolute file path on the server's filesystem would be
358         * served by a request for "http://host/contextPath/index.html",
359         * where contextPath is the context path of this ServletContext..
360         * <p/>
361         * <p>The real path returned will be in a form
362         * appropriate to the computer and operating system on
363         * which the servlet container is running, including the
364         * proper path separators. This method returns <code>null</code>
365         * if the servlet container cannot translate the virtual path
366         * to a real path for any reason (such as when the content is
367         * being made available from a <code>.war</code> archive).
368         *
369         * @param path a <code>String</code> specifying a virtual path
370         * @return a <code>String</code> specifying the real path,
371         *         or null if the translation cannot be performed
372         */
373        String getRealPath(String path);
374    
375        /**
376         * Returns the name and version of the servlet container on which
377         * the servlet is running.
378         * <p/>
379         * <p>The form of the returned string is
380         * <i>servername</i>/<i>versionnumber</i>.
381         * For example, the JavaServer Web Development Kit may return the string
382         * <code>JavaServer Web Dev Kit/1.0</code>.
383         * <p/>
384         * <p>The servlet container may return other optional information
385         * after the primary string in parentheses, for example,
386         * <code>JavaServer Web Dev Kit/1.0 (JDK 1.1.6; Windows NT 4.0 x86)</code>.
387         *
388         * @return a <code>String</code> containing at least the
389         *         servlet container name and version number
390         */
391        String getServerInfo();
392    
393        /**
394         * Returns a <code>String</code> containing the value of the named
395         * context-wide initialization parameter, or <code>null</code> if the
396         * parameter does not exist.
397         * <p/>
398         * <p>This method can make available configuration information useful
399         * to an entire "web application".  For example, it can provide a
400         * webmaster's email address or the name of a system that holds
401         * critical data.
402         *
403         * @param name a <code>String</code> containing the name of the
404         *             parameter whose value is requested
405         * @return a <code>String</code> containing at least the
406         *         servlet container name and version number
407         * @see ServletConfig#getInitParameter
408         */
409        String getInitParameter(String name);
410    
411        /**
412         * Returns the names of the context's initialization parameters as an
413         * <code>Enumeration</code> of <code>String</code> objects, or an
414         * empty <code>Enumeration</code> if the context has no initialization
415         * parameters.
416         *
417         * @return an <code>Enumeration</code> of <code>String</code>
418         *         objects containing the names of the context's
419         *         initialization parameters
420         * @see ServletConfig#getInitParameter
421         */
422        Enumeration<String> getInitParameterNames();
423    
424        /**
425         * Set the init parameter if it is not already set.
426         *
427         * @param name  of the init parameter to set
428         * @param value new value
429         * @return whether it was set
430         * @since 3.0
431         */
432        boolean setInitParameter(String name, String value);
433    
434        /**
435         * Returns the servlet container attribute with the given name,
436         * or <code>null</code> if there is no attribute by that name.
437         * An attribute allows a servlet container to give the
438         * servlet additional information not
439         * already provided by this interface. See your
440         * server documentation for information about its attributes.
441         * A list of supported attributes can be retrieved using
442         * <code>getAttributeNames</code>.
443         * <p/>
444         * <p>The attribute is returned as a <code>java.lang.Object</code>
445         * or some subclass.
446         * Attribute names should follow the same convention as package
447         * names. The Java Servlet API specification reserves names
448         * matching <code>java.*</code>, <code>javax.*</code>,
449         * and <code>sun.*</code>.
450         *
451         * @param name a <code>String</code> specifying the name
452         *             of the attribute
453         * @return an <code>Object</code> containing the value
454         *         of the attribute, or <code>null</code>
455         *         if no attribute exists matching the given
456         *         name
457         * @see ServletContext#getAttributeNames
458         */
459        Object getAttribute(String name);
460    
461        /**
462         * Returns an <code>Enumeration</code> containing the
463         * attribute names available
464         * within this servlet context. Use the
465         * {@link #getAttribute} method with an attribute name
466         * to get the value of an attribute.
467         *
468         * @return an <code>Enumeration</code> of attribute
469         *         names
470         * @see #getAttribute
471         */
472        Enumeration<String> getAttributeNames();
473    
474        /**
475         * Binds an object to a given attribute name in this servlet context. If
476         * the name specified is already used for an attribute, this
477         * method will replace the attribute with the new to the new attribute.
478         * <p>If listeners are configured on the <code>ServletContext</code> the
479         * container notifies them accordingly.
480         * <p/>
481         * If a null value is passed, the effect is the same as calling
482         * <code>removeAttribute()</code>.
483         * <p/>
484         * <p>Attribute names should follow the same convention as package
485         * names. The Java Servlet API specification reserves names
486         * matching <code>java.*</code>, <code>javax.*</code>, and
487         * <code>sun.*</code>.
488         *
489         * @param name   a <code>String</code> specifying the name
490         *               of the attribute
491         * @param object an <code>Object</code> representing the
492         *               attribute to be bound
493         */
494        void setAttribute(String name, Object object);
495    
496        /**
497         * Removes the attribute with the given name from
498         * the servlet context. After removal, subsequent calls to
499         * {@link #getAttribute} to retrieve the attribute's value
500         * will return <code>null</code>.
501         * <p/>
502         * <p>If listeners are configured on the <code>ServletContext</code> the
503         * container notifies them accordingly.
504         *
505         * @param name a <code>String</code> specifying the name
506         *             of the attribute to be removed
507         */
508        void removeAttribute(String name);
509    
510        /**
511         * Returns the name of this web application corresponding to this ServletContext as specified in the deployment
512         * descriptor for this web application by the display-name element.
513         *
514         * @return The name of the web application or null if no name has been declared in the deployment descriptor.
515         * @since Servlet 2.3
516         */
517        String getServletContextName();
518    
519        /**
520         * Add the specified servlet to the context
521         *
522         * @param servletName servlet's name
523         * @param className   class name of servlet
524         * @return ServletRegistration.Dynamic allowing configuration of the servlet
525         * @throws IllegalArgumentException duplicate servletName
526         * @throws IllegalStateException    this method called after #initialize
527         * @since 3.0
528         */
529        ServletRegistration.Dynamic addServlet(String servletName, String className) throws IllegalArgumentException, IllegalStateException;
530    
531        /**
532         * Add the specified servlet to the context
533         *
534         * @param servletName servlet's name
535         * @param servlet     servlet instance, perhaps created with createServlet
536         * @return ServletRegistration.Dynamic allowing configuration of the servlet
537         * @throws IllegalArgumentException duplicate servletName
538         * @throws IllegalStateException    this method called after #initialize
539         * @since 3.0
540         */
541        ServletRegistration.Dynamic addServlet(String servletName, Servlet servlet) throws IllegalArgumentException, IllegalStateException;
542    
543        /**
544         * Add the specified servlet to the context
545         *
546         * @param servletName servlet's name
547         * @param clazz       class of the servlet
548         * @return ServletRegistration.Dynamic allowing configuration of the servlet
549         * @throws IllegalArgumentException duplicate servletName
550         * @throws IllegalStateException    this method called after #initialize
551         * @since 3.0
552         */
553        ServletRegistration.Dynamic addServlet(String servletName, Class<? extends Servlet> clazz) throws IllegalArgumentException, IllegalStateException;
554    
555        /**
556         * Create a servlet with dependencies injected.
557         *
558         * @param clazz servlet class
559         * @return instantiated and injected servlet
560         * @throws ServletException if something goes wrong
561         * @since Servlet 3.0
562         */
563        <T extends Servlet> T createServlet(Class<T> clazz) throws ServletException;
564    
565        /**
566         * Fish out the servlet registration for a named servlet
567         *
568         * @param servletName name of the servlet you want to configure
569         * @return ServletRegistration for servlet you want
570         * @since 3.0
571         */
572        ServletRegistration getServletRegistration(String servletName);
573    
574        /**
575         * Fish out the servlet registration for a named servlet
576         *
577         * @return Map of name to ServletRegistration for all registered servlets
578         * @since 3.0
579         */
580        Map<String, ? extends ServletRegistration> getServletRegistrations();
581    
582        /**
583         * Add a filter to this context
584         *
585         * @param filterName name of filter
586         * @param className  class name of filter
587         * @return FilterRegistration.Dynamic allowing configuration of filter
588         * @throws IllegalArgumentException duplicate filter name
589         * @throws IllegalStateException    if called after #initialise
590         * @since 3.0
591         */
592        FilterRegistration.Dynamic addFilter(String filterName, String className) throws IllegalArgumentException, IllegalStateException;
593    
594        /**
595         * Add a filter to this context
596         *
597         * @param filterName name of filter
598         * @param filter     filter instance perhaps from createFilter method
599         * @return FilterRegistration.Dynamic allowing configuration of filter
600         * @throws IllegalArgumentException duplicate filter name
601         * @throws IllegalStateException    if called after #initialise
602         * @since 3.0
603         */
604        FilterRegistration.Dynamic addFilter(String filterName, Filter filter) throws IllegalArgumentException, IllegalStateException;
605    
606        /**
607         * Add a filter to this context
608         *
609         * @param filterName  name of filter
610         * @param filterClass filter class
611         * @return FilterRegistration.Dynamic allowing configuration of filter
612         * @throws IllegalArgumentException duplicate filter name
613         * @throws IllegalStateException    if called after #initialise
614         * @since 3.0
615         */
616        FilterRegistration.Dynamic addFilter(String filterName, Class<? extends Filter> filterClass) throws IllegalArgumentException, IllegalStateException;
617    
618        /**
619         * Create a filter with dependencies injected.
620         *
621         * @param clazz filter class
622         * @return instantiated and injected filter
623         * @throws ServletException if something goes wrong
624         * @since Servlet 3.0
625         */
626        <T extends Filter> T createFilter(Class<T> clazz) throws ServletException;
627    
628        /**
629         * Return the FilterRegistration corresponding to the named filter
630         * @param filterName Name of filter you want to configure
631         * @return FilterRegistration allowing configuration of filter
632         * @since 3.0
633         */
634        FilterRegistration getFilterRegistration(String filterName);
635    
636        /**
637         * Return a possibly empty immutable map of registrations for all filters.
638         * @return FilterRegistration allowing configuration of filter
639         * @since 3.0
640         */
641        Map<String, ? extends FilterRegistration> getFilterRegistrations();
642    
643        /**
644         * Add a listener created from the specified class
645         * @param listenerClass class of listener to add
646         * @since Servlet 3.0
647         */
648        void addListener(Class<? extends EventListener> listenerClass);
649    
650        /**
651         * Add a listener created from the specified class name
652         * @param className name of class of listener to add
653         * @since Servlet 3.0
654         */
655        void addListener(String className);
656    
657        /**
658         * add the listener instance
659         * @param t listener instance
660         * @param <T> type of listener
661         * @since Servlet 3.0
662         */
663        <T extends EventListener> void addListener(T t);
664    
665        /**
666         * create a fully initialized listener
667         * @param clazz listener class
668         * @param <T> type of listener class
669         * @return fully initialized listener object
670         * @since Servlet 3.0
671         */
672        <T extends EventListener> T createListener(Class<T> clazz) throws ServletException;
673    
674        /**
675         * declare the roles used in the web app as argumnents to isUserInRole
676         * @param roleNames the role names used in the web app
677         * @since Servlet 3.0
678         */
679        void declareRoles(String... roleNames);
680    
681        /**
682         * @return configuration of session cookie
683         * @since 3.0
684         */
685        SessionCookieConfig getSessionCookieConfig();
686    
687        /**
688         * @param sessionTrackingModes enumset of SessionTrackingModes for this web app
689         * @since 3.0
690         */
691        void setSessionTrackingModes(Set<SessionTrackingMode> sessionTrackingModes);
692    
693        /**
694         * @return the default session tracking modes
695         * @since 3.0
696         */
697        Set<SessionTrackingMode> getDefaultSessionTrackingModes();
698    
699        /**
700         *
701         * @return the major version of the servlet spec the web app thinks it is using.
702         * @throws UnsupportedOperationException if this ServletContext was constructed in a way where the spec version cannot be determined.
703         * @since 3.0
704         */
705        int getEffectiveMajorVersion() throws UnsupportedOperationException;
706    
707        /**
708         *
709         * @return the minor version of the servlet spec the web app thinks it is using.
710         * @throws UnsupportedOperationException if this ServletContext was constructed in a way where the spec version cannot be determined.
711         * @since 3.0
712         */
713        int getEffectiveMinorVersion() throws UnsupportedOperationException;
714    
715        /**
716         * @return the actual session tracking modes.  These will be the default ones unless they've been explicitly set.
717         * @since 3.0
718         */
719        Set<SessionTrackingMode> getEffectiveSessionTrackingModes();
720    
721        /**
722         *
723         * @return the classloader for this web app
724         * @since 3.0
725         */
726        ClassLoader getClassLoader();
727    
728        /**
729         * 
730         * @return jsp config aggregated from xml bits or null
731         * @since 3.0
732         */
733        JspConfigDescriptor getJspConfigDescriptor ();
734    
735    }
736    
737