Methods Summary |
---|
public java.lang.Object | getAttribute(java.lang.String name)Return the specified context attribute, if any.
return (myAttributes.get(name));
|
public java.util.Enumeration | getAttributeNames()Return an enumeration of context attribute names.
return (myAttributes.keys());
|
public javax.servlet.ServletContext | getContext(java.lang.String uripath)Return the servlet context for the specified path.
return (null);
|
public java.lang.String | getContextPath()Return the context path.
return (null);
|
public java.lang.String | getInitParameter(java.lang.String name)Return the specified context initialization parameter.
return (null);
|
public java.util.Enumeration | getInitParameterNames()Return an enumeration of the names of context initialization
parameters.
return (new Vector().elements());
|
public int | getMajorVersion()Return the Servlet API major version number.
return (2);
|
public java.lang.String | getMimeType(java.lang.String file)Return the MIME type for the specified filename.
return (null);
|
public int | getMinorVersion()Return the Servlet API minor version number.
return (3);
|
public javax.servlet.RequestDispatcher | getNamedDispatcher(java.lang.String name)Return a request dispatcher for the specified servlet name.
return (null);
|
public java.lang.String | getRealPath(java.lang.String path)Return the real path for the specified context-relative
virtual path.
if (!myResourceBaseURL.getProtocol().equals("file"))
return (null);
if (!path.startsWith("/"))
return (null);
try {
return
(getResource(path).getFile().replace('/", File.separatorChar));
} catch (Throwable t) {
return (null);
}
|
public javax.servlet.RequestDispatcher | getRequestDispatcher(java.lang.String path)Return a request dispatcher for the specified context-relative path.
return (null);
|
public java.net.URL | getResource(java.lang.String path)Return a URL object of a resource that is mapped to the
specified context-relative path.
if (!path.startsWith("/"))
throw new MalformedURLException("Path '" + path +
"' does not start with '/'");
URL url = new URL(myResourceBaseURL, path.substring(1));
InputStream is = null;
try {
is = url.openStream();
} catch (Throwable t) {
url = null;
} finally {
if (is != null) {
try {
is.close();
} catch (Throwable t2) {
// Ignore
}
}
}
return url;
|
public java.io.InputStream | getResourceAsStream(java.lang.String path)Return an InputStream allowing access to the resource at the
specified context-relative path.
try {
return (getResource(path).openStream());
} catch (Throwable t) {
return (null);
}
|
public java.util.Set | getResourcePaths(java.lang.String path)Return the set of resource paths for the "directory" at the
specified context path.
Set thePaths = new HashSet();
if (!path.endsWith("/"))
path += "/";
String basePath = getRealPath(path);
if (basePath == null)
return (thePaths);
File theBaseDir = new File(basePath);
if (!theBaseDir.exists() || !theBaseDir.isDirectory())
return (thePaths);
String theFiles[] = theBaseDir.list();
for (int i = 0; i < theFiles.length; i++) {
File testFile = new File(basePath + File.separator + theFiles[i]);
if (testFile.isFile())
thePaths.add(path + theFiles[i]);
else if (testFile.isDirectory())
thePaths.add(path + theFiles[i] + "/");
}
return (thePaths);
|
public java.lang.String | getServerInfo()Return descriptive information about this server.
return ("JspCServletContext/1.0");
|
public javax.servlet.Servlet | getServlet(java.lang.String name)Return a null reference for the specified servlet name.
return (null);
|
public java.lang.String | getServletContextName()Return the name of this servlet context.
return (getServerInfo());
|
public java.util.Enumeration | getServletNames()Return an empty enumeration of servlet names.
return (new Vector().elements());
|
public java.util.Enumeration | getServlets()Return an empty enumeration of servlets.
return (new Vector().elements());
|
public void | log(java.lang.String message)Log the specified message.
myLogWriter.println(message);
|
public void | log(java.lang.Exception exception, java.lang.String message)Log the specified message and exception.
log(message, exception);
|
public void | log(java.lang.String message, java.lang.Throwable exception)Log the specified message and exception.
myLogWriter.println(message);
exception.printStackTrace(myLogWriter);
|
public void | removeAttribute(java.lang.String name)Remove the specified context attribute.
myAttributes.remove(name);
|
public void | setAttribute(java.lang.String name, java.lang.Object value)Set or replace the specified context attribute.
myAttributes.put(name, value);
|