Class Route
- java.lang.Object
-
- org.logdoc.fairhttp.service.api.helpers.Route
-
public class Route extends Object
- Author:
- Denis Danilin | me@loslobos.ru 01.03.2023 14:27 FairHttpService ☭ sweat and blood
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRoute.Method
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Routeasync(String method, String endpoint, BiFunction<Request,Map<String,String>,CompletionStage<Response>> callback)static Routeasync(Route.Method method, String endpoint, BiFunction<Request,Map<String,String>,CompletionStage<Response>> callback)RoutebreakIf(BiFunction<Request,Map<String,String>,Boolean> breakIfPredicate, Response breakWithResponse)Adds condition with when successfully applied may interrupt request with given response, before any call is made to business logicbooleanshouldBreak(Request request, Map<String,String> pathMap)static Routesync(String method, String endpoint, BiFunction<Request,Map<String,String>,Response> callback)static Routesync(Route.Method method, String endpoint, BiFunction<Request,Map<String,String>,Response> callback)
-
-
-
Method Detail
-
async
public static Route async(String method, String endpoint, BiFunction<Request,Map<String,String>,CompletionStage<Response>> callback)
- Parameters:
method- HTTP method (GET, POST, PUT, etc)endpoint- Fully qualified endpoint. If its patterned - it must be Java RegEx synthax compliant and groups must be correctly mappable to callback argumentscallback- invocation of request with mapped path variables by names given in pathVarsNames
-
sync
public static Route sync(String method, String endpoint, BiFunction<Request,Map<String,String>,Response> callback)
- Parameters:
method- HTTP method (GET, POST, PUT, etc)endpoint- Fully qualified endpoint. If its patterned - it must be Java RegEx synthax compliant and groups must be correctly mappable to callback argumentscallback- invocation of request with mapped path variables by names given in pathVarsNames
-
async
public static Route async(Route.Method method, String endpoint, BiFunction<Request,Map<String,String>,CompletionStage<Response>> callback)
- Parameters:
method- HTTP method (GET, POST, PUT, etc)endpoint- Fully qualified endpoint. If its patterned - it must be Java RegEx synthax compliant and groups must be correctly mappable to callback argumentscallback- invocation of request with mapped path variables by names given in pathVarsNames
-
sync
public static Route sync(Route.Method method, String endpoint, BiFunction<Request,Map<String,String>,Response> callback)
- Parameters:
method- HTTP method (GET, POST, PUT, etc)endpoint- Fully qualified endpoint. If its patterned - it must be Java RegEx synthax compliant and groups must be correctly mappable to callback argumentscallback- invocation of request with mapped path variables by names given in pathVarsNames
-
breakIf
public Route breakIf(BiFunction<Request,Map<String,String>,Boolean> breakIfPredicate, Response breakWithResponse)
Adds condition with when successfully applied may interrupt request with given response, before any call is made to business logic- Parameters:
breakIfPredicate- predicate to be appliedbreakWithResponse- response to be used if condition is true- Returns:
- route itself
-
-