get method
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 PublicationServiceContext
instead of
Publication.get
, otherwise it will trigger an infinite loop.
@return The Resource
containing the response, or null if the service doesn't recognize
this request.
Implementation
@override
Resource? get(Link link) {
RouteHandler? route = RouteHandler.route(link);
if (route == null) {
return null;
}
return route.handleRequest(link, this);
}