|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.mortbay.HTTP.Configure.BaseConfiguration
|
+--com.mortbay.Jetty.Server
A configuration file based Jetty HttpServer. This HttpConfiguration class uses PropertyTree based files to configure and run 1 or more Jetty HttpServer instances. The loadConfigurationFile and buildServers static methods construct 1 or more instances of Server that can be started with the startAll method.
PropertyTree,
HttpServer,
PathMap| Fields inherited from class com.mortbay.HTTP.Configure.BaseConfiguration |
addresses,
attributes,
exceptionHandlersMap,
httpHandlersMap,
listenerClasses,
mimeMap,
properties |
| Constructor Summary | |
Server(java.lang.String serverName,
PropertyTree listeners,
java.util.Properties properties)
Constructor. |
|
| Method Summary | |
void |
addExceptionStack(java.lang.String stackName,
PropertyTree stackTree)
Add an exception handler stack to the server. |
void |
addHandlerStack(java.lang.String stackName,
PropertyTree stackTree)
Add a handler stack to the server. |
static void |
buildServer(java.lang.String serverName,
PropertyTree serverTree)
Build and configure a Server from a PropertyTree. |
static void |
buildServers(PropertyTree serversTree)
Configure 1 or more Server instances. |
static java.lang.String |
getGlobalProperty(java.lang.String name)
Get a JVM wide server property. |
java.lang.String |
getServerName()
The server name |
void |
join()
join |
static void |
loadConfigurationFile(java.lang.String filename)
Load server configuration file. |
static void |
main(java.lang.String[] args)
main |
static java.util.Enumeration |
servers()
Get all configured servers. |
static void |
shutdown()
Deprecated. Use stopAll. |
void |
start()
Start serving. |
static void |
startAll()
Start all configured servers. |
void |
stop()
Stop serving. |
static void |
stopAll()
Stop all configured servers. |
| Methods inherited from class com.mortbay.HTTP.Configure.BaseConfiguration |
addresses,
exceptionHandlersMap,
getAttribute,
getMimeByExtension,
getMimeType,
getProperties,
getProperty,
httpHandlersMap,
listenerClasses,
log,
toString |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Constructor Detail |
public Server(java.lang.String serverName,
PropertyTree listeners,
java.util.Properties properties)
throws java.lang.Exception
name1.CLASS : com.mortbay.HTTP.HttpListener name1.ADDRS : ipaddress:port;ipaddress:port;... name2.CLASS : com.mortbay.HTTP.HttpListener name2.ADDRS : ipaddress:port;ipaddress:port;...Currently the following properties are defined for the server property instance:
SessionMaxInactiveInterval : Max idle time MS before session death
MinListenerThreads : Min listener threads per listener
MaxListenerThreads : Max listener threads per listener
MaxListenerThreadIdleMs : Max idle time Ms before listen thread
death
MimeMap : Property file of MIME mappings
Note that if this method is called from buildServer, then all
properties in the original file will be prefixed with
"servername.stackname.".serverName - The servers namelisteners - Listener PropertyTreeproperties - Server properties| Method Detail |
public static java.lang.String getGlobalProperty(java.lang.String name)
public static void loadConfigurationFile(java.lang.String filename)
throws java.lang.Exception
filename - The configuration file (see buildServers for
format).
public static void buildServers(PropertyTree serversTree)
throws java.lang.Exception
SETUID : User ID to run server as if started as
root under unix. Uses native method to
call setuid.
SERVERS : servername1;servername2
PROPERTY.GlobalProperty : GlobalValue
PROPERTIES : FileOfGlobalProperties.prp
servername1.* : *
servername2.* : *
For each server listed in SERVERS, the buildServer
method is called with the PropertyTree built from
all properties starting with "servername.".
The "DefaultPageType" parameter can be set in the
Global paramters to define the default Page class for
all servers.serversTree - The server properties
public static void buildServer(java.lang.String serverName,
PropertyTree serverTree)
throws java.lang.Exception
CLASS : com.mortbay.HTTP.HttpServer STACKS : stackname1;stackname2;... EXCEPTIONS : exstackname1;exstackname2;... PROPERTY.ServerProperty : ServerValue PROPERTIES : FileOfServerProperties. LISTENER.name.CLASS : com.mortbay.HTTP.HttpListener LISTENER.name.ADDRS : 0.0.0.0:8080 stackname1.* : * stackname2.* : * exstackname1.* : * exstackname2.* : *The server is constructed by passing it the server properties and the listener PropertyTree. Then for each listed handler stack, the addHandlerStack method is called called with the PropertyTree built from all properties starting with "stackname." Note that if this method is called from buildServers, then all properties in the original file will be prefixed with "servername.".
serverName - The name of the server.serverTree - configuration property tree.public static java.util.Enumeration servers()
public static void startAll()
throws java.lang.Exception
public static void stopAll()
public static void shutdown()
public java.lang.String getServerName()
public void addHandlerStack(java.lang.String stackName,
PropertyTree stackTree)
throws java.lang.Exception
PATHS : pathSpec;pathSpec;... HANDLERS : handlername1;handlername2;... handlername1.CLASS : package.handler1class handlername1.PROPERTY.* : * handlername1.PROPERTIES : handler1PropertyFile.prp handlername2.* : * ...The stack of handlers is constructed in the order specified by the HANDLERS parameter and registered at each of the PathMap path specifications listed in PATHS. Each handler is constructed with a constructor taking a properties instance which is initialized from the PROPERTY and/or PROPERTIES paramaters. Note that if this method is called from buildServer, then all properties in the original file will be prefixed with "servername.stackname.".
stackName - The name of the handler stackstackTree - PopertyTree describing the stack
public void addExceptionStack(java.lang.String stackName,
PropertyTree stackTree)
throws java.lang.Exception
PATHS : pathSpec;pathSpec;...
HANDLERS : handlername1;handlername2;...
handlername1.CLASS : package.handler1class
handlername1.PROPERTY.* : *
* ...
The stack of handlers is constructed in the order specified
by the HANDLERS parameter and registered at each of the
PathMap path specifications listed in PATHS.
Note that if this method is called from buildServer, then all
properties in the original file will be prefixed with
"servername.stackname.".stackName - The name of the exception handler stackstackTree - PopertyTree describing the stack
public void start()
throws java.lang.Exception
public void stop()
public void join()
throws java.lang.InterruptedException
public static void main(java.lang.String[] args)
args - optional property file name
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||