org.mortbay.jetty
Class Server

java.lang.Object
  |
  +--java.beans.beancontext.BeanContextChildSupport
        |
        +--java.beans.beancontext.BeanContextSupport
              |
              +--org.mortbay.http.HttpServer
                    |
                    +--org.mortbay.jetty.Server
All Implemented Interfaces:
java.beans.beancontext.BeanContext, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextServiceRevokedListener, java.beans.beancontext.BeanContextServicesListener, java.util.Collection, java.beans.DesignMode, java.util.EventListener, LifeCycle, java.beans.PropertyChangeListener, java.io.Serializable, java.beans.VetoableChangeListener, java.beans.Visibility

public class Server
extends HttpServer

The Jetty HttpServer. This specialization of org.mortbay.http.HttpServer adds knowledge about servlets and their specialized contexts. It also included support for initialization from xml configuration files that follow the XmlConfiguration dtd. HandlerContexts created by Server are of the type org.mortbay.jetty.servlet.ServletHandlerContext unless otherwise specified. This class also provides a main() method which starts a server for each config file passed on the command line. If the system property JETTY_NO_SHUTDOWN_HOOK is not set to true, then a shutdown hook is thread is registered to stop these servers.

Version:
$Revision: 1.5 $
Author:
Greg Wilkins (gregw)
See Also:
XmlConfiguration, ServletHandlerContext, Serialized Form

Fields inherited from class java.beans.beancontext.BeanContextChildSupport
beanContextChildPeer
 
Fields inherited from interface java.beans.beancontext.BeanContext
globalHierarchyLock
 
Fields inherited from interface java.beans.DesignMode
PROPERTYNAME
 
Constructor Summary
Server()
          Constructor.
Server(Resource configuration)
          Constructor.
Server(java.lang.String configuration)
          Constructor.
Server(java.net.URL configuration)
          Constructor.
 
Method Summary
 WebApplicationContext addWebApplication(java.lang.String contextPathSpec, java.lang.String webApp, java.lang.String defaults)
          Add Web Application.
 WebApplicationContext addWebApplication(java.lang.String contextPathSpec, java.lang.String webApp, java.lang.String defaults, boolean extractWar)
          Add Web Application.
 WebApplicationContext addWebApplication(java.lang.String host, java.lang.String contextPathSpec, java.lang.String webApp, java.lang.String defaults, boolean extractWar)
          Add Web Application.
 void configure(java.lang.String configuration)
          Configure the server from an XML file.
 java.lang.String getConfiguration()
           
static void main(java.lang.String[] arg)
          Construct server from command line arguments.
 
Methods inherited from class org.mortbay.http.HttpServer
addContext, addContext, addContext, addHostAlias, addListener, addListener, addListener, addRealm, destroy, findHandler, getConnections, getConnectionsDurationAve, getConnectionsDurationMax, getConnectionsOpen, getConnectionsOpenMax, getConnectionsRequestsAve, getConnectionsRequestsMax, getContext, getContext, getErrors, getHandlerContexts, getHandlers, getHostMap, getHttpEncoding, getHttpServerList, getListeners, getLogSink, getRealm, getRequestLogFormat, getRequestLogSink, getRequests, getRequestsActive, getRequestsActiveMax, getRequestsDurationAve, getRequestsDurationMax, getStatsOn, isChunkingForced, isDestroyed, isStarted, removeContext, removeContext, removeListener, removeRealm, service, setChunkingForced, setHttpEncoding, setLogSink, setRequestLogFormat, setRequestLogSink, setStatsOn, start, statsReset, stop
 
Methods inherited from class java.beans.beancontext.BeanContextSupport
add, addAll, addBeanContextMembershipListener, avoidingGui, clear, contains, containsAll, containsKey, dontUseGui, getBeanContextPeer, getLocale, getResource, getResourceAsStream, instantiateChild, isDesignTime, isEmpty, isSerializing, iterator, needsGui, okToUseGui, propertyChange, readChildren, remove, removeAll, removeBeanContextMembershipListener, retainAll, setDesignTime, setLocale, size, toArray, toArray, vetoableChange, writeChildren
 
Methods inherited from class java.beans.beancontext.BeanContextChildSupport
addPropertyChangeListener, addVetoableChangeListener, firePropertyChange, fireVetoableChange, getBeanContext, getBeanContextChildPeer, isDelegated, removePropertyChangeListener, removeVetoableChangeListener, serviceAvailable, serviceRevoked, setBeanContext, validatePendingSetBeanContext
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.beans.beancontext.BeanContextChild
addPropertyChangeListener, addVetoableChangeListener, getBeanContext, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

Server

public Server()
Constructor.

Server

public Server(java.lang.String configuration)
       throws java.io.IOException
Constructor.
Parameters:
configuration - The filename or URL of the XML configuration file.

Server

public Server(Resource configuration)
       throws java.io.IOException
Constructor.
Parameters:
configuration - The filename or URL of the XML configuration file.

Server

public Server(java.net.URL configuration)
       throws java.io.IOException
Constructor.
Parameters:
configuration - The filename or URL of the XML configuration file.
Method Detail

configure

public void configure(java.lang.String configuration)
               throws java.io.IOException
Configure the server from an XML file.
Parameters:
configuration - The filename or URL of the XML configuration file.

getConfiguration

public java.lang.String getConfiguration()

addWebApplication

public WebApplicationContext addWebApplication(java.lang.String contextPathSpec,
                                               java.lang.String webApp,
                                               java.lang.String defaults)
                                        throws java.io.IOException
Add Web Application.
Parameters:
contextPathSpec - The context path spec. Which must be of the form / or /path/*
webApp - The Web application directory or WAR file.
defaults - The defaults xml filename or URL which is loaded before any in the web app. Must respect the web.dtd. Normally this is passed the file $JETTY_HOME/etc/webdefault.xml
Returns:
The WebApplicationContext
Throws:
java.io.IOException -  

addWebApplication

public WebApplicationContext addWebApplication(java.lang.String contextPathSpec,
                                               java.lang.String webApp,
                                               java.lang.String defaults,
                                               boolean extractWar)
                                        throws java.io.IOException
Add Web Application.
Parameters:
contextPathSpec - The context path spec. Which must be of the form / or /path/*
webApp - The Web application directory or WAR file.
defaults - The defaults xml filename or URL which is loaded before any in the web app. Must respect the web.dtd. Normally this is passed the file $JETTY_HOME/etc/webdefault.xml
extractWar - If true, WAR files are extracted to a temporary directory.
Returns:
The WebApplicationContext
Throws:
java.io.IOException -  

addWebApplication

public WebApplicationContext addWebApplication(java.lang.String host,
                                               java.lang.String contextPathSpec,
                                               java.lang.String webApp,
                                               java.lang.String defaults,
                                               boolean extractWar)
                                        throws java.io.IOException
Add Web Application.
Parameters:
host - Virtual host name or null
contextPathSpec - The context path spec. Which must be of the form / or /path/*
webApp - The Web application directory or WAR file.
defaults - The defaults xml filename or URL which is loaded before any in the web app. Must respect the web.dtd. Normally this is passed the file $JETTY_HOME/etc/webdefault.xml
extractWar - If true, WAR files are extracted to a temporary directory.
Returns:
The WebApplicationContext
Throws:
java.io.IOException -  

main

public static void main(java.lang.String[] arg)
Description copied from class: HttpServer
Construct server from command line arguments.
Following copied from class: org.mortbay.http.HttpServer
Parameters:
args -  


Copyright © 2000 Mortbay Consulting Pty. Ltd. All Rights Reserved.