use of org.mycore.iiif.presentation.MCRIIIFPresentationManifestQuickAccess in project mycore by MyCoRe-Org.
the class MCRIIIFPresentationResource method getManifestQuickAccess.
protected MCRIIIFPresentationManifestQuickAccess getManifestQuickAccess(String impl, String identifier) {
MCRIIIFPresentationManifestQuickAccess quickAccess;
if ((quickAccess = cache.getIfUpToDate(impl + identifier, TimeUnit.HOURS.toMillis(1))) == null) {
long startTime = new Date().getTime();
MCRIIIFManifest manifest = MCRIIIFPresentationImpl.getInstance(impl).getManifest(identifier);
long endTime = new Date().getTime();
long timeNeeded = endTime - startTime;
LOGGER.info("Manifest {}:{} generation needed: {}ms", impl, identifier, timeNeeded);
quickAccess = new MCRIIIFPresentationManifestQuickAccess(manifest);
cache.put(impl + identifier, quickAccess);
correctIDs(manifest, impl, identifier);
} else {
LOGGER.info("Manifest {}:{} served from cache", impl, identifier);
}
return quickAccess;
}
use of org.mycore.iiif.presentation.MCRIIIFPresentationManifestQuickAccess in project mycore by MyCoRe-Org.
the class MCRIIIFPresentationResource method getManifest.
@GET
@Produces(MCRIIIFMediaType.APPLICATION_LD_JSON)
@Path("{" + IDENTIFIER_PARAM + "}/manifest")
public Response getManifest(@PathParam(IMPL_PARAM) String impl, @PathParam(IDENTIFIER_PARAM) String identifier) throws CloneNotSupportedException {
MCRIIIFPresentationManifestQuickAccess quickAccess = getManifestQuickAccess(impl, identifier);
String manifestAsJSON = getGson().toJson(quickAccess.getManifest());
return addHeaders(Response.ok()).entity(manifestAsJSON).build();
}
use of org.mycore.iiif.presentation.MCRIIIFPresentationManifestQuickAccess in project mycore by MyCoRe-Org.
the class MCRIIIFPresentationResource method getAnnotation.
@GET
@Produces(MCRIIIFMediaType.APPLICATION_LD_JSON)
@Path("{" + IDENTIFIER_PARAM + "}/annotation/{" + NAME_PARAM + "}")
public Response getAnnotation(@PathParam(IMPL_PARAM) String impl, @PathParam(IDENTIFIER_PARAM) String identifier, @PathParam(NAME_PARAM) String name) {
MCRIIIFPresentationManifestQuickAccess quickAccess = getManifestQuickAccess(impl, identifier);
String annotationAsJSON = getGson().toJson(quickAccess.getAnnotationBase(name));
return addHeaders(Response.ok()).entity(annotationAsJSON).build();
}
use of org.mycore.iiif.presentation.MCRIIIFPresentationManifestQuickAccess in project mycore by MyCoRe-Org.
the class MCRIIIFPresentationResource method getSequence.
@GET
@Produces(MCRIIIFMediaType.APPLICATION_LD_JSON)
@Path("{" + IDENTIFIER_PARAM + "}/sequence/{" + NAME_PARAM + "}")
public Response getSequence(@PathParam(IMPL_PARAM) String impl, @PathParam(IDENTIFIER_PARAM) String identifier, @PathParam(NAME_PARAM) String name) {
MCRIIIFPresentationManifestQuickAccess quickAccess = getManifestQuickAccess(impl, identifier);
String sequenceAsJSON = getGson().toJson(quickAccess.getSequence(name));
return addHeaders(Response.ok()).entity(sequenceAsJSON).build();
}
use of org.mycore.iiif.presentation.MCRIIIFPresentationManifestQuickAccess in project mycore by MyCoRe-Org.
the class MCRIIIFPresentationResource method getCanvas.
@GET
@Produces(MCRIIIFMediaType.APPLICATION_LD_JSON)
@Path("{" + IDENTIFIER_PARAM + "}/canvas/{" + NAME_PARAM + "}")
public Response getCanvas(@PathParam(IMPL_PARAM) String impl, @PathParam(IDENTIFIER_PARAM) String identifier, @PathParam(NAME_PARAM) String name) {
MCRIIIFPresentationManifestQuickAccess quickAccess = getManifestQuickAccess(impl, identifier);
String canvasAsJSON = getGson().toJson(quickAccess.getCanvas(name));
return addHeaders(Response.ok()).entity(canvasAsJSON).build();
}
Aggregations