Class RecordFilesResource

java.lang.Object
io.goobi.viewer.api.rest.v2.records.RecordFilesResource

@Path("/records/{pi}/files") public class RecordFilesResource extends Object
Author:
Florian Alpers
  • Constructor Details

  • Method Details

    • getAlto

      @GET @Path("/alto/{filename}") @Produces("text/xml") public String getAlto(@PathParam("filename") String filename) throws PresentationException, IndexUnreachableException, de.unigoettingen.sub.commons.contentlib.exceptions.ContentNotFoundException, de.unigoettingen.sub.commons.contentlib.exceptions.ServiceNotAllowedException
      Returns the ALTO document for a single page.

      The file is looked up first in the crowdsourced ALTO folder and, if not found there, in the record's regular ALTO folder, so corrections made through crowdsourcing take precedence over the originally indexed file. Access requires the fulltext view permission for the requested page.

      Parameters:
      filename - filename of the alto document
      Returns:
      the ALTO document as an XML string
      Throws:
      de.unigoettingen.sub.commons.contentlib.exceptions.ServiceNotAllowedException - if the fulltext view permission is not granted
      de.unigoettingen.sub.commons.contentlib.exceptions.ContentNotFoundException - if no ALTO file exists for the given filename
      PresentationException
      IndexUnreachableException
    • getPlaintext

      @GET @Path("/plaintext/{filename}") @Produces("text/plain") public String getPlaintext(@PathParam("filename") String filename) throws de.unigoettingen.sub.commons.contentlib.exceptions.ContentNotFoundException, PresentationException, IndexUnreachableException, de.unigoettingen.sub.commons.contentlib.exceptions.ServiceNotAllowedException
      Returns the plain text content of a single page.

      The text is looked up first in the crowdsourced plaintext folder and then in the regular plaintext folder; if neither contains a matching file, the page's ALTO file is converted to plain text on the fly instead. Access requires the fulltext view permission for the requested page.

      Parameters:
      filename - filename containing the text
      Returns:
      the plain text content of the page
      Throws:
      de.unigoettingen.sub.commons.contentlib.exceptions.ServiceNotAllowedException - if the fulltext view permission is not granted
      de.unigoettingen.sub.commons.contentlib.exceptions.ContentNotFoundException - if no plaintext or ALTO file exists for the filename
      PresentationException
      IndexUnreachableException
    • getTEI

      @GET @Path("/tei/{filename}") @Produces("text/xml") public String getTEI(@PathParam("filename") String filename) throws PresentationException, IndexUnreachableException, de.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException
      Returns the fulltext of a single page converted to TEI format.

      The plain text of the page (falling back to a converted ALTO file, as for the plaintext endpoint) is wrapped in a generated TEI header built from the record's indexed metadata. Access requires the fulltext view permission for the requested page.

      Parameters:
      filename - filename containing the text
      Returns:
      the page fulltext as a TEI XML document
      Throws:
      de.unigoettingen.sub.commons.contentlib.exceptions.ServiceNotAllowedException - if the fulltext view permission is not granted
      de.unigoettingen.sub.commons.contentlib.exceptions.ContentNotFoundException - if no record is found for the given identifier, or if no plaintext or ALTO file exists for the filename
      PresentationException
      IndexUnreachableException
      de.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException
    • getSourceFile

      @GET @Path("/source/{filename}") @Produces("application/octet-stream") public Response getSourceFile(@PathParam("filename") String filename) throws de.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException, PresentationException, IndexUnreachableException, DAOException
      Returns a source metadata file (e.g. METS/LIDO) of the record.

      The requested filename is sanitized to strip any path components and restricted to letters, digits, spaces and the characters . , - _ ! ( ) ' before being resolved beneath the record's configured source folder; any other name is rejected. Rejection happens as an IllegalArgumentException that is neither caught here nor mapped, so the caller sees an undeclared 500 rather than the 400 the v1 endpoint returns. The content type is determined from the file name; if it cannot be determined, the response falls back to the declared octet stream type. Access requires the download-original-content privilege for the record.

      Parameters:
      filename - source file name
      Returns:
      the source file content as a binary stream
      Throws:
      de.unigoettingen.sub.commons.contentlib.exceptions.ContentNotFoundException - if no such file exists
      de.unigoettingen.sub.commons.contentlib.exceptions.ServiceNotAllowedException - if the download-original-content privilege is not granted
      de.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException
      PresentationException
      IndexUnreachableException
      DAOException
    • getCMDI

      @GET @Path("/cmdi/{filename}") public String getCMDI(@PathParam("filename") String filename, @QueryParam("lang") String lang) throws de.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException, PresentationException, IndexUnreachableException, IOException
      Returns the CMDI metadata document for a record file.

      The requested language defaults to the current user's locale if not given. The record's CMDI folder is searched for a file whose name matches "_<isoCode>.xml" for that language's ISO-3 code, falling back to the ISO-2 code if no ISO-3 match exists. Access requires the fulltext view permission for the given filename.

      Parameters:
      filename - image file name for cmdi
      lang - language for CMDI
      Returns:
      the CMDI document as an XML string
      Throws:
      de.unigoettingen.sub.commons.contentlib.exceptions.ServiceNotAllowedException - if the fulltext view permission is not granted
      de.unigoettingen.sub.commons.contentlib.exceptions.ContentNotFoundException - if no matching CMDI file exists
      de.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException
      PresentationException
      IndexUnreachableException
      IOException