public interface HttpServerRoutes extends java.util.function.BiFunction<HttpServerRequest,HttpServerResponse,Publisher<Void>>
Modifier and Type | Field and Description |
---|---|
static java.util.function.Predicate<HttpServerRequest> |
INDEX_PREDICATE |
Modifier and Type | Method and Description |
---|---|
default HttpServerRoutes |
delete(String path,
java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<Void>> handler)
Listens for HTTP DELETE on the passed path to be used as a routing condition.
|
default HttpServerRoutes |
directory(String uri,
Path directory)
Listens for HTTP GET on the passed path to be used as a routing condition.
|
HttpServerRoutes |
directory(String uri,
Path directory,
java.util.function.Function<HttpServerResponse,HttpServerResponse> interceptor)
Listens 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,
Path path,
java.util.function.Function<HttpServerResponse,HttpServerResponse> interceptor)
Listens for HTTP GET on the passed path to be used as a routing condition.
|
default HttpServerRoutes |
file(String uri,
Path path)
Listens for HTTP GET on the passed path to be used as a routing condition.
|
default HttpServerRoutes |
file(String uri,
String path)
Listens for HTTP GET on the passed path to be used as a routing condition.
|
default HttpServerRoutes |
get(String path,
java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<Void>> handler)
Listens for HTTP GET on the passed path to be used as a routing condition.
|
default HttpServerRoutes |
head(String path,
java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<Void>> handler)
Listens 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<Void>> handler)
This route will be invoked when GET "/path" or "/path/" like uri are requested.
|
static HttpServerRoutes |
newRoutes()
Returns a new default routing registry
HttpServerRoutes |
default HttpServerRoutes |
options(String path,
java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<Void>> handler)
Listens for HTTP OPTIONS on the passed path to be used as a routing condition.
|
default HttpServerRoutes |
post(String path,
java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<Void>> handler)
Listens for HTTP POST on the passed path to be used as a routing condition.
|
default HttpServerRoutes |
put(String path,
java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<Void>> handler)
Listens 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<Void>> handler)
A generic route predicate that if matched invoke the passed I/O handler.
|
default HttpServerRoutes |
ws(java.util.function.Predicate<? super HttpServerRequest> condition,
java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<Void>> handler,
String protocols)
Listens for websocket with the given route predicate to invoke the matching I/O handler.
|
default HttpServerRoutes |
ws(java.util.function.Predicate<? super HttpServerRequest> condition,
java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<Void>> handler,
String protocols,
int maxFramePayloadLength)
Listens for websocket with the given route predicate to invoke the matching handler.
|
default HttpServerRoutes |
ws(String path,
java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<Void>> handler)
Listens for websocket on the passed path to be used as a routing condition.
|
default HttpServerRoutes |
ws(String path,
java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<Void>> handler,
String protocols)
Listens for websocket on the passed path to be used as a routing condition.
|
andThen, apply
static final java.util.function.Predicate<HttpServerRequest> INDEX_PREDICATE
static HttpServerRoutes newRoutes()
HttpServerRoutes
HttpServerRoutes
default HttpServerRoutes delete(String path, java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<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 I/O handler to invoke for the given conditionHttpServerRoutes
default HttpServerRoutes directory(String uri, 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 the file system, e.g.
"/Users/me/resources"HttpServerRoutes
HttpServerRoutes directory(String uri, 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 the file system, e.g.
"/Users/me/resources"interceptor
- a pre response processorHttpServerRoutes
default HttpServerRoutes file(String uri, 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 serveHttpServerRoutes
default HttpServerRoutes file(String uri, 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 serveHttpServerRoutes
default HttpServerRoutes file(java.util.function.Predicate<HttpServerRequest> uri, 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 headerHttpServerRoutes
default HttpServerRoutes get(String path, java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<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 I/O handler to invoke for the given conditionHttpServerRoutes
default HttpServerRoutes head(String path, java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<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 I/O handler to invoke for the given conditionHttpServerRoutes
default HttpServerRoutes index(java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<Void>> handler)
handler
- an I/O handler to invoke on index/root requestHttpServerRoutes
default HttpServerRoutes options(String path, java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<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 I/O handler to invoke for the given conditionHttpServerRoutes
default HttpServerRoutes post(String path, java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<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 I/O handler to invoke for the given conditionHttpServerRoutes
default HttpServerRoutes put(String path, java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<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 I/O handler to invoke for the given conditionHttpServerRoutes
HttpServerRoutes route(java.util.function.Predicate<? super HttpServerRequest> condition, java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<Void>> handler)
condition
- a predicate given each inbound requesthandler
- the I/O handler to invoke on matchHttpServerRoutes
default HttpServerRoutes ws(String path, java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<Void>> handler)
Additional regex matching is available e.g. "/test/{param}".
Params are resolved using HttpServerRequest.param(CharSequence)
They are NOT accessible in the I/O handler provided as parameter.
path
- The websocket path used by clientshandler
- an I/O handler to invoke for the given conditionHttpServerRoutes
default HttpServerRoutes ws(String path, java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<Void>> handler, @Nullable 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 I/O handler to invoke for the given conditionprotocols
- sub-protocol to use in websocket handshake signatureHttpServerRoutes
default HttpServerRoutes ws(java.util.function.Predicate<? super HttpServerRequest> condition, java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<Void>> handler, @Nullable String protocols)
condition
- a predicate given each inbound requesthandler
- an I/O handler to invoke for the given conditionprotocols
- sub-protocol to use in websocket handshake signatureHttpServerRoutes
default HttpServerRoutes ws(java.util.function.Predicate<? super HttpServerRequest> condition, java.util.function.BiFunction<? super WebsocketInbound,? super WebsocketOutbound,? extends Publisher<Void>> handler, @Nullable String protocols, int maxFramePayloadLength)
condition
- a predicate given each inbound requesthandler
- an I/O handler to invoke for the given conditionprotocols
- sub-protocol to use in webspcket handshake signaturemaxFramePayloadLength
- specifies a custom maximum allowable frame payload lengthHttpServerRoutes