Class MetadataResource

java.lang.Object
org.apache.tika.server.core.resource.MetadataResource
Direct Known Subclasses:
XMPMetadataResource

@Path("/meta") public class MetadataResource extends Object
  • Constructor Details

    • MetadataResource

      public MetadataResource()
  • Method Details

    • getMetadataFromMultipart

      @POST @Consumes("multipart/form-data") @Produces({"text/csv","application/json"}) @Path("form") public javax.ws.rs.core.Response getMetadataFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, @Context javax.ws.rs.core.UriInfo info) throws Exception
      Throws:
      Exception
    • getMetadata

      @PUT @Produces({"text/csv","application/json"}) public javax.ws.rs.core.Response getMetadata(InputStream is, @Context javax.ws.rs.core.HttpHeaders httpHeaders, @Context javax.ws.rs.core.UriInfo info) throws Exception
      Throws:
      Exception
    • getMetadataField

      @PUT @Path("{field}") @Produces({"text/csv","application/json","text/plain"}) public javax.ws.rs.core.Response getMetadataField(InputStream is, @Context javax.ws.rs.core.HttpHeaders httpHeaders, @Context javax.ws.rs.core.UriInfo info, @PathParam("field") String field) throws Exception
      Get a specific metadata field. If the input stream cannot be parsed, but a value was found for the given metadata field, then the value of the field is returned as part of a 200 OK response; otherwise a Response.Status.BAD_REQUEST is generated. If the stream was successfully parsed but the specific metadata field was not found, then a Response.Status.NOT_FOUND is returned.

      Note that this method handles multivalue fields and returns possibly more metadata value than requested.

      If you want XMP, you must be careful to specify the exact XMP key. For example, "Author" will return nothing, but "dc:creator" will return the correct value.

      Parameters:
      is - inputstream
      httpHeaders - httpheaders
      info - info
      field - the tika metadata field name
      Returns:
      one of Response.Status.OK, Response.Status.NOT_FOUND, or Response.Status.BAD_REQUEST
      Throws:
      Exception
    • parseMetadata

      protected Metadata parseMetadata(InputStream is, Metadata metadata, javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders, javax.ws.rs.core.UriInfo info) throws IOException
      Throws:
      IOException