Interface java.servlet.ServletContext
All Packages Class Hierarchy This Package Previous Next Index
Interface java.servlet.ServletContext
- public interface ServletContext
- extends Object
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.
-
getMimeType(String)
- Returns the mime type of the specified file.
-
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)
- Gets a servlet by name.
-
getServlets()
- Enumerates the servlets in this context (server).
-
log(Servlet, String)
- Writes a message to the servlet log for a servlet.
getServlet
public abstract Servlet getServlet(String name)
- Gets a servlet by name.
- Parameters:
- name - the name of the servlet
- Returns:
- null if the servlet does not exist
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(Servlet servlet,
String msg)
- Writes a message to the servlet log for a servlet.
- Parameters:
- servlet - the servlet to log information about
- msg - the message to log
getRealPath
public abstract String getRealPath(String path)
- Applies alias rules to the specified virtual path and returns the
corresponding real path. It returns null if the translation
cannot 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.
- 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.
All Packages Class Hierarchy This Package Previous Next Index