Package akka.http.javadsl.server
Class RejectionHandlerBuilder
- java.lang.Object
-
- akka.http.javadsl.server.RejectionHandlerBuilder
-
public class RejectionHandlerBuilder extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description RejectionHandlerBuilder(RejectionHandler.Builder asScala)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RejectionHandlerbuild()<T extends Rejection>
RejectionHandlerBuilderhandle(java.lang.Class<T> t, java.util.function.Function<T,Route> handler)Handles a singleRejectionwith the given function.<T extends Rejection>
RejectionHandlerBuilderhandleAll(java.lang.Class<T> t, java.util.function.Function<java.util.List<T>,Route> handler)Handles several Rejections of the same type at the same time.RejectionHandlerBuilderhandleCircuitBreakerOpenRejection(java.util.function.Function<CircuitBreakerOpenRejection,Route> handler)Convenience method for handling rejections created by created by the onCompleteWithBreaker directive.RejectionHandlerBuilderhandleNotFound(Route route)Handles the special "not found" case using the givenRoute.
-
-
-
Constructor Detail
-
RejectionHandlerBuilder
public RejectionHandlerBuilder(RejectionHandler.Builder asScala)
-
-
Method Detail
-
build
public RejectionHandler build()
-
handle
public <T extends Rejection> RejectionHandlerBuilder handle(java.lang.Class<T> t, java.util.function.Function<T,Route> handler)
Handles a singleRejectionwith the given function.- Parameters:
t- (undocumented)handler- (undocumented)- Returns:
- (undocumented)
-
handleAll
public <T extends Rejection> RejectionHandlerBuilder handleAll(java.lang.Class<T> t, java.util.function.Function<java.util.List<T>,Route> handler)
Handles several Rejections of the same type at the same time. The list passed to the given function is guaranteed to be non-empty.- Parameters:
t- (undocumented)handler- (undocumented)- Returns:
- (undocumented)
-
handleCircuitBreakerOpenRejection
public RejectionHandlerBuilder handleCircuitBreakerOpenRejection(java.util.function.Function<CircuitBreakerOpenRejection,Route> handler)
Convenience method for handling rejections created by created by the onCompleteWithBreaker directive. Signals that the request was rejected because the supplied circuit breaker is open and requests are failing fast.Use to customise the error response being written instead of the default
akka.http.javadsl.model.StatusCodes.SERVICE_UNAVAILABLEresponse.- Parameters:
handler- (undocumented)- Returns:
- (undocumented)
-
handleNotFound
public RejectionHandlerBuilder handleNotFound(Route route)
Handles the special "not found" case using the givenRoute.- Parameters:
route- (undocumented)- Returns:
- (undocumented)
-
-