Class MetadataResource
java.lang.Object
org.apache.tika.server.core.resource.MetadataResource
- Direct Known Subclasses:
XMPMetadataResource
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.ResponsegetMetadata(InputStream is, jakarta.ws.rs.core.HttpHeaders httpHeaders, jakarta.ws.rs.core.UriInfo info) jakarta.ws.rs.core.ResponsegetMetadataField(InputStream is, jakarta.ws.rs.core.HttpHeaders httpHeaders, jakarta.ws.rs.core.UriInfo info, String field) Get a specific metadata field.jakarta.ws.rs.core.ResponsegetMetadataFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, jakarta.ws.rs.core.UriInfo info) jakarta.ws.rs.core.ResponsegetMetadataWithConfig(List<org.apache.cxf.jaxrs.ext.multipart.Attachment> attachments, jakarta.ws.rs.core.HttpHeaders httpHeaders, jakarta.ws.rs.core.UriInfo info) Multipart endpoint with per-request ParseContext configuration.protected MetadataparseMetadata(TikaInputStream tis, Metadata metadata, jakarta.ws.rs.core.MultivaluedMap<String, String> httpHeaders, jakarta.ws.rs.core.UriInfo info)
-
Constructor Details
-
MetadataResource
public MetadataResource()
-
-
Method Details
-
getMetadataFromMultipart
@POST @Consumes("multipart/form-data") @Produces({"text/csv","application/json"}) @Path("form") public jakarta.ws.rs.core.Response getMetadataFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, @Context jakarta.ws.rs.core.UriInfo info) throws Exception - Throws:
Exception
-
getMetadataWithConfig
@POST @Consumes("multipart/form-data") @Produces({"text/csv","application/json"}) @Path("config") public jakarta.ws.rs.core.Response getMetadataWithConfig(List<org.apache.cxf.jaxrs.ext.multipart.Attachment> attachments, @Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @Context jakarta.ws.rs.core.UriInfo info) throws Exception Multipart endpoint with per-request ParseContext configuration. Accepts two parts: "file" (the document) and "config" (JSON configuration with parseContext).- Throws:
Exception
-
getMetadata
@PUT @Produces({"text/csv","application/json"}) public jakarta.ws.rs.core.Response getMetadata(InputStream is, @Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @Context jakarta.ws.rs.core.UriInfo info) throws Exception - Throws:
Exception
-
getMetadataField
@PUT @Path("{field}") @Produces({"text/csv","application/json","text/plain"}) public jakarta.ws.rs.core.Response getMetadataField(InputStream is, @Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @Context jakarta.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 ajavax.ws.rs.core.Response.Status#BAD_REQUESTis generated. If the stream was successfully parsed but the specific metadata field was not found, then ajavax.ws.rs.core.Response.Status#NOT_FOUNDis 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- inputstreamhttpHeaders- httpheadersinfo- infofield- the tika metadata field name- Returns:
- one of
javax.ws.rs.core.Response.Status#OK,javax.ws.rs.core.Response.Status#NOT_FOUND, orjavax.ws.rs.core.Response.Status#BAD_REQUEST - Throws:
Exception
-
parseMetadata
protected Metadata parseMetadata(TikaInputStream tis, Metadata metadata, jakarta.ws.rs.core.MultivaluedMap<String, String> httpHeaders, jakarta.ws.rs.core.UriInfo info) throws IOException, TikaConfigException- Throws:
IOExceptionTikaConfigException
-