public class JspCServletContext extends Object implements javax.servlet.ServletContext
ServletContext
implementation without
HTTP-specific methods.Modifier and Type | Field and Description |
---|---|
protected Hashtable |
myAttributes
Servlet context attributes.
|
protected PrintWriter |
myLogWriter
The log writer we will write log messages to.
|
Constructor and Description |
---|
JspCServletContext(PrintWriter aLogWriter,
ClassLoaderInterface classLoaderInterface)
Create a new instance of this ServletContext implementation.
|
Modifier and Type | Method and Description |
---|---|
Object |
getAttribute(String name) |
Enumeration |
getAttributeNames() |
javax.servlet.ServletContext |
getContext(String uripath) |
String |
getContextPath() |
String |
getInitParameter(String name) |
Enumeration |
getInitParameterNames() |
int |
getMajorVersion() |
String |
getMimeType(String file) |
int |
getMinorVersion() |
javax.servlet.RequestDispatcher |
getNamedDispatcher(String name) |
String |
getRealPath(String path) |
javax.servlet.RequestDispatcher |
getRequestDispatcher(String path) |
URL |
getResource(String path) |
InputStream |
getResourceAsStream(String path) |
Set |
getResourcePaths(String path) |
String |
getServerInfo() |
javax.servlet.Servlet |
getServlet(String name)
Deprecated.
This method has been deprecated with no replacement
|
String |
getServletContextName() |
Enumeration |
getServletNames()
Deprecated.
This method has been deprecated with no replacement
|
Enumeration |
getServlets()
Deprecated.
This method has been deprecated with no replacement
|
void |
log(Exception exception,
String message)
Deprecated.
Use log(String,Throwable) instead
|
void |
log(String message)
Log the specified message.
|
void |
log(String message,
Throwable exception)
Log the specified message and exception.
|
void |
removeAttribute(String name)
Remove the specified context attribute.
|
void |
setAttribute(String name,
Object value)
Set or replace the specified context attribute.
|
protected Hashtable myAttributes
protected PrintWriter myLogWriter
public JspCServletContext(PrintWriter aLogWriter, ClassLoaderInterface classLoaderInterface)
aLogWriter
- PrintWriter which is used for log()
callsclassLoaderInterface
- classloader interfacepublic Object getAttribute(String name)
getAttribute
in interface javax.servlet.ServletContext
name
- Name of the requested attributepublic Enumeration getAttributeNames()
getAttributeNames
in interface javax.servlet.ServletContext
public javax.servlet.ServletContext getContext(String uripath)
getContext
in interface javax.servlet.ServletContext
uripath
- Server-relative path starting with '/'public String getContextPath()
getContextPath
in interface javax.servlet.ServletContext
public String getInitParameter(String name)
getInitParameter
in interface javax.servlet.ServletContext
name
- Name of the requested parameterpublic Enumeration getInitParameterNames()
getInitParameterNames
in interface javax.servlet.ServletContext
public int getMajorVersion()
getMajorVersion
in interface javax.servlet.ServletContext
public String getMimeType(String file)
getMimeType
in interface javax.servlet.ServletContext
file
- Filename whose MIME type is requestedpublic int getMinorVersion()
getMinorVersion
in interface javax.servlet.ServletContext
public javax.servlet.RequestDispatcher getNamedDispatcher(String name)
getNamedDispatcher
in interface javax.servlet.ServletContext
name
- Name of the requested servletpublic String getRealPath(String path)
getRealPath
in interface javax.servlet.ServletContext
path
- The context-relative virtual path to resolvepublic javax.servlet.RequestDispatcher getRequestDispatcher(String path)
getRequestDispatcher
in interface javax.servlet.ServletContext
path
- Context-relative path for which to acquire a dispatcherpublic URL getResource(String path) throws MalformedURLException
getResource
in interface javax.servlet.ServletContext
path
- Context-relative path of the desired resourceMalformedURLException
- if the resource path is
not properly formedpublic InputStream getResourceAsStream(String path)
getResourceAsStream
in interface javax.servlet.ServletContext
path
- Context-relative path of the desired resourcepublic Set getResourcePaths(String path)
getResourcePaths
in interface javax.servlet.ServletContext
path
- Context-relative base pathpublic String getServerInfo()
getServerInfo
in interface javax.servlet.ServletContext
public javax.servlet.Servlet getServlet(String name) throws javax.servlet.ServletException
getServlet
in interface javax.servlet.ServletContext
name
- Name of the requested servletjavax.servlet.ServletException
public String getServletContextName()
getServletContextName
in interface javax.servlet.ServletContext
public Enumeration getServletNames()
getServletNames
in interface javax.servlet.ServletContext
public Enumeration getServlets()
getServlets
in interface javax.servlet.ServletContext
public void log(String message)
log
in interface javax.servlet.ServletContext
message
- The message to be loggedpublic void log(Exception exception, String message)
log
in interface javax.servlet.ServletContext
exception
- The exception to be loggedmessage
- The message to be loggedpublic void log(String message, Throwable exception)
log
in interface javax.servlet.ServletContext
message
- The message to be loggedexception
- The exception to be loggedpublic void removeAttribute(String name)
removeAttribute
in interface javax.servlet.ServletContext
name
- Name of the attribute to removeCopyright © 2000–2023 Apache Software Foundation. All rights reserved.