Interface HttpRules
- All Known Subinterfaces:
HttpRouting.Builder
HttpRouting.Builder
and by HttpService.routing(HttpRules).-
Method Summary
Modifier and TypeMethodDescriptiondefault HttpRulesAdd a route that executes on any HTTP method and any path.default HttpRulesAdd a route that executes on any HTTP method and any path.default HttpRulesAdd a delete route.default HttpRulesAdd a delete route.default HttpRulesAdd a get route.default HttpRulesAdd a get route.default HttpRulesAdd a head route.default HttpRulesAdd a head route.default HttpRulesAdd an options route.default HttpRulesAdd an options route.default HttpRulesAdd an options route.default HttpRulesAdd an options route.default HttpRulesAdd a post route.default HttpRulesAdd a post route.default HttpRulesAdd a put route.default HttpRulesAdd a put route.register(HttpService... service) Register a service on the current path.register(String pathPattern, HttpService... service) Register a service on sub-path of the current path.default HttpRulesregister(String pathPattern, Supplier<? extends HttpService> service) Register a service on sub-path of the current path.default HttpRulesregister(String pathPattern, Supplier<? extends HttpService> service1, Supplier<? extends HttpService> service2) Register two services on sub-path of the current path.default HttpRulesregister(String pathPattern, Supplier<? extends HttpService> service1, Supplier<? extends HttpService> service2, Supplier<? extends HttpService> service3) Register three services on sub-path of the current path.default HttpRulesregister(String pathPattern, Supplier<? extends HttpService> service1, Supplier<? extends HttpService> service2, Supplier<? extends HttpService> service3, Supplier<? extends HttpService> service4) Register four services on sub-path of the current path.default HttpRulesregister(String pathPattern, Supplier<? extends HttpService> service1, Supplier<? extends HttpService> service2, Supplier<? extends HttpService> service3, Supplier<? extends HttpService> service4, Supplier<? extends HttpService> service5) Register five services on sub-path of the current path.default HttpRulesregister(String pathPattern, List<Supplier<? extends HttpService>> services) Register services on sub-path of the current path.default HttpRulesregister(Supplier<? extends HttpService> service) Register a service on the current path.default HttpRulesregister(Supplier<? extends HttpService> service1, Supplier<? extends HttpService> service2) Register two services on the current path.default HttpRulesregister(Supplier<? extends HttpService> service1, Supplier<? extends HttpService> service2, Supplier<? extends HttpService> service3) Register three services on the current path.default HttpRulesregister(Supplier<? extends HttpService> service1, Supplier<? extends HttpService> service2, Supplier<? extends HttpService> service3, Supplier<? extends HttpService> service4) Register four services on the current path.default HttpRulesregister(Supplier<? extends HttpService> service1, Supplier<? extends HttpService> service2, Supplier<? extends HttpService> service3, Supplier<? extends HttpService> service4, Supplier<? extends HttpService> service5) Register five services on the current path.default HttpRulesregister(List<Supplier<? extends HttpService>> services) Register services on the current path.default HttpRulesregisterLocator(HttpServiceLocator locator) Register a service locator on the current path.default HttpRulesregisterLocator(String pathPattern, HttpServiceLocator locator) Register a service locator on sub-path of the current path.default HttpRulesroute(Method method, PathMatcher pathMatcher, Handler handler) Add a route.default HttpRulesAdd a route.default HttpRulesAdd a route.default HttpRulesroute(Method method, String pathPattern, Consumer<ServerRequest> handler) Add a route.default HttpRulesroute(Method method, String pathPattern, Function<ServerRequest, ?> handler) Add a route.default HttpRulesAdd a route.Add a route.default HttpRulesroute(Predicate<Method> methodPredicate, PathMatcher pathMatcher, Handler handler) Add a route.default HttpRulesAdd a route.default HttpRulesAdd an options route.default HttpRulesAdd an options route.
-
Method Details
-
register
Register a service on the current path.- Parameters:
service- service to register- Returns:
- updated rules
-
registerLocator
Register a service locator on the current path.Unlike
register(Supplier), the locator is invoked at request time after the current path matches. If the locator returnsOptional.empty(), routing continues with the next available route. Located services are cached by service instance identity up toHttpServiceLocator.maxServiceCacheSize().- Parameters:
locator- service locator to register- Returns:
- updated rules
- Throws:
UnsupportedOperationException- if this implementation does not support service locator registration
-
register
Register a service on the current path.The supplier is invoked when the service is registered, not for each request.
- Parameters:
service- service to register- Returns:
- updated rules
-
register
default HttpRules register(Supplier<? extends HttpService> service1, Supplier<? extends HttpService> service2) Register two services on the current path.- Parameters:
service1- first service to registerservice2- second service to register- Returns:
- updated rules
-
register
default HttpRules register(Supplier<? extends HttpService> service1, Supplier<? extends HttpService> service2, Supplier<? extends HttpService> service3) Register three services on the current path.- Parameters:
service1- first service to registerservice2- second service to registerservice3- third service to register- Returns:
- updated rules
-
register
default HttpRules register(Supplier<? extends HttpService> service1, Supplier<? extends HttpService> service2, Supplier<? extends HttpService> service3, Supplier<? extends HttpService> service4) Register four services on the current path.- Parameters:
service1- first service to registerservice2- second service to registerservice3- third service to registerservice4- fourth service to register- Returns:
- updated rules
-
register
default HttpRules register(Supplier<? extends HttpService> service1, Supplier<? extends HttpService> service2, Supplier<? extends HttpService> service3, Supplier<? extends HttpService> service4, Supplier<? extends HttpService> service5) Register five services on the current path.- Parameters:
service1- first service to registerservice2- second service to registerservice3- third service to registerservice4- fourth service to registerservice5- fifth service to register- Returns:
- updated rules
-
register
Register services on the current path.- Parameters:
services- services to register- Returns:
- updated rules
-
register
Register a service on sub-path of the current path.- Parameters:
pathPattern- URI path patternservice- service to register- Returns:
- updated rules
-
registerLocator
Register a service locator on sub-path of the current path.Unlike
register(String, Supplier), the locator is invoked at request time after the provided path pattern matches. Path parameters from the matched pattern are available fromServerRequest.path()before the locator is invoked. If the locator returnsOptional.empty(), routing continues with the next available route. Located services are cached by service instance identity up toHttpServiceLocator.maxServiceCacheSize().- Parameters:
pathPattern- URI path patternlocator- service locator to register- Returns:
- updated rules
- Throws:
UnsupportedOperationException- if this implementation does not support service locator registration
-
register
Register a service on sub-path of the current path.The supplier is invoked when the service is registered, not for each request.
- Parameters:
pathPattern- URI path patternservice- service to register- Returns:
- updated rules
-
register
default HttpRules register(String pathPattern, Supplier<? extends HttpService> service1, Supplier<? extends HttpService> service2) Register two services on sub-path of the current path.- Parameters:
pathPattern- URI path patternservice1- first service to registerservice2- second service to register- Returns:
- updated rules
-
register
default HttpRules register(String pathPattern, Supplier<? extends HttpService> service1, Supplier<? extends HttpService> service2, Supplier<? extends HttpService> service3) Register three services on sub-path of the current path.- Parameters:
pathPattern- URI path patternservice1- first service to registerservice2- second service to registerservice3- third service to register- Returns:
- updated rules
-
register
default HttpRules register(String pathPattern, Supplier<? extends HttpService> service1, Supplier<? extends HttpService> service2, Supplier<? extends HttpService> service3, Supplier<? extends HttpService> service4) Register four services on sub-path of the current path.- Parameters:
pathPattern- URI path patternservice1- first service to registerservice2- second service to registerservice3- third service to registerservice4- fourth service to register- Returns:
- updated rules
-
register
default HttpRules register(String pathPattern, Supplier<? extends HttpService> service1, Supplier<? extends HttpService> service2, Supplier<? extends HttpService> service3, Supplier<? extends HttpService> service4, Supplier<? extends HttpService> service5) Register five services on sub-path of the current path.- Parameters:
pathPattern- URI path patternservice1- first service to registerservice2- second service to registerservice3- third service to registerservice4- fourth service to registerservice5- fifth service to register- Returns:
- updated rules
-
register
Register services on sub-path of the current path.- Parameters:
pathPattern- URI path patternservices- services to register- Returns:
- updated rules
-
route
-
route
-
route
-
route
Add a route.- Parameters:
method- HTTP method to handlepathMatcher- URI path matcher, seePathMatchers.create(String)handler- handler to process HTTP request- Returns:
- updated rules
-
route
default HttpRules route(Predicate<Method> methodPredicate, PathMatcher pathMatcher, Handler handler) Add a route.- Parameters:
methodPredicate- HTTP method predicate, seeMethod.predicate(io.helidon.http.Method...)pathMatcher- URI path matcher, seePathMatchers.create(String)handler- handler to process HTTP request- Returns:
- updated rules
-
route
-
get
-
get
-
post
-
post
-
put
-
put
-
delete
-
delete
-
head
-
head
-
options
-
options
-
trace
-
trace
-
patch
-
patch
-
any
-
any
-
route
Add a route.- Parameters:
method- HTTP method to handlepathPattern- URI path patternhandler- handler as a consumer ofServerRequest- Returns:
- updated builder
-
route
Add a route.- Parameters:
method- HTTP method to handlepathPattern- URI path patternhandler- handler as a function that getsServerRequestand returns an entity- Returns:
- updated builder
-
route
-