org.apache.catalina.core
public class ApplicationContext extends Object implements ServletContext
ServletContext
that represents
a web application's execution environment. An instance of this class is
associated with each instance of StandardContext
.
Version: $Revision: 739532 $ $Date: 2009-01-31 10:52:13 +0100 (Sat, 31 Jan 2009) $
Field Summary | |
---|---|
protected Map | attributes
The context attributes for this context. |
Constructor Summary | |
---|---|
ApplicationContext(String basePath, StandardContext context)
Construct a new instance of this class, associated with the specified
Context instance.
|
Method Summary | |
---|---|
protected void | clearAttributes()
Clear all application-created attributes. |
Object | getAttribute(String name)
Return the value of the specified context attribute, if any;
otherwise return null .
|
Enumeration | getAttributeNames()
Return an enumeration of the names of the context attributes
associated with this context. |
ServletContext | getContext(String uri)
Return a ServletContext object that corresponds to a
specified URI on the server. |
protected StandardContext | getContext() |
String | getContextPath()
Return the main path associated with this context. |
protected ServletContext | getFacade()
Return the facade associated with this ApplicationContext. |
String | getInitParameter(String name)
Return the value of the specified initialization parameter, or
null if this parameter does not exist.
|
Enumeration | getInitParameterNames()
Return the names of the context's initialization parameters, or an
empty enumeration if the context has no initialization parameters. |
int | getMajorVersion()
Return the major version of the Java Servlet API that we implement. |
String | getMimeType(String file)
Return the MIME type of the specified file, or null if
the MIME type cannot be determined.
|
int | getMinorVersion()
Return the minor version of the Java Servlet API that we implement. |
RequestDispatcher | getNamedDispatcher(String name)
Return a RequestDispatcher object that acts as a
wrapper for the named servlet.
|
protected Map | getReadonlyAttributes() |
String | getRealPath(String path)
Return the real path for a given virtual path, if possible; otherwise
return null .
|
RequestDispatcher | getRequestDispatcher(String path)
Return a RequestDispatcher instance that acts as a
wrapper for the resource at the given path. |
URL | getResource(String path)
Return the URL to the resource that is mapped to a specified path.
|
InputStream | getResourceAsStream(String path)
Return the requested resource as an InputStream . |
Set | getResourcePaths(String path)
Return a Set containing the resource paths of resources member of the
specified collection. |
DirContext | getResources()
Return the resources object that is mapped to a specified path.
|
String | getServerInfo()
Return the name and version of the servlet container. |
Servlet | getServlet(String name) |
String | getServletContextName()
Return the display name of this web application. |
Enumeration | getServletNames() |
Enumeration | getServlets() |
void | log(String message)
Writes the specified message to a servlet log file.
|
void | log(Exception exception, String message)
Writes the specified exception and message to a servlet log file.
|
void | log(String message, Throwable throwable)
Writes the specified message and exception to a servlet log file.
|
void | removeAttribute(String name)
Remove the context attribute with the specified name, if any.
|
void | setAttribute(String name, Object value)
Bind the specified value with the specified context attribute name,
replacing any existing value for that name.
|
Parameters: context The associated Context instance
null
.
Parameters: name Name of the context attribute to return
ServletContext
object that corresponds to a
specified URI on the server. This method allows servlets to gain
access to the context for various parts of the server, and as needed
obtain RequestDispatcher
objects or resources from the
context. The given path must be absolute (beginning with a "/"),
and is interpreted based on our virtual host's document root.
Parameters: uri Absolute URI of a resource on the server
null
if this parameter does not exist.
Parameters: name Name of the initialization parameter to retrieve
null
if
the MIME type cannot be determined.
Parameters: file Filename for which to identify a MIME type
RequestDispatcher
object that acts as a
wrapper for the named servlet.
Parameters: name Name of the servlet for which a dispatcher is requested
null
.
Parameters: path The path to the desired resource
RequestDispatcher
instance that acts as a
wrapper for the resource at the given path. The path must begin
with a "/" and is interpreted as relative to the current context root.
Parameters: path The path to the desired resource.
Parameters: path The path to the desired resource
Throws: MalformedURLException if the path is not given in the correct form
InputStream
. The
path must be specified according to the rules described under
getResource
. If no such resource can be identified,
return null
.
Parameters: path The path to the desired resource.
Parameters: path Collection path
Deprecated: As of Java Servlet API 2.1, with no direct replacement.
Deprecated: As of Java Servlet API 2.1, with no direct replacement.
Deprecated: As of Java Servlet API 2.1, with no direct replacement.
Parameters: message Message to be written
Deprecated: As of Java Servlet API 2.1, use
log(String, Throwable)
instead
Parameters: exception Exception to be reported message Message to be written
Parameters: message Message to be written throwable Exception to be reported
Parameters: name Name of the context attribute to be removed
Parameters: name Attribute name to be bound value New attribute value to be bound