Class CollectionArchiveResource
java.lang.Object
io.goobi.viewer.api.rest.v1.collections.CollectionArchiveResource
@Path("/collections/{field}/{collection}/archive")
public class CollectionArchiveResource
extends Object
REST resource exposing the pre-generated per-collection BagIt archive for download. Both endpoints are restricted to logged-in users (or
a valid bearer token) via
UserLoggedInBinding. The bag's payload is filtered at generation time against anonymous access
rights — per file for images/ALTO/plaintext and per whole record for the METS/LIDO source and TEI — so restricted pages and works are
excluded from the archive (see CollectionArchiveService). Access is not, and cannot be, re-checked per downloading user at this
endpoint, which is why only anonymously-accessible content is ever packed.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionStreams the collection's pre-generated BagIt archive as a ZIP download.Returns metadata about the collection's archive: whether one exists, its size, its record count and the newest indexing date among its records.
-
Constructor Details
-
CollectionArchiveResource
public CollectionArchiveResource(@PathParam("field") String field, @PathParam("collection") String collection)
-
-
Method Details
-
getArchiveInfo
Returns metadata about the collection's archive: whether one exists, its size, its record count and the newest indexing date among its records.The recordCount, sizeBytes and generatedMillis fields are present only when an archive has already been generated for the collection; otherwise the response reports available as false with no further detail. generatedMillis is the newest indexing date among the archived records, not the time the archive file itself was written. A field that is not configured for archiving results in a bad-request error.
- Returns:
- a map with the collection's field name, collection name, availability flag and, when an archive already exists, its record count, size in bytes and the newest indexing date among the archived records
- Throws:
IOException- on filesystem error
-
downloadArchive
@GET @Path("/download") public Response downloadArchive() throws IOException, de.unigoettingen.sub.commons.contentlib.exceptions.ContentNotFoundExceptionStreams the collection's pre-generated BagIt archive as a ZIP download.The archive is served only if it was already generated for the collection and its resolved path lies within the configured storage base; either condition failing is reported the same way as no archive existing at all. A field that is not configured for archiving results in a bad-request error.
- Returns:
- a streaming ZIP response
- Throws:
IOException- on filesystem errorde.unigoettingen.sub.commons.contentlib.exceptions.ContentNotFoundException- if no archive exists for the collection
-