-
- All Implemented Interfaces:
-
org.readium.r2.shared.publication.Publication.Service,org.readium.r2.shared.publication.services.CoverService,org.readium.r2.shared.util.Closeable
public abstract class GeneratedCoverService implements CoverService
A CoverService which provides a unique cover for each Publication.
-
-
Constructor Summary
Constructors Constructor Description GeneratedCoverService()
-
Method Summary
Modifier and Type Method Description List<Link>getLinks()Links which will be added to Publication.links. abstract Bitmapcover()Returns the publication cover as a Bitmap at its maximum size. Resourceget(Link link)A service can return a Resource to: respond to a request to its web API declared in links,
serve additional resources on behalf of the publication,
replace a publication resource by its own version.
-
Methods inherited from class org.readium.r2.shared.publication.services.CoverService
coverFitting -
Methods inherited from class org.readium.r2.shared.publication.Publication.Service
close -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getLinks
List<Link> getLinks()
Links which will be added to Publication.links. It can be used to expose a web API for the service, through Publication.get.
To disambiguate the href with a publication's local resources, you should use the prefix
/~readium/. A custom media type or rel should be used to identify the service.You can use a templated URI to accept query parameters, e.g.:
Link( href = "/~readium/search{?text}", type = "application/vnd.readium.search+json", templated = true )
-
cover
abstract Bitmap cover()
Returns the publication cover as a Bitmap at its maximum size.
If the cover is not a bitmap format (e.g. SVG), it should be scaled down to fit the screen.
-
get
Resource get(Link link)
A service can return a Resource to:
respond to a request to its web API declared in links,
serve additional resources on behalf of the publication,
replace a publication resource by its own version.
Called by Publication.get for each request.
Warning: If you need to request one of the publication resources to answer the request, use the Fetcher provided by the Publication.Service.Context instead of Publication.get, otherwise it will trigger an infinite loop.
-
-
-