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.

Method Index

 o getMimeType(String)
Returns the mime type of the specified file.
 o getRealPath(String)
Applies alias rules to the specified virtual path and returns the corresponding real path.
 o getServerInfo()
Returns the name and version of the Web server under which the servlet is running.
 o getServlet(String)
Gets a servlet by name.
 o getServlets()
Enumerates the servlets in this context (server).
 o log(Servlet, String)
Writes a message to the servlet log for a servlet.

Methods

 o 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
 o 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.
 o 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
 o 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
 o getMimeType
  public abstract String getMimeType(String file)
Returns the mime type of the specified file.
Parameters:
file - file name whose mime type is required
 o 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