All Packages Class Hierarchy This Package Previous Next Index
Interface java.servlet.ServletContext
- public interface ServletContext
An interface for defining a servlet's environment. It is used by
a servlet to obtain information about the environment (i.e. Web
server) in which it is running.
-
getAttribute(String)
- Returns an attribute of the server given the specified key name.
-
getMimeType(String)
- Returns the mime type of the specified file, or null if not known.
-
getRealPath(String)
- Applies alias rules to the specified virtual path and returns the
corresponding real path.
-
getServerInfo()
- Returns the name and version of the Web server under which the
servlet is running.
-
getServlet(String)
- Returns the servlet for the specified name.
-
getServlets()
- Enumerates the servlets in this context (server).
-
log(String)
- Writes a message to the servlet log file.
getServlet
public abstract Servlet getServlet(String name) throws ServletException
- Returns the servlet for the specified name.
- Parameters:
- name - the name of the servlet
- Returns:
- the Servlet, or null if not found
- Throws: ServletException
- if the servlet could not be initialized
getServlets
public abstract Enumeration getServlets()
- Enumerates the servlets in this context (server). Only servlets
that are accessible will be returned. The enumeration always
includes the servlet itself.
log
public abstract void log(String msg)
- Writes a message to the servlet log file.
- Parameters:
- msg - the message to be written
getRealPath
public abstract String getRealPath(String path)
- Applies alias rules to the specified virtual path and returns the
corresponding real path. Returns null if the translation could not
be performed.
- Parameters:
- path - the real path to be translated
getMimeType
public abstract String getMimeType(String file)
- Returns the mime type of the specified file, or null if not known.
- Parameters:
- file - file name whose mime type is required
getServerInfo
public abstract String getServerInfo()
- Returns the name and version of the Web server under which the
servlet is running. Same as the CGI variable SERVER_SOFTWARE.
getAttribute
public abstract Object getAttribute(String name)
- Returns an attribute of the server given the specified key name.
This allows access to additional information about the server not
already provided by the other methods in this interface. Attribute
names should follow the same convention as package names, and those
beginning with 'com.sun.*' are reserved for use by Sun Microsystems.
- Parameters:
- name - the attribute key name
- Returns:
- the value of the attribute, or null if not defined
All Packages Class Hierarchy This Package Previous Next Index