All Packages Class Hierarchy This Package Previous Next Index
Class calypso.core.httpserver.HttpServer
java.lang.Object
|
+----java.lang.Thread
|
+----calypso.core.httpserver.HttpServer
- public class HttpServer
- extends Thread
- implements HttpServerConstants
HttpServer class used for accepting new connections to the server.
The connections are accepted in a single thread of HttpServer
and all the requests are handled in waiting HttpConnectionHandlers.
All the connection handlers are created once the HTTP server is first
started. Requests are stored in pendingConns Queue.
- Version:
- 1.0
- Author:
- Olli-Pekka Auvinen / TCM laboratory / HUT
- See Also:
- HttpConnectionHandler, HttpServerConstants
-
handlerPool
- The synchronization object representing the 'handler pool'.
-
pendingConns
- The queue of waiting connections.
-
HttpServer(ThreadGroup)
- The constructor for HttpServer.
-
checkProperties()
- Static check method for server properties.
-
getIntProperty(String)
- Static access method for integer type of property.
-
getProperty(String)
- Static access method for properties.
-
getServletLoader()
- Access method for Servlet Loader.
-
init()
- The method for initializing the HttpServer.
-
init(String)
- The method for initializing the HttpServer.
-
main(String[])
-
-
run()
- The run method for the server accepting new connections.
-
windDown()
- Method for finalizing the HTTP server.
handlerPool
protected static final Object handlerPool
- The synchronization object representing the 'handler pool'.
All the handler thread are synchronized in respect to handler
pool.
pendingConns
protected Queue pendingConns
- The queue of waiting connections. Once a new connection is accepted
the Socket is stored in pendingConns Queue.
HttpServer
public HttpServer(ThreadGroup serverThreads_) throws HttpServerException
- The constructor for HttpServer. The handlers are created and started
in the constructor body. Initially all the handlers start to wait
for requests in 'handler pool'.
- Parameters:
- serverPort_ - The port number of accepting connections.
- documentRoot_ - Root directory for retrievable documents.
- Throws: HttpServerException
- Whenever the constructor fails.
run
public void run()
- The run method for the server accepting new connections.
Requests are accepted and inserted into pendingConns here, then
the 'handler pool' is notified for a handler to start serving
the gotten request.
- Overrides:
- run in class Thread
getServletLoader
protected ServletLoader getServletLoader()
- Access method for Servlet Loader.
- Returns:
- The Servlet Loader of the HTTP Server.
windDown
public void windDown()
- Method for finalizing the HTTP server.
In cleanup procedures the unloading of all the loaded Servlets
will be made by calling the ServletLoader's unloading method.
init
public static HttpServer init()
- The method for initializing the HttpServer. The method is
responsible for loading the HTTP server properties. If no
arguments are given the server loads the default properties
file. Additionally a new HttpServer is created and its running is
started in a thread.
init
public static HttpServer init(String propFile_)
- The method for initializing the HttpServer. The method is
responsible for loading the HTTP server properties. The
customised properties file is given as an argument. Additionally
a new HttpServer is created and its running is started in a
thread.
- Parameters:
- propFile_ - Properties file for HttpServer.
getIntProperty
protected static int getIntProperty(String propName_)
- Static access method for integer type of property.
- Parameters:
- propName_ - The name of the desired property.
- Returns:
- The integer value of the desired property, -1 if
something went wrong.
getProperty
protected static String getProperty(String propName_)
- Static access method for properties.
- Parameters:
- propName_ - The name of the desired property.
- Returns:
- The String value of the desired property, null if
something went wrong.
checkProperties
protected static void checkProperties() throws HttpServerException
- Static check method for server properties.
- Throws: HttpServerException
- if server
properties are invalid.
main
public static void main(String argv[])
All Packages Class Hierarchy This Package Previous Next Index