def cancelRejections(classes: Class[_]*): Directive0 def cancelRejections(cancelFilter: Rejection ⇒ Boolean): Directive0
See also cancelRejection, for canceling a specific rejection.
Read Rejections to learn more about rejections.
For more advanced handling of rejections refer to the handleRejections directive which provides a nicer DSL for building rejection handlers.
import static akka.http.javadsl.server.Directives.cancelRejections; final Predicate<Rejection> isMethodRejection = p -> p instanceof MethodRejection; final Route route = cancelRejections( isMethodRejection, () -> post(() -> complete("Result")) ); // tests: runRouteUnSealed(route, HttpRequest.GET("/")) .assertRejections();