|
Lightweight HTTP Server 1.0.0.Beta1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.com.sun.net.httpserver.HttpHost
public abstract class HttpHost
This class implements a simple HTTP host. A HttpHost may be "real" or "virtual".
A "real" host is one which is bound to an IP address and extends the HttpServer
subclass. A "virtual" host allows for more than one set of registered contexts
per physical server, differentiated by host name, IP address, or other criteria.
One or more HttpHandler
objects must be associated with a host
in order to process requests. Each such HttpHandler is registered
with a root URI path which represents the
location of the application or service on this server. The mapping of a handler
to a HttpHost
is essentially equivalent to the mapping of a handler to a
HttpServer
.
Constructor Summary | |
---|---|
HttpHost()
|
Method Summary | |
---|---|
abstract HttpContext |
createContext(String path)
Creates a HttpContext without initially specifying a handler. |
abstract HttpContext |
createContext(String path,
HttpHandler handler)
Creates a HttpContext . |
abstract void |
removeContext(HttpContext context)
Removes the given context from the server. |
abstract void |
removeContext(String path)
Removes the context identified by the given path from the server. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HttpHost()
Method Detail |
---|
public abstract HttpContext createContext(String path, HttpHandler handler)
HttpContext
. A HttpContext
represents a mapping from a
URI path to a exchange handler on this HttpHost
. Once created, all requests
received by the server for the path will be handled by calling
the given handler object. The context is identified by the path, and
can later be removed from the server using this with the removeContext(String)
method.
The path specifies the root URI path for this context. The first character of path must be
'/'
.
The class overview describes how incoming request URIs are mapped to HttpContext instances.
path
- the root URI path to associate the context withhandler
- the handler to invoke for incoming requests.
IllegalArgumentException
- if path is invalid, or if a context
already exists for this path
NullPointerException
- if either path, or handler are null
public abstract HttpContext createContext(String path)
HttpContext
without initially specifying a handler. The handler must later be specified using
com.sun.net.httpserver.HttpContext#setHandler(com.sun.net.httpserver.HttpHandler)
. A HttpContext
represents a mapping from a
URI path to an exchange handler on this HttpHost
. Once created, and when
the handler has been set, all requests
received by the server for the path will be handled by calling
the handler object. The context is identified by the path, and
can later be removed from the server using this with the removeContext(String)
method.
The path specifies the root URI path for this context. The first character of path must be
'/'
.
The class overview describes how incoming request URIs are mapped to HttpContext instances.
path
- the root URI path to associate the context with
IllegalArgumentException
- if path is invalid, or if a context
already exists for this path
NullPointerException
- if path is null
public abstract void removeContext(String path) throws IllegalArgumentException
path
- the path of the handler to remove
IllegalArgumentException
- if no handler corresponding to this
path exists.
NullPointerException
- if path is null
public abstract void removeContext(HttpContext context) throws IllegalArgumentException
context
- the context to remove
IllegalArgumentException
- if the given context is not registered on this host
NullPointerException
- if context is null
|
Lightweight HTTP Server 1.0.0.Beta1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |