|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.beans.beancontext.BeanContextChildSupport | +--java.beans.beancontext.BeanContextSupport | +--org.mortbay.http.HttpServer
HTTP Server. Services HTTP requests by maintaining a mapping between a collection of HttpListeners which generate requests and HttpContexts which contain collections of HttpHandlers. This class is configured by API calls. The org.mortbay.jetty.Server class uses XML configuration files to configure instances of this class. The HttpServer implements the BeanContext API so that membership events may be generated for HttpListeners, HandlerContexts and WebApplications.
HttpContext
,
HttpHandler
,
HttpConnection
,
HttpListener
,
Server
, Serialized FormFields 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 | |
HttpServer()
Constructor. |
Method Summary | |
HandlerContext |
addContext(java.lang.String contextPath)
Create and add a new context. |
void |
addContext(java.lang.String host,
HandlerContext context)
Add a context. |
HandlerContext |
addContext(java.lang.String host,
java.lang.String contextPathSpec)
Create and add a new context. |
void |
addHostAlias(java.lang.String host,
java.lang.String alias)
Define a virtual host alias. |
void |
addListener(HttpListener listener)
Add a HTTP Listener to the server. |
HttpListener |
addListener(InetAddrPort address)
Create and add a SocketListener. |
HttpListener |
addListener(java.lang.String listenerClass)
Add a HTTP Listener to the server. |
UserRealm |
addRealm(UserRealm realm)
|
void |
destroy()
Stop all listeners then handlers. |
HttpHandler |
findHandler(java.lang.Class handlerClass,
java.lang.String uri,
java.util.List hosts)
Find handler. |
int |
getConnections()
|
long |
getConnectionsDurationAve()
|
long |
getConnectionsDurationMax()
|
int |
getConnectionsOpen()
|
int |
getConnectionsOpenMax()
|
int |
getConnectionsRequestsAve()
|
int |
getConnectionsRequestsMax()
|
HandlerContext |
getContext(java.lang.String host,
java.lang.String contextPath)
Get or create context. |
HandlerContext |
getContext(java.lang.String host,
java.lang.String contextPathSpec,
int i)
|
int |
getErrors()
|
java.util.Set |
getHandlerContexts()
|
java.util.Set |
getHandlers()
|
java.util.Map |
getHostMap()
|
HttpEncoding |
getHttpEncoding()
|
static java.util.List |
getHttpServerList()
|
java.util.Collection |
getListeners()
|
LogSink |
getLogSink()
Deprecated. use getRequestLogSink() |
UserRealm |
getRealm(java.lang.String realmName)
|
RequestLogFormat |
getRequestLogFormat()
|
LogSink |
getRequestLogSink()
|
int |
getRequests()
|
int |
getRequestsActive()
|
int |
getRequestsActiveMax()
|
long |
getRequestsDurationAve()
|
long |
getRequestsDurationMax()
|
boolean |
getStatsOn()
|
boolean |
isChunkingForced()
|
boolean |
isDestroyed()
|
boolean |
isStarted()
Start all handlers then listeners. |
static void |
main(java.lang.String[] args)
Construct server from command line arguments. |
void |
removeContext(HandlerContext context)
Remove a context or Web application. |
void |
removeContext(java.lang.String host,
java.lang.String contextPathSpec,
int i)
Remove a context or Web application. |
void |
removeListener(HttpListener listener)
Remove a HTTP Listener. |
UserRealm |
removeRealm(java.lang.String realmName)
|
HandlerContext |
service(HttpRequest request,
HttpResponse response)
Service a request. |
void |
setChunkingForced(boolean forced)
Set Chunking Forced. |
void |
setHttpEncoding(HttpEncoding httpEncoding)
The HttpEncoding instance is used to extend the transport encodings supprted by this server. |
void |
setLogSink(LogSink logSink)
Deprecated. use setRequestLogSink() |
void |
setRequestLogFormat(RequestLogFormat format)
Set the requestLogFormat. |
void |
setRequestLogSink(LogSink logSink)
Set the request log. |
void |
setStatsOn(boolean on)
|
void |
start()
Start all handlers then listeners. |
void |
statsReset()
Reset statistics. |
void |
stop()
Stop all listeners then handlers. |
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 |
public HttpServer()
Method Detail |
public HttpEncoding getHttpEncoding()
public void setHttpEncoding(HttpEncoding httpEncoding)
httpEncoding
- The HttpEncoding helper instance.public void start() throws MultiException
start
in interface LifeCycle
MultiException
- A collection of exceptions thrown by
start() method of subcomponents of the HttpServer.public boolean isStarted()
isStarted
in interface LifeCycle
org.mortbay.util.LifeCycle
public void stop() throws java.lang.InterruptedException
stop
in interface LifeCycle
java.lang.InterruptedException
- If interrupted, stop may not have
been called on everything.public void destroy()
destroy
in interface LifeCycle
public boolean isDestroyed()
isDestroyed
in interface LifeCycle
org.mortbay.util.LifeCycle
public HttpListener addListener(InetAddrPort address) throws java.io.IOException
address
- java.io.IOException
- public void addListener(HttpListener listener) throws java.lang.IllegalArgumentException
listener
- The Listener.java.lang.IllegalArgumentException
- If the listener is not for this
server.public HttpListener addListener(java.lang.String listenerClass) throws java.lang.IllegalArgumentException
listenerClass
- The Listener classname, or null for the default
Listener class.java.lang.IllegalArgumentException
- public void removeListener(HttpListener listener)
listener
- public java.util.Collection getListeners()
public void addHostAlias(java.lang.String host, java.lang.String alias)
host
- Host name or IPalias
- Alias hostname or IPpublic HandlerContext addContext(java.lang.String contextPath)
contextPath
- public HandlerContext addContext(java.lang.String host, java.lang.String contextPathSpec)
host
- Virtual hostname or null for all hosts.contextPathSpec
- public void addContext(java.lang.String host, HandlerContext context)
host
- The virtual host or null for all hosts.context
- public void removeContext(java.lang.String host, java.lang.String contextPathSpec, int i) throws java.lang.IllegalStateException
host
- The virtual host or null for all hosts.contextPathSpec
- i
- Index among contexts of same host and pathSpec.java.lang.IllegalStateException
- if context not stoppedpublic void removeContext(HandlerContext context) throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if context not stoppedpublic HandlerContext getContext(java.lang.String host, java.lang.String contextPathSpec, int i)
host
- The virtual host or null for all hosts.contextPathSpec
- i
- Index among contexts of same host and pathSpec.public HandlerContext getContext(java.lang.String host, java.lang.String contextPath)
host
- The virtual host or null for all hosts.contextPath
- public java.util.Set getHandlers()
public java.util.Set getHandlerContexts()
public LogSink getLogSink()
public void setLogSink(LogSink logSink)
public LogSink getRequestLogSink()
public void setRequestLogSink(LogSink logSink)
logSink
- public RequestLogFormat getRequestLogFormat()
public void setRequestLogFormat(RequestLogFormat format)
format
- public HandlerContext service(HttpRequest request, HttpResponse response) throws java.io.IOException, HttpException
request
- response
- java.io.IOException
- HttpException
- public HttpHandler findHandler(java.lang.Class handlerClass, java.lang.String uri, java.util.List hosts)
uri
- URI that must be satisfied by the servlet handlerhosts
- null or a list of virtual hosts names to searchpublic UserRealm addRealm(UserRealm realm)
public UserRealm getRealm(java.lang.String realmName)
public UserRealm removeRealm(java.lang.String realmName)
public boolean isChunkingForced()
public void setChunkingForced(boolean forced)
forced
- If true, chunking is used for all HTTP/1.1
responses, even if a content-length was known.public static java.util.List getHttpServerList()
public java.util.Map getHostMap()
public void statsReset()
public void setStatsOn(boolean on)
public boolean getStatsOn()
public int getConnections()
public int getConnectionsOpen()
public int getConnectionsOpenMax()
public long getConnectionsDurationAve()
public long getConnectionsDurationMax()
public int getConnectionsRequestsAve()
public int getConnectionsRequestsMax()
public int getErrors()
public int getRequests()
public int getRequestsActive()
public int getRequestsActiveMax()
public long getRequestsDurationAve()
public long getRequestsDurationMax()
public static void main(java.lang.String[] args)
args
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |