public interface HttpServerRoutes extends java.util.function.BiFunction<HttpServerRequest,HttpServerResponse,Publisher<java.lang.Void>>
| Modifier and Type | Field and Description |
|---|---|
static java.util.function.Predicate<HttpServerRequest> |
INDEX_PREDICATE |
| Modifier and Type | Method and Description |
|---|---|
default HttpServerRoutes |
delete(java.lang.String path,
java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<java.lang.Void>> handler)
Listen for HTTP DELETE on the passed path to be used as a routing condition.
|
default HttpServerRoutes |
directory(java.lang.String uri,
java.nio.file.Path directory)
Listen for HTTP GET on the passed path to be used as a routing condition.
|
HttpServerRoutes |
directory(java.lang.String uri,
java.nio.file.Path directory,
java.util.function.Function<HttpServerResponse,HttpServerResponse> interceptor)
Listen for HTTP GET on the passed path to be used as a routing condition.The
content of the provided
directory will be served. |
default HttpServerRoutes |
file(java.util.function.Predicate<HttpServerRequest> uri,
java.nio.file.Path path,
java.util.function.Function<HttpServerResponse,HttpServerResponse> interceptor)
Listen for HTTP GET on the passed path to be used as a routing condition.
|
default HttpServerRoutes |
file(java.lang.String uri,
java.nio.file.Path path)
Listen for HTTP GET on the passed path to be used as a routing condition.
|
default HttpServerRoutes |
file(java.lang.String uri,
java.lang.String path)
Listen for HTTP GET on the passed path to be used as a routing condition.
|
default HttpServerRoutes |
get(java.lang.String path,
java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<java.lang.Void>> handler)
Listen for HTTP GET on the passed path to be used as a routing condition.
|
default HttpServerRoutes |
head(java.lang.String path,
java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<java.lang.Void>> handler)
Listen for HTTP HEAD on the passed path to be used as a routing condition.
|
default HttpServerRoutes |
index(java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<java.lang.Void>> handler)
This route will be invoked when GET "/path" or "/path/" like uri are requested.
|
static HttpServerRoutes |
newRoutes() |
default HttpServerRoutes |
options(java.lang.String path,
java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<java.lang.Void>> handler)
Listen for HTTP OPTIONS on the passed path to be used as a routing condition.
|
default HttpServerRoutes |
post(java.lang.String path,
java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<java.lang.Void>> handler)
Listen for HTTP POST on the passed path to be used as a routing condition.
|
default HttpServerRoutes |
put(java.lang.String path,
java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<java.lang.Void>> handler)
Listen for HTTP PUT on the passed path to be used as a routing condition.
|
HttpServerRoutes |
route(java.util.function.Predicate<? super HttpServerRequest> condition,
java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<java.lang.Void>> handler)
A generic route predicate that if matched invoke the passed req/resp handler.
|
default HttpServerRoutes |
ws(java.util.function.Predicate<? super HttpServerRequest> condition,
java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<java.lang.Void>> handler,
java.lang.String protocols)
Listen for WebSocket with the given route predicate to invoke the matching handlers
|
default HttpServerRoutes |
ws(java.util.function.Predicate<? super HttpServerRequest> condition,
java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<java.lang.Void>> handler,
java.lang.String protocols,
int maxFramePayloadLength)
Listen for WebSocket with the given route predicate to invoke the matching handlers
|
default HttpServerRoutes |
ws(java.lang.String path,
java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<java.lang.Void>> handler)
Listen for WebSocket on the passed path to be used as a routing condition.
|
default HttpServerRoutes |
ws(java.lang.String path,
java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<java.lang.Void>> handler,
java.lang.String protocols)
Listen for WebSocket on the passed path to be used as a routing condition.
|
static final java.util.function.Predicate<HttpServerRequest> INDEX_PREDICATE
static HttpServerRoutes newRoutes()
HttpServerRoutesdefault HttpServerRoutes delete(java.lang.String path, java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<java.lang.Void>> handler)
Additional regex matching is available, e.g. "/test/{param}".
Params are resolved using HttpServerRequest.param(CharSequence)
path - The DELETE path used by clients.handler - an handler to invoke for the given conditionHttpServerRoutesdefault HttpServerRoutes directory(java.lang.String uri, java.nio.file.Path directory)
directory will be served.
Additional regex matching is available, e.g. "/test/{param}". Params are resolved
using HttpServerRequest.param(CharSequence)
uri - The GET path used by clientsdirectory - the root prefix to serve from in file system, e.g.
"/Users/me/resources"HttpServerRoutesHttpServerRoutes directory(java.lang.String uri, java.nio.file.Path directory, @Nullable java.util.function.Function<HttpServerResponse,HttpServerResponse> interceptor)
directory will be served.
Additional regex matching is available, e.g. "/test/{param}". Params are resolved
using HttpServerRequest.param(CharSequence)
uri - The GET path used by clientsdirectory - the root prefix to serve from in file system, e.g.
"/Users/me/resources"interceptor - a pre response processorHttpServerRoutesdefault HttpServerRoutes file(java.lang.String uri, java.nio.file.Path path)
File will be served.
Additional regex matching is available, e.g. "/test/{param}". Params are resolved
using HttpServerRequest.param(CharSequence)
uri - The GET path used by clientspath - the resource Path to serveHttpServerRoutesdefault HttpServerRoutes file(java.lang.String uri, java.lang.String path)
Additional regex matching is available, e.g. "/test/{param}". Params are resolved
using HttpServerRequest.param(CharSequence)
uri - The GET path used by clientspath - the resource path to serveHttpServerRoutesdefault HttpServerRoutes file(java.util.function.Predicate<HttpServerRequest> uri, java.nio.file.Path path, @Nullable java.util.function.Function<HttpServerResponse,HttpServerResponse> interceptor)
Path is served.
Additional regex matching is available e.g.
"/test/{param}". Params are resolved using HttpServerRequest.param(CharSequence)
uri - The HttpPredicate to use to trigger the route, pattern matching
and capture are supportedpath - the Path to the file to serveinterceptor - a channel pre-intercepting handler e.g. for content type headerHttpServerRoutesdefault HttpServerRoutes get(java.lang.String path, java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<java.lang.Void>> handler)
Additional regex matching is available e.g.
"/test/{param}". Params are resolved using HttpServerRequest.param(CharSequence)
path - The GET path used by clientshandler - an handler to invoke for the given conditionHttpServerRoutesdefault HttpServerRoutes head(java.lang.String path, java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<java.lang.Void>> handler)
Additional regex matching is available e.g.
"/test/{param}". Params are resolved using HttpServerRequest.param(CharSequence)
path - The HEAD path used by clientshandler - an handler to invoke for the given conditionHttpServerRoutesdefault HttpServerRoutes index(java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<java.lang.Void>> handler)
handler - an handler to invoke on index/root requestHttpServerRoutesdefault HttpServerRoutes options(java.lang.String path, java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<java.lang.Void>> handler)
Additional regex matching is available e.g.
"/test/{param}". Params are resolved using HttpServerRequest.param(CharSequence)
path - The OPTIONS path used by clientshandler - an handler to invoke for the given conditionHttpServerRoutesdefault HttpServerRoutes post(java.lang.String path, java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<java.lang.Void>> handler)
Additional regex matching is available e.g.
"/test/{param}". Params are resolved using HttpServerRequest.param(CharSequence)
path - The POST path used by clientshandler - an handler to invoke for the given conditionHttpServerRoutesdefault HttpServerRoutes put(java.lang.String path, java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<java.lang.Void>> handler)
Additional regex matching is available e.g.
"/test/{param}". Params are resolved using HttpServerRequest.param(CharSequence)
path - The PUT path used by clientshandler - an handler to invoke for the given conditionHttpServerRoutesHttpServerRoutes route(java.util.function.Predicate<? super HttpServerRequest> condition, java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<java.lang.Void>> handler)
condition - a predicate given each inbound requesthandler - the handler to invoke on matchHttpServerRoutesdefault HttpServerRoutes ws(java.lang.String path, java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<java.lang.Void>> handler)
Additional regex matching is available e.g. "/test/{param}".
Params are resolved using HttpServerRequest.param(CharSequence)
They are not accessible in the handler provided as parameter.
path - The websocket path used by clientshandler - an handler to invoke for the given conditionHttpServerRoutesdefault HttpServerRoutes ws(java.lang.String path, java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<java.lang.Void>> handler, @Nullable java.lang.String protocols)
Additional regex matching is available e.g. "/test/{param}".
Params are resolved using HttpServerRequest.param(CharSequence)
They are not accessible in the handler provided as parameter.
path - The websocket path used by clientshandler - an handler to invoke for the given conditionprotocols - sub-protocol to use in WS handshake signaturedefault HttpServerRoutes ws(java.util.function.Predicate<? super HttpServerRequest> condition, java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<java.lang.Void>> handler, @Nullable java.lang.String protocols)
condition - a predicate given each inbound requesthandler - an handler to invoke for the given conditionprotocols - sub-protocol to use in WS handshake signaturedefault HttpServerRoutes ws(java.util.function.Predicate<? super HttpServerRequest> condition, java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<java.lang.Void>> handler, @Nullable java.lang.String protocols, int maxFramePayloadLength)
condition - a predicate given each inbound requesthandler - an handler to invoke for the given conditionprotocols - sub-protocol to use in WS handshake signature