Class QueryParametersRoutingLink<A,B,C extends QueryParametersRoute<A>,D extends QueryParametersRoute.Extractor<A,C,D>>
- Type Parameters:
A- the resource typeB- the input typeC- the query parameters route typeD- the query parameters route extractor type
A RoutingLink implementation resolving resources by matching query parameters in an input.
- Since:
- 1.12
- Author:
- Jeremy Kuhn
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class io.inverno.mod.http.base.router.RoutingLink
RoutingLink.ChainBuilder<A,B, C extends Route<A>, D extends RouteExtractor<A, C>> -
Constructor Summary
ConstructorsConstructorDescriptionCreates a terminal query parameters routing link.QueryParametersRoutingLink(Supplier<RoutingLink<A, B, C, D>> nextLinkFactory) Creates a query parameters routing link in a routing chain. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanDetermines whether the link can link the specified route.protected voidextractLinks(D routeExtractor) Populates the specified route extractor with the criteria managed by the link.protected RoutingLink<A, B, C, D> Returns the next link in the routing chain that is matching the specified route.protected Collection<RoutingLink<A, B, C, D>> getLinks()Returns all links bound to the link.protected RoutingLink<A, B, C, D> getOrSetLink(C route) Returns or sets the next link in the routing chain that is matching the specified route.protected abstract QueryParametersgetQueryParameters(B input) Extracts the query parameters from the input.protected voidRefreshes enabled links.protected voidremoveLink(C route) Removes the link matching the specified route.resolveAllLink(B input) Resolves all links matching the specified input.protected RoutingLink<A, B, C, D> resolveLink(B input) Resolves the link best matching the specified input.Methods inherited from class io.inverno.mod.http.base.router.RoutingLink
bestMatchingRoutingLink, createLink, currentOrErrorRoutingLink, disableRoute, enableRoute, extractRoutes, isEnabled, link, removeRoute, resolve, resolveAll, setRoute
-
Constructor Details
-
QueryParametersRoutingLink
public QueryParametersRoutingLink()Creates a terminal query parameters routing link.
-
QueryParametersRoutingLink
Creates a query parameters routing link in a routing chain.
- Parameters:
nextLinkFactory- the next routing link factory
-
-
Method Details
-
getQueryParameters
Extracts the query parameters from the input.
- Parameters:
input- an input- Returns:
- query parameters
-
canLink
Description copied from class:RoutingLinkDetermines whether the link can link the specified route.
A route is linkable by a link when it defines a criteria handled by the link so basically when the link is able to route an input based on that particular criteria (e.g. a path, an HTTP method...).
- Specified by:
canLinkin classRoutingLink<A,B, C extends QueryParametersRoute<A>, D extends QueryParametersRoute.Extractor<A, C, D>> - Parameters:
route- a route- Returns:
- true if the link can
-
getLink
Description copied from class:RoutingLinkReturns the next link in the routing chain that is matching the specified route.
- Specified by:
getLinkin classRoutingLink<A,B, C extends QueryParametersRoute<A>, D extends QueryParametersRoute.Extractor<A, C, D>> - Parameters:
route- a route- Returns:
- the next routing link in the routing chain or null if there is no link matching the route
-
getOrSetLink
Description copied from class:RoutingLinkReturns or sets the next link in the routing chain that is matching the specified route.
If there is no link matching the route, a new link shall be created and set in the routing chain.
- Specified by:
getOrSetLinkin classRoutingLink<A,B, C extends QueryParametersRoute<A>, D extends QueryParametersRoute.Extractor<A, C, D>> - Parameters:
route- a route- Returns:
- the next routing link in the routing chain
-
getLinks
Description copied from class:RoutingLinkReturns all links bound to the link.
- Specified by:
getLinksin classRoutingLink<A,B, C extends QueryParametersRoute<A>, D extends QueryParametersRoute.Extractor<A, C, D>> - Returns:
- the list of links bound to the link
-
removeLink
Description copied from class:RoutingLinkRemoves the link matching the specified route.
- Specified by:
removeLinkin classRoutingLink<A,B, C extends QueryParametersRoute<A>, D extends QueryParametersRoute.Extractor<A, C, D>> - Parameters:
route- a route
-
refreshEnabled
protected void refreshEnabled()Description copied from class:RoutingLinkRefreshes enabled links.
This method is invoked after a change in the routing chain in order to optimize the resource resolution process by identifying disabled links as close as possible from the beginning of the chain.
- Specified by:
refreshEnabledin classRoutingLink<A,B, C extends QueryParametersRoute<A>, D extends QueryParametersRoute.Extractor<A, C, D>>
-
extractLinks
Description copied from class:RoutingLinkPopulates the specified route extractor with the criteria managed by the link.
This basically comes down to extracting the links managed by the link.
- Specified by:
extractLinksin classRoutingLink<A,B, C extends QueryParametersRoute<A>, D extends QueryParametersRoute.Extractor<A, C, D>> - Parameters:
routeExtractor- a route extractor
-
resolveLink
Description copied from class:RoutingLinkResolves the link best matching the specified input.
The link is resolved by comparing the criteria coming from the routes to the criteria defined in the input.
- Specified by:
resolveLinkin classRoutingLink<A,B, C extends QueryParametersRoute<A>, D extends QueryParametersRoute.Extractor<A, C, D>> - Parameters:
input- an input- Returns:
- the matching link or null if no route matching the input was defined in the link
-
resolveAllLink
Description copied from class:RoutingLinkResolves all links matching the specified input.
Links are resolved by comparing the criteria coming from the routes to the criteria defined in the input.
- Specified by:
resolveAllLinkin classRoutingLink<A,B, C extends QueryParametersRoute<A>, D extends QueryParametersRoute.Extractor<A, C, D>> - Parameters:
input- an input- Returns:
- a list of links sorted from the best matching to the least matching or an empty list if no route matching the input was defined in the link
-