Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.mortbay.jetty
Class Server  view Server download Server.java

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

public class Server
extends org.mortbay.http.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. HttpContexts created by Server are of the type org.mortbay.jetty.servlet.ServletHttpContext 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.30 $

Nested Class Summary
 
Nested classes inherited from class org.mortbay.http.HttpServer
org.mortbay.http.HttpServer.ComponentEvent, org.mortbay.http.HttpServer.ComponentEventListener
 
Field Summary
private  java.lang.String _configuration
           
private  java.lang.String _rootWebApp
           
(package private) static org.apache.commons.logging.Log log
           
 
Fields inherited from class org.mortbay.http.HttpServer
 
Constructor Summary
Server()
          Constructor.
Server(org.mortbay.util.Resource configuration)
          Constructor.
Server(java.lang.String configuration)
          Constructor.
Server(java.net.URL configuration)
          Constructor.
 
Method Summary
 org.mortbay.jetty.servlet.WebApplicationContext addWebApplication(java.lang.String contextPathSpec, java.lang.String webApp)
          Add Web Application.
 org.mortbay.jetty.servlet.WebApplicationContext addWebApplication(java.lang.String virtualHost, java.lang.String contextPathSpec, java.lang.String webApp)
          Add Web Application.
 org.mortbay.jetty.servlet.WebApplicationContext[] addWebApplications(java.lang.String webapps)
          Add Web Applications.
 org.mortbay.jetty.servlet.WebApplicationContext[] addWebApplications(java.lang.String host, java.lang.String webapps)
          Add Web Applications.
 org.mortbay.jetty.servlet.WebApplicationContext[] addWebApplications(java.lang.String host, java.lang.String webapps, boolean extract)
          Add Web Applications.
 org.mortbay.jetty.servlet.WebApplicationContext[] addWebApplications(java.lang.String host, java.lang.String webapps, java.lang.String defaults, boolean extract)
          Add Web Applications.
 org.mortbay.jetty.servlet.WebApplicationContext[] addWebApplications(java.lang.String host, java.lang.String webapps, java.lang.String defaults, boolean extract, boolean java2CompliantClassLoader)
          Add Web Applications.
 void configure(java.lang.String configuration)
          Configure the server from an XML file.
 java.lang.String getConfiguration()
           
 java.lang.String getRootWebApp()
          Get the root webapp name.
static void main(java.lang.String[] arg)
          Construct server from command line arguments.
protected  org.mortbay.http.HttpContext newHttpContext()
          Create a new ServletHttpContext.
protected  org.mortbay.jetty.servlet.WebApplicationContext newWebApplicationContext(java.lang.String webApp)
          Create a new WebApplicationContext.
 void setRootWebApp(java.lang.String rootWebApp)
          Set the root webapp name.
 
Methods inherited from class org.mortbay.http.HttpServer
addContext, addContext, addContext, addContext, addEventListener, addHostAlias, addListener, addListener, addListener, addRealm, destroy, findHandler, getConnections, getConnectionsDurationAve, getConnectionsDurationMax, getConnectionsOpen, getConnectionsOpenMax, getConnectionsRequestsAve, getConnectionsRequestsMax, getContext, getContext, getContext, getContexts, getErrors, getHostMap, getHttpServerList, getHttpServers, getListeners, getRealm, getRequestLog, getRequests, getRequestsActive, getRequestsActiveMax, getRequestsDurationAve, getRequestsDurationMax, getRequestsPerGC, getResolveRemoteHost, getStatsOn, getStatsOnMs, getTrace, isStarted, join, removeContext, removeEventListener, removeListener, removeRealm, save, service, setAnonymous, setContexts, setListeners, setRequestLog, setRequestsPerGC, setResolveRemoteHost, setStatsOn, setTrace, start, statsReset, stop, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

static org.apache.commons.logging.Log log

_configuration

private java.lang.String _configuration

_rootWebApp

private java.lang.String _rootWebApp
Constructor Detail

Server

public Server()
Constructor.


Server

public Server(java.lang.String configuration)
       throws java.io.IOException
Constructor.


Server

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


Server

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

Method Detail

getRootWebApp

public java.lang.String getRootWebApp()
Get the root webapp name.


setRootWebApp

public void setRootWebApp(java.lang.String rootWebApp)
Set the root webapp name.


configure

public void configure(java.lang.String configuration)
               throws java.io.IOException
Configure the server from an XML file.


getConfiguration

public java.lang.String getConfiguration()

newHttpContext

protected org.mortbay.http.HttpContext newHttpContext()
Create a new ServletHttpContext. Ths method is called by HttpServer to creat new contexts. Thus calls to addContext or getContext that result in a new Context being created will return an org.mortbay.jetty.servlet.ServletHttpContext instance.


newWebApplicationContext

protected org.mortbay.jetty.servlet.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.


addWebApplication

public org.mortbay.jetty.servlet.WebApplicationContext addWebApplication(java.lang.String contextPathSpec,
                                                                         java.lang.String webApp)
                                                                  throws java.io.IOException
Add Web Application.


addWebApplication

public org.mortbay.jetty.servlet.WebApplicationContext addWebApplication(java.lang.String virtualHost,
                                                                         java.lang.String contextPathSpec,
                                                                         java.lang.String webApp)
                                                                  throws java.io.IOException
Add Web Application.


addWebApplications

public org.mortbay.jetty.servlet.WebApplicationContext[] addWebApplications(java.lang.String webapps)
                                                                     throws java.io.IOException
Add Web Applications. Add auto webapplications to the server. The name of the webapp directory or war is used as the context name. If a webapp is called "root" it is added at "/".


addWebApplications

public org.mortbay.jetty.servlet.WebApplicationContext[] addWebApplications(java.lang.String host,
                                                                            java.lang.String webapps)
                                                                     throws java.io.IOException
Add Web Applications. Add auto webapplications to the server. The name of the webapp directory or war is used as the context name. If the webapp matches the rootWebApp it is added as the "/" context.


addWebApplications

public org.mortbay.jetty.servlet.WebApplicationContext[] addWebApplications(java.lang.String host,
                                                                            java.lang.String webapps,
                                                                            boolean extract)
                                                                     throws java.io.IOException
Add Web Applications. Add auto webapplications to the server. The name of the webapp directory or war is used as the context name. If the webapp matches the rootWebApp it is added as the "/" context.


addWebApplications

public org.mortbay.jetty.servlet.WebApplicationContext[] addWebApplications(java.lang.String host,
                                                                            java.lang.String webapps,
                                                                            java.lang.String defaults,
                                                                            boolean extract)
                                                                     throws java.io.IOException
Add Web Applications. Add auto webapplications to the server. The name of the webapp directory or war is used as the context name. If the webapp matches the rootWebApp it is added as the "/" context.


addWebApplications

public org.mortbay.jetty.servlet.WebApplicationContext[] addWebApplications(java.lang.String host,
                                                                            java.lang.String webapps,
                                                                            java.lang.String defaults,
                                                                            boolean extract,
                                                                            boolean java2CompliantClassLoader)
                                                                     throws java.io.IOException
Add Web Applications. Add auto webapplications to the server. The name of the webapp directory or war is used as the context name. If the webapp matches the rootWebApp it is added as the "/" context.


main

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