org.mortbay.jetty.plus
Class Server

java.lang.Object
  extended by org.mortbay.util.Container
      extended by org.mortbay.http.HttpServer
          extended by org.mortbay.jetty.Server
              extended by org.mortbay.jetty.plus.Server
All Implemented Interfaces:
java.io.Serializable, EventProvider, LifeCycle

public class Server
extends Server

The Jetty HttpServer. This specialization of org.mortbay.jetty.Server adds knowledge about JNDI and Transaction Management

Author:
Miro Halas
See Also:
Serialized Form

Constructor Summary
Server()
          Constructor.
Server(Resource configuration)
          Constructor.
Server(java.lang.String configuration)
          Constructor.
Server(java.net.URL configuration)
          Constructor.
 
Method Summary
 void addService(Service service)
          Add a Service to a Server.
protected  void doStart()
          Start all handlers then listeners.
protected  void doStop()
          Stop all listeners then all contexts.
static void main(java.lang.String[] arg)
           
protected  WebApplicationContext newWebApplicationContext(java.lang.String webApp)
          Create a new WebApplicationContext.
 
Methods inherited from class org.mortbay.jetty.Server
addWebApplication, addWebApplication, addWebApplications, addWebApplications, addWebApplications, addWebApplications, addWebApplications, configure, getConfiguration, getRootWebApp, getStopAtShutdown, getWebApplicationConfigurationClassNames, newHttpContext, setRootWebApp, setStopAtShutdown, setWebApplicationConfigurationClassNames
 
Methods inherited from class org.mortbay.http.HttpServer
addContext, addContext, addContext, addContext, addHostAlias, addListener, addListener, addListener, addRealm, destroy, findHandler, getConnections, getConnectionsDurationAve, getConnectionsDurationMax, getConnectionsDurationMin, getConnectionsDurationTotal, getConnectionsOpen, getConnectionsOpenMax, getConnectionsOpenMin, getConnectionsRequestsAve, getConnectionsRequestsMax, getConnectionsRequestsMin, getContext, getContext, getContext, getContexts, getErrors, getHostMap, getHttpServerList, getHttpServers, getListeners, getRealm, getRequestLog, getRequests, getRequestsActive, getRequestsActiveMax, getRequestsActiveMin, getRequestsDurationAve, getRequestsDurationMax, getRequestsDurationMin, getRequestsDurationTotal, getRequestsPerGC, getResolveRemoteHost, getServerClasses, getStatsOn, getStatsOnMs, getStopGracefully, getSystemClasses, getTrace, join, removeContext, removeListener, removeRealm, save, service, setAnonymous, setContexts, setListeners, setRequestLog, setRequestsPerGC, setResolveRemoteHost, setServerClasses, setStatsOn, setStopGracefully, setSystemClasses, setTrace, statsReset, stop
 
Methods inherited from class org.mortbay.util.Container
addComponent, addEventListener, getComponents, isFailed, isStarted, isStarting, isStopping, removeComponent, removeEventListener, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mortbay.util.LifeCycle
isStarted, start, stop
 
Methods inherited from interface org.mortbay.util.EventProvider
addEventListener, removeEventListener
 

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.
Throws:
java.io.IOException

Server

public Server(Resource configuration)
       throws java.io.IOException
Constructor.

Parameters:
configuration - The filename or URL of the XML configuration file.
Throws:
java.io.IOException

Server

public Server(java.net.URL configuration)
       throws java.io.IOException
Constructor.

Parameters:
configuration - The filename or URL of the XML configuration file.
Throws:
java.io.IOException
Method Detail

addService

public void addService(Service service)
Add a Service to a Server. Examples are transaction service, mail service etc

Parameters:
service - eg TMService, MailService

doStart

protected void doStart()
                throws java.lang.Exception
Start all handlers then listeners. If a subcomponent fails to start, it's exception is added to a org.mortbay.util.MultiException and the start method continues.

Overrides:
doStart in class HttpServer
Throws:
MultiException - A collection of exceptions thrown by start() method of subcomponents of the HttpServer.
java.lang.Exception

doStop

protected void doStop()
               throws java.lang.InterruptedException
Stop all listeners then all contexts.

Overrides:
doStop in class HttpServer
Parameters:
graceful - If true and statistics are on for a context, then this method will wait for requestsActive to go to zero before stopping that context.
Throws:
java.lang.InterruptedException - If interrupted, stop may not have been called on everything.

main

public static void main(java.lang.String[] arg)

newWebApplicationContext

protected WebApplicationContext newWebApplicationContext(java.lang.String webApp)
Create a new WebApplicationContext. Ths method is called by Server to creat new contexts for web applications. Thus calls to addWebApplication that result in a new Context being created will return an correct class instance. Derived class can override this method to create instance of its own class derived from WebApplicationContext in case it needs more functionality.

Overrides:
newWebApplicationContext in class Server
Parameters:
webApp - The Web application directory or WAR file.
Returns:
WebApplicationContext


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