Example usage for Java javax.servlet ServletContext fields, constructors, methods, implement or subclass
The text is from its open source code.
String | TEMPDIR The name of the ServletContext attribute which stores the private temporary directory (of type java.io.File) provided by the servlet container for the ServletContext |
FilterRegistration.Dynamic | addFilter(String filterName, String className) Adds the filter with the given name and class name to this servlet context. |
FilterRegistration.Dynamic | addFilter(String filterName, Filter filter) Registers the given filter instance with this ServletContext under the given filterName. |
FilterRegistration.Dynamic | addFilter(String filterName, Class extends Filter> filterClass) Adds the filter with the given name and class type to this servlet context. |
void | addListener(String className) Adds the listener with the given class name to this ServletContext. |
void | addListener(T t) Adds the given listener to this ServletContext. |
void | addListener(Class extends EventListener> listenerClass) Adds a listener of the given class type to this ServletContext. |
ServletRegistration.Dynamic | addServlet(String servletName, String className) Adds the servlet with the given name and class name to this servlet context. |
ServletRegistration.Dynamic | addServlet(String servletName, Servlet servlet) Registers the given servlet instance with this ServletContext under the given servletName. |
ServletRegistration.Dynamic | addServlet(String servletName, Class extends Servlet> servletClass) Adds the servlet with the given name and class type to this servlet context. |
T | createFilter(Class Instantiates the given Filter class. |
T | createListener(Class Instantiates the given EventListener class. |
T | createServlet(Class Instantiates the given Servlet class. |
boolean | equals(Object obj) Indicates whether some other object is "equal to" this one. |
Object | getAttribute(String name) Returns the servlet container attribute with the given name, or null if there is no attribute by that name. |
Enumeration | getAttributeNames() Returns an Enumeration containing the attribute names available within this ServletContext. |
Class> | getClass() Returns the runtime class of this Object . |
ClassLoader | getClassLoader() Gets the class loader of the web application represented by this ServletContext. |
ServletContext | getContext(String uripath) Returns a ServletContext object that corresponds to a specified URL on the server. |
String | getContextPath() Returns the context path of the web application. |
int | getEffectiveMajorVersion() Gets the major version of the Servlet specification that the application represented by this ServletContext is based on. |
int | getEffectiveMinorVersion() Gets the minor version of the Servlet specification that the application represented by this ServletContext is based on. |
FilterRegistration | getFilterRegistration(String filterName) Gets the FilterRegistration corresponding to the filter with the given filterName. |
String | getInitParameter(String name) Returns a String containing the value of the named context-wide initialization parameter, or null if the parameter does not exist. |
Enumeration | getInitParameterNames() Returns the names of the context's initialization parameters as an Enumeration of String objects, or an empty Enumeration if the context has no initialization parameters. |
int | getMajorVersion() Returns the major version of the Servlet API that this servlet container supports. |
String | getMimeType(String file) Returns the MIME type of the specified file, or null if the MIME type is not known. |
int | getMinorVersion() Returns the minor version of the Servlet API that this servlet container supports. |
RequestDispatcher | getNamedDispatcher(String name) Returns a RequestDispatcher object that acts as a wrapper for the named servlet. |
String | getRealPath(String path) Gets the real path corresponding to the given virtual path. |
RequestDispatcher | getRequestDispatcher(String path) Returns a RequestDispatcher object that acts as a wrapper for the resource located at the given path. |
URL | getResource(String path) Returns a URL to the resource that is mapped to the given path. |
InputStream | getResourceAsStream(String path) Returns the resource located at the named path as an InputStream object. |
Set | getResourcePaths(String path) Returns a directory-like listing of all the paths to resources within the web application whose longest sub-path matches the supplied path argument. |
String | getServerInfo() Returns the name and version of the servlet container on which the servlet is running. |
Servlet | getServlet(String name) |
String | getServletContextName() 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. |
ServletRegistration | getServletRegistration(String servletName) Gets the ServletRegistration corresponding to the servlet with the given servletName. |
Map | getServletRegistrations() Gets a (possibly empty) Map of the ServletRegistration objects (keyed by servlet name) corresponding to all servlets registered with this ServletContext. |
SessionCookieConfig | getSessionCookieConfig() Gets the SessionCookieConfig object through which various properties of the session tracking cookies created on behalf of this ServletContext may be configured. |
int | hashCode() Returns a hash code value for the object. |
void | log(String msg) Writes the specified message to a servlet log file, usually an event log. |
void | log(Exception exception, String msg) |
void | log(String message, Throwable throwable) Writes an explanatory message and a stack trace for a given Throwable exception to the servlet log file. |
void | removeAttribute(String name) Removes the attribute with the given name from this ServletContext. |
void | setAttribute(String name, Object object) Binds an object to a given attribute name in this ServletContext. |
boolean | setInitParameter(String name, String value) Sets the context initialization parameter with the given name and value on this ServletContext. |
void | setSessionTrackingModes(Set Sets the session tracking modes that are to become effective for this ServletContext. |
String | toString() Returns a string representation of the object. |