All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sun.servlet.http.HttpServer

java.lang.Object
   |
   +----sun.servlet.http.HttpServer

public class HttpServer
extends Object
implements Runnable, ServletContext
This class implements a simple HTTP server for testing servlets.


Variable Index

 o avail
The number of available handlers.
 o backlog
The backlog parameter to use when creating the server socket.
 o connections
The queue of pending connections.
 o documentDir
The document root directory for serving files.
 o handlers
The thread group for connection handlers.
 o host
The host name of the server.
 o loader
The servlet loader.
 o maxHandlers
The maximum number of handler threads.
 o name
The name of the server.
 o port
The server port number.
 o servletDir
The directory where servlets are stored.
 o servletPropFile
The filename which contains servlet properties
 o servletProps
The properties list that decribes servlet aliases and init args
 o timeout
The handler timeout in milliseconds.
 o total
The total number of active handlers.
 o verbose
Set to true for verbose output.

Constructor Index

 o HttpServer()
Creates a new HTTP server with default parameters.
 o HttpServer(Properties)
Creates a new HTTP server with parameters from the specified properties.

Method Index

 o getAttribute(String)
Returns an attribute of the server for the specified key name.
 o getConnection()
Called by a connection handler to retrieve the next connection from the queue.
 o getHostName()
Returns the host name of the server.
 o getIntProperty(Properties, String, int)
Returns the integer value of a property.
 o getMimeType(String)
Returns the mime type of the specified file.
 o getRealPath(String)
Returns the translated path for the specified virtual path.
 o getServerInfo()
Returns the name and version of the current server.
 o getServlet(String)
Gets a servlet by name.
 o getServlets()
Enumerates the servlets in this server.
 o help()
 o loadProperties(Properties)
Loads parameters from the specified properties.
 o log(String)
Writes a message to the servlet log.
 o main(String[])
Runs the HTTP server.
 o printSettings()
 o putConnection(Object)
Places the specified connection object on the queue of pending connections.
 o run()
Runs the servlet server.

Variables

 o connections
 protected Queue connections
The queue of pending connections.

 o handlers
 protected ThreadGroup handlers
The thread group for connection handlers.

 o maxHandlers
 protected int maxHandlers
The maximum number of handler threads.

 o timeout
 protected int timeout
The handler timeout in milliseconds.

 o port
 protected int port
The server port number.

 o backlog
 protected int backlog
The backlog parameter to use when creating the server socket.

 o avail
 protected int avail
The number of available handlers.

 o total
 protected int total
The total number of active handlers.

 o name
 protected String name
The name of the server.

 o host
 protected String host
The host name of the server.

 o servletDir
 protected String servletDir
The directory where servlets are stored.

 o servletProps
 protected Properties servletProps
The properties list that decribes servlet aliases and init args

 o servletPropFile
 protected String servletPropFile
The filename which contains servlet properties

 o documentDir
 protected String documentDir
The document root directory for serving files.

 o loader
 protected ServletLoader loader
The servlet loader.

 o verbose
 protected boolean verbose
Set to true for verbose output.

Constructors

 o HttpServer
 public HttpServer()
Creates a new HTTP server with default parameters.

 o HttpServer
 public HttpServer(Properties props)
Creates a new HTTP server with parameters from the specified properties.

Parameters:
props - the server properties

Methods

 o loadProperties
 public void loadProperties(Properties props)
Loads parameters from the specified properties.

Parameters:
props - the server properties
 o getIntProperty
 protected static int getIntProperty(Properties prop,
                                     String name,
                                     int def)
Returns the integer value of a property.

 o getHostName
 protected static String getHostName()
Returns the host name of the server.

 o run
 public void run()
Runs the servlet server.

 o putConnection
 protected void putConnection(Object s)
Places the specified connection object on the queue of pending connections.

 o getConnection
 public Object getConnection()
Called by a connection handler to retrieve the next connection from the queue. If this method returns null then the handler should exit as the thread has expired.

 o getServlet
 public Servlet getServlet(String name)
Gets a servlet by name.

 o getServlets
 public Enumeration getServlets()
Enumerates the servlets in this server.

 o log
 public void log(String msg)
Writes a message to the servlet log.

 o getMimeType
 public String getMimeType(String name)
Returns the mime type of the specified file.

 o getRealPath
 public String getRealPath(String path)
Returns the translated path for the specified virtual path.

 o getServerInfo
 public String getServerInfo()
Returns the name and version of the current server.

 o getAttribute
 public Object getAttribute(String name)
Returns an attribute of the server for the specified key name.

Parameters:
name - the attribute name
Returns:
the value of the attribute or null if not found
 o main
 public static void main(String args[])
Runs the HTTP server.

 o printSettings
 protected void printSettings()
 o help
 protected static void help()

All Packages  Class Hierarchy  This Package  Previous  Next  Index