Class RecursiveMetadataResource
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final BasicContentHandlerFactory.HANDLER_TYPEprotected static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.ResponsegetMetadata(InputStream is, jakarta.ws.rs.core.HttpHeaders httpHeaders, String handlerTypeName) Returns an InputStream that can be deserialized as a list ofMetadataobjects.jakarta.ws.rs.core.ResponsegetMetadataFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att) Returns an InputStream that can be deserialized as a list ofMetadataobjects.jakarta.ws.rs.core.ResponsegetMetadataFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, String handlerTypeName) As/rmeta/form, with the handler type in the path.jakarta.ws.rs.core.ResponsegetMetadataWithConfig(List<org.apache.cxf.jaxrs.ext.multipart.Attachment> attachments, jakarta.ws.rs.core.HttpHeaders httpHeaders) Multipart endpoint with per-request ParseContext configuration.jakarta.ws.rs.core.ResponsegetMetadataWithConfig(List<org.apache.cxf.jaxrs.ext.multipart.Attachment> attachments, jakarta.ws.rs.core.HttpHeaders httpHeaders, String handlerTypeName) As/rmeta/config, with the handler type in the path.jakarta.ws.rs.core.ResponsegetMetadataWithPreset(InputStream is, jakarta.ws.rs.core.HttpHeaders httpHeaders, String presetName, String handlerTypeName) As/rmeta/{handlerType}, with the named preset's parse-context fragment applied.jakarta.ws.rs.core.ResponsegetMetadataWithPresetDefaultHandler(InputStream is, jakarta.ws.rs.core.HttpHeaders httpHeaders, String presetName) As the bare/rmetaendpoint, with the named preset applied.parseMetadata(TikaInputStream tis, Metadata metadata, jakarta.ws.rs.core.MultivaluedMap<String, String> httpHeaders, String handlerTypeName) Parses content and returns metadata list.
-
Field Details
-
HANDLER_TYPE_PARAM
- See Also:
-
DEFAULT_HANDLER_TYPE
-
-
Constructor Details
-
RecursiveMetadataResource
-
-
Method Details
-
parseMetadata
public List<Metadata> parseMetadata(TikaInputStream tis, Metadata metadata, jakarta.ws.rs.core.MultivaluedMap<String, String> httpHeaders, String handlerTypeName) throws ExceptionParses content and returns metadata list. Metadata filtering is done in the child process, so no filtering needed here.- Throws:
Exception
-
getMetadataFromMultipart
@POST @Consumes("multipart/form-data") @Produces("application/json") @Path("form") public jakarta.ws.rs.core.Response getMetadataFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att) throws Exception Returns an InputStream that can be deserialized as a list ofMetadataobjects. The first in the list represents the main document, and the rest represent metadata for the embedded objects. This works recursively through all descendants of the main document, not just the immediate children.The extracted text content is stored with the key
TikaCoreProperties.TIKA_CONTENT.Specify the handler for the content (xml, html, text, markdown, ignore) in the path:
/rmeta/form (default: markdown)
/rmeta/form/xml (store the content as xml)
/rmeta/form/text (store the content as text)
/rmeta/form/markdown (store the content as markdown)
/rmeta/form/ignore (don't record any content) -
getMetadataFromMultipart
@POST @Consumes("multipart/form-data") @Produces("application/json") @Path("form/{handler}") public jakarta.ws.rs.core.Response getMetadataFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, @PathParam("handler") String handlerTypeName) throws Exception As/rmeta/form, with the handler type in the path.- Throws:
Exception
-
getMetadataWithConfig
@POST @Consumes("multipart/form-data") @Produces("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) throws Exception Multipart endpoint with per-request ParseContext configuration. Accepts two parts: "file" (the document) and "config" (JSON configuration with parseContext). Uses the default handler type (Markdown).- Throws:
Exception
-
getMetadataWithConfig
@POST @Consumes("multipart/form-data") @Produces("application/json") @Path("config/{handler}") public jakarta.ws.rs.core.Response getMetadataWithConfig(List<org.apache.cxf.jaxrs.ext.multipart.Attachment> attachments, @Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @PathParam("handler") String handlerTypeName) throws Exception As/rmeta/config, with the handler type in the path. One templated route covers every format because /rmeta always produces JSON; /tika needs a route per format only because its response media type changes with the handler.As on
/tika/config/<format>, naming a handler here and in the config part too is a 400 rather than a silent pick.- Parameters:
handlerTypeName- content handler type: text, html, xml, body, markdown, ignore- Throws:
Exception
-
getMetadataWithPresetDefaultHandler
@PUT @Produces("application/json") @Path("preset/{presetName}") public jakarta.ws.rs.core.Response getMetadataWithPresetDefaultHandler(InputStream is, @Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @PathParam("presetName") String presetName) throws Exception As the bare/rmetaendpoint, with the named preset applied.- Throws:
Exception
-
getMetadataWithPreset
@PUT @Produces("application/json") @Path("preset/{presetName}/{handler : (\\w+)?}") public jakarta.ws.rs.core.Response getMetadataWithPreset(InputStream is, @Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @PathParam("presetName") String presetName, @PathParam("handler") String handlerTypeName) throws Exception As/rmeta/{handlerType}, with the named preset's parse-context fragment applied. Takes no config part -- a preset never combines with request-supplied configuration.- Throws:
Exception
-
getMetadata
@PUT @Produces("application/json") @Path("{handler : (\\w+)?}") public jakarta.ws.rs.core.Response getMetadata(InputStream is, @Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @PathParam("handler") String handlerTypeName) throws Exception Returns an InputStream that can be deserialized as a list ofMetadataobjects. The first in the list represents the main document, and the rest represent metadata for the embedded objects. This works recursively through all descendants of the main document, not just the immediate children.The extracted text content is stored with the key
TikaCoreProperties.TIKA_CONTENT.Specify the handler for the content (xml, html, text, markdown, ignore) in the path:
/rmeta (default: markdown)
/rmeta/xml (store the content as xml)
/rmeta/text (store the content as text)
/rmeta/markdown (store the content as markdown)
/rmeta/ignore (don't record any content)
-