-
- All Implemented Interfaces:
-
org.readium.r2.shared.fetcher.Fetcher,org.readium.r2.shared.util.SuspendingCloseable
public final class RoutingFetcher implements Fetcher
Routes requests to child fetchers, depending on a provided predicate.
This can be used for example to serve a publication containing both local and remote resources, and more generally to concatenate different content sources.
The routes will be tested in the given order.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classRoutingFetcher.RouteHolds a child fetcher and the predicate used to determine if it can answer a request.
The default value for accepts means that the fetcher will accept any link.
-
Constructor Summary
Constructors Constructor Description RoutingFetcher(Fetcher local, Fetcher remote)RoutingFetcher(List<RoutingFetcher.Route> routes)
-
Method Summary
Modifier and Type Method Description List<Link>links()Known resources available in the medium, such as file paths on the file system or entries in a ZIP archive. Resourceget(Link link)Returns the Resource at the given link's HREF. Unitclose()Closes this object and releases any resources associated with it. -
-
Constructor Detail
-
RoutingFetcher
RoutingFetcher(List<RoutingFetcher.Route> routes)
-
-
Method Detail
-
links
List<Link> links()
Known resources available in the medium, such as file paths on the file system or entries in a ZIP archive. This list is not exhaustive, and additional unknown resources might be reachable.
If the medium has an inherent resource order, it should be followed. Otherwise, HREFs are sorted alphabetically.
-
-
-
-