Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.apache.catalina.core.ApplicationContext
public class ApplicationContext
extends java.lang.Object
implements ServletContext
ServletContext
that represents
a web application's execution environment. An instance of this class is
associated with each instance of StandardContext
.
Constructor Summary | |
|
Method Summary | |
Object |
|
Enumeration |
|
ServletContext |
|
protected ServletContext |
|
String |
|
Enumeration |
|
int |
|
String |
|
int |
|
RequestDispatcher |
|
String |
|
RequestDispatcher |
|
URL |
|
InputStream |
|
Set |
|
DirContext |
|
String |
|
Servlet |
|
String |
|
Enumeration |
|
Enumeration |
|
void |
|
void |
|
void |
|
void |
|
void |
|
public ApplicationContext(String basePath, StandardContext context)
Construct a new instance of this class, associated with the specified Context instance.
- Parameters:
context
- The associated Context instance
public Object getAttribute(String name)
Return the value of the specified context attribute, if any; otherwise returnnull
.
- Parameters:
name
- Name of the context attribute to return
public Enumeration getAttributeNames()
Return an enumeration of the names of the context attributes associated with this context.
public ServletContext getContext(String uri)
Return aServletContext
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 obtainRequestDispatcher
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
protected ServletContext getFacade()
Return the facade associated with this ApplicationContext.
public String getInitParameter(String name)
Return the value of the specified initialization parameter, ornull
if this parameter does not exist.
- Parameters:
name
- Name of the initialization parameter to retrieve
public Enumeration getInitParameterNames()
Return the names of the context's initialization parameters, or an empty enumeration if the context has no initialization parameters.
public int getMajorVersion()
Return the major version of the Java Servlet API that we implement.
public String getMimeType(String file)
Return the MIME type of the specified file, ornull
if the MIME type cannot be determined.
- Parameters:
file
- Filename for which to identify a MIME type
public int getMinorVersion()
Return the minor version of the Java Servlet API that we implement.
public RequestDispatcher getNamedDispatcher(String name)
Return aRequestDispatcher
object that acts as a wrapper for the named servlet.
- Parameters:
name
- Name of the servlet for which a dispatcher is requested
public String getRealPath(String path)
Return the real path for a given virtual path, if possible; otherwise returnnull
.
- Parameters:
path
- The path to the desired resource
public RequestDispatcher getRequestDispatcher(String path)
Return aRequestDispatcher
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.
public URL getResource(String path) throws MalformedURLException
Return the URL to the resource that is mapped to a specified 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
public InputStream getResourceAsStream(String path)
Return the requested resource as anInputStream
. The path must be specified according to the rules described undergetResource
. If no such resource can be identified, returnnull
.
- Parameters:
path
- The path to the desired resource.
public Set getResourcePaths(String path)
Return a Set containing the resource paths of resources member of the specified collection. Each path will be a String starting with a "/" character. The returned set is immutable.
- Parameters:
path
- Collection path
public DirContext getResources()
Return the resources object that is mapped to a specified path. The path must begin with a "/" and is interpreted as relative to the current context root.
public String getServerInfo()
Return the name and version of the servlet container.
public Servlet getServlet(String name)
Deprecated. As of Java Servlet API 2.1, with no direct replacement.
public String getServletContextName()
Return the display name of this web application.
public Enumeration getServletNames()
Deprecated. As of Java Servlet API 2.1, with no direct replacement.
public Enumeration getServlets()
Deprecated. As of Java Servlet API 2.1, with no direct replacement.
public void log(Exception exception, String message)
Deprecated. As of Java Servlet API 2.1, use
log(String, Throwable)
insteadWrites the specified exception and message to a servlet log file.
- Parameters:
exception
- Exception to be reportedmessage
- Message to be written
public void log(String message)
Writes the specified message to a servlet log file.
- Parameters:
message
- Message to be written
public void log(String message, Throwable throwable)
Writes the specified message and exception to a servlet log file.
- Parameters:
message
- Message to be writtenthrowable
- Exception to be reported
public void removeAttribute(String name)
Remove the context attribute with the specified name, if any.
- Parameters:
name
- Name of the context attribute to be removed
public void setAttribute(String name, Object value)
Bind the specified value with the specified context attribute name, replacing any existing value for that name.
- Parameters:
name
- Attribute name to be boundvalue
- New attribute value to be bound