IN
- The type that will be received by this serverOUT
- The type that will be sent by this serverpublic abstract class HttpServer<IN,OUT> extends ReactorPeer<IN,OUT,HttpChannel<IN,OUT>>
Modifier and Type | Field and Description |
---|---|
protected Registry<HttpChannel,ReactorChannelHandler<IN,OUT,HttpChannel<IN,OUT>>> |
routedWriters |
started
Modifier | Constructor and Description |
---|---|
protected |
HttpServer(Environment env,
Dispatcher dispatcher,
Codec<Buffer,IN,OUT> codec) |
Modifier and Type | Method and Description |
---|---|
HttpServer<IN,OUT> |
delete(String path,
ReactorChannelHandler<IN,OUT,HttpChannel<IN,OUT>> handler)
Listen for HTTP DELETE on the passed path to be used as a routing condition.
|
HttpServer<IN,OUT> |
get(String path,
ReactorChannelHandler<IN,OUT,HttpChannel<IN,OUT>> handler)
Listen for HTTP GET on the passed path to be used as a routing condition.
|
abstract InetSocketAddress |
getListenAddress()
Get the address to which this server is bound.
|
protected boolean |
hasWebsocketEndpoints() |
protected abstract void |
onWebsocket(HttpChannel<IN,OUT> next) |
HttpServer<IN,OUT> |
post(String path,
ReactorChannelHandler<IN,OUT,HttpChannel<IN,OUT>> handler)
Listen for HTTP POST on the passed path to be used as a routing condition.
|
HttpServer<IN,OUT> |
put(String path,
ReactorChannelHandler<IN,OUT,HttpChannel<IN,OUT>> handler)
Listen for HTTP PUT on the passed path to be used as a routing condition.
|
HttpServer<IN,OUT> |
route(Selector<HttpChannel> condition,
ReactorChannelHandler<IN,OUT,HttpChannel<IN,OUT>> serviceFunction)
Register an handler for the given Selector condition, incoming connections will query the internal registry
to invoke the matching handlers.
|
protected Iterable<? extends org.reactivestreams.Publisher<Void>> |
routeChannel(HttpChannel<IN,OUT> ch) |
Promise<Void> |
start()
Start the server without any global handler, only the specific routed methods (get, post...) will apply.
|
HttpServer<IN,OUT> |
ws(String path,
ReactorChannelHandler<IN,OUT,HttpChannel<IN,OUT>> handler)
Listen for WebSocket on the passed path to be used as a routing condition.
|
doShutdown, doStart, getDefaultCodec, getDefaultDispatcher, getDefaultEnvironment, getDefaultPrefetchSize, shutdown, start
protected final Registry<HttpChannel,ReactorChannelHandler<IN,OUT,HttpChannel<IN,OUT>>> routedWriters
protected HttpServer(Environment env, Dispatcher dispatcher, Codec<Buffer,IN,OUT> codec)
public Promise<Void> start()
public abstract InetSocketAddress getListenAddress()
public HttpServer<IN,OUT> route(Selector<HttpChannel> condition, ReactorChannelHandler<IN,OUT,HttpChannel<IN,OUT>> serviceFunction)
condition
- a Selector
to match the incoming connection with registered handlerserviceFunction
- an handler to invoke for the given conditionthis
public final HttpServer<IN,OUT> get(String path, ReactorChannelHandler<IN,OUT,HttpChannel<IN,OUT>> handler)
HttpChannel.param(String)
path
- The HttpSelector
to resolve against this path, pattern matching and capture are supportedhandler
- an handler to invoke for the given conditionthis
public final HttpServer<IN,OUT> post(String path, ReactorChannelHandler<IN,OUT,HttpChannel<IN,OUT>> handler)
HttpChannel.param(String)
path
- The HttpSelector
to resolve against this path, pattern matching and capture are supportedhandler
- an handler to invoke for the given conditionthis
public final HttpServer<IN,OUT> put(String path, ReactorChannelHandler<IN,OUT,HttpChannel<IN,OUT>> handler)
HttpChannel.param(String)
path
- The HttpSelector
to resolve against this path, pattern matching and capture are supportedhandler
- an handler to invoke for the given conditionthis
public final HttpServer<IN,OUT> ws(String path, ReactorChannelHandler<IN,OUT,HttpChannel<IN,OUT>> handler)
HttpChannel.param(String)
path
- The HttpSelector
to resolve against this path, pattern matching and capture are supportedhandler
- an handler to invoke for the given conditionthis
public final HttpServer<IN,OUT> delete(String path, ReactorChannelHandler<IN,OUT,HttpChannel<IN,OUT>> handler)
HttpChannel.param(String)
path
- The HttpSelector
to resolve against this path, pattern matching and capture are supportedhandler
- an handler to invoke for the given conditionthis
protected abstract void onWebsocket(HttpChannel<IN,OUT> next)
protected final boolean hasWebsocketEndpoints()
protected Iterable<? extends org.reactivestreams.Publisher<Void>> routeChannel(HttpChannel<IN,OUT> ch)
Copyright © 2017. All rights reserved.