java.lang.Object
io.helidon.webserver.RequestPredicate.ConditionalHandler
- All Implemented Interfaces:
Handler
,BiConsumer<ServerRequest,
ServerResponse>
- Enclosing class:
- RequestPredicate
A
Handler
that conditionally delegates to other Handler
instances based on a RequestPredicate
.
There can be at most 2 handlers: a required one for matched requests and
an optional one for requests that are not matched. If the handler for non
matched requests is not provided, such request will return a 404
response.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.helidon.webserver.Handler
Handler.EntityHandler<T>
-
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(ServerRequest req, ServerResponse res) Set theHandler
to use when the predicate does not match the request.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.function.BiConsumer
andThen
-
Method Details
-
accept
Description copied from interface:Handler
- Specified by:
accept
in interfaceBiConsumer<ServerRequest,
ServerResponse> - Specified by:
accept
in interfaceHandler
- Parameters:
req
- an HTTP server request.res
- an HTTP server response.
-
otherwise
Set theHandler
to use when the predicate does not match the request.- Parameters:
handler
- handler to use when the predicate does not match- Returns:
- created
Handler
-