Package io.helidon.webserver
Class RequestPredicate.ConditionalHandler
- java.lang.Object
-
- io.helidon.webserver.RequestPredicate.ConditionalHandler
-
- All Implemented Interfaces:
Handler
,BiConsumer<ServerRequest,ServerResponse>
- Enclosing class:
- RequestPredicate
public static class RequestPredicate.ConditionalHandler extends Object implements Handler
AHandler
that conditionally delegates to otherHandler
instances based on aRequestPredicate
. 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 a404
response.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.helidon.webserver.Handler
Handler.EntityHandler<T>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(ServerRequest req, ServerResponse res)
Handler
otherwise(Handler handler)
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 Detail
-
accept
public void accept(ServerRequest req, ServerResponse res)
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.
-
-