@Test public void and(){ final RoutingChecker checker = new RoutingChecker(); Routing routing = Routing.builder() .get("/and", RequestPredicate.create() .accepts(MediaType.TEXT_PLAIN) .and((req) -> req.headers().first("my-header").isPresent()) .thenApply((req, resp) -> { checker.handlerInvoked("hasAllConditions"); }).otherwise((req, res) -> { checker.handlerInvoked("doesNotHaveAllConditions"); })) .build(); routing.route(mockRequest("/and", Map.of("Accept", List.of("text/plain"), "my-header", List.of("abc"))), mockResponse()); assertThat(checker.handlersInvoked(), is("hasAllConditions")); checker.reset(); routing.route(mockRequest("/and", Map.of("Accept", List.of("text/plain"))), mockResponse()); assertThat(checker.handlersInvoked(), is("doesNotHaveAllConditions")); }
public RequestPredicate and(final Predicate<ServerRequest> predicate) { return nextCondition((exprVal, req) -> exprVal && predicate.test(req)); }
RequestPredicate { public RequestPredicate and(final Predicate<ServerRequest> predicate) { return nextCondition((exprVal, req) -> exprVal && predicate.test(req)); } }
RequestPredicate { public RequestPredicate and(final Predicate<ServerRequest> predicate) { return nextCondition((exprVal, req) -> exprVal && predicate.test(req)); } private  RequestPredicate(); private  RequestPredicate(final RequestPredicate first,
            final Condition cond); }
RequestPredicate { public RequestPredicate and(final Predicate<ServerRequest> predicate) { return nextCondition((exprVal, req) -> exprVal && predicate.test(req)); } private  RequestPredicate(); private  RequestPredicate(final RequestPredicate first,
            final Condition cond); ConditionalHandler thenApply(final Handler handler); boolean test(final ServerRequest request); RequestPredicate and(final Predicate<ServerRequest> predicate); RequestPredicate or(final Predicate<ServerRequest> predicate); RequestPredicate negate(); RequestPredicate isOfMethod(final String... methods); RequestPredicate isOfMethod(final Method... methods); RequestPredicate containsHeader(final String name); RequestPredicate containsHeader(final String name,
            final String value); RequestPredicate containsHeader(final String name,
            final Predicate<String> predicate); RequestPredicate containsQueryParameter(final String name); RequestPredicate containsQueryParameter(final String name,
            final String value); RequestPredicate containsQueryParameter(final String name,
            final Predicate<String> predicate); RequestPredicate containsCookie(final String name); RequestPredicate containsCookie(final String name,
            final String value); RequestPredicate containsCookie(final String name,
            final Predicate<String> predicate); RequestPredicate accepts(final String... contentType); RequestPredicate accepts(final MediaType... contentType); RequestPredicate hasContentType(final String... contentType); RequestPredicate hasContentType(final MediaType... contentType); static RequestPredicate create(); }
RequestPredicate { public RequestPredicate and(final Predicate<ServerRequest> predicate) { return nextCondition((exprVal, req) -> exprVal && predicate.test(req)); } private  RequestPredicate(); private  RequestPredicate(final RequestPredicate first,
            final Condition cond); ConditionalHandler thenApply(final Handler handler); boolean test(final ServerRequest request); RequestPredicate and(final Predicate<ServerRequest> predicate); RequestPredicate or(final Predicate<ServerRequest> predicate); RequestPredicate negate(); RequestPredicate isOfMethod(final String... methods); RequestPredicate isOfMethod(final Method... methods); RequestPredicate containsHeader(final String name); RequestPredicate containsHeader(final String name,
            final String value); RequestPredicate containsHeader(final String name,
            final Predicate<String> predicate); RequestPredicate containsQueryParameter(final String name); RequestPredicate containsQueryParameter(final String name,
            final String value); RequestPredicate containsQueryParameter(final String name,
            final Predicate<String> predicate); RequestPredicate containsCookie(final String name); RequestPredicate containsCookie(final String name,
            final String value); RequestPredicate containsCookie(final String name,
            final Predicate<String> predicate); RequestPredicate accepts(final String... contentType); RequestPredicate accepts(final MediaType... contentType); RequestPredicate hasContentType(final String... contentType); RequestPredicate hasContentType(final MediaType... contentType); static RequestPredicate create();  }