Class RecursiveMetadataResource

java.lang.Object
org.apache.tika.server.core.resource.RecursiveMetadataResource

@Path("/rmeta") public class RecursiveMetadataResource extends Object
  • Field Details

  • Constructor Details

    • RecursiveMetadataResource

      public RecursiveMetadataResource(TikaResource tikaResource)
  • Method Details

    • parseMetadata

      public List<Metadata> parseMetadata(TikaInputStream tis, Metadata metadata, jakarta.ws.rs.core.MultivaluedMap<String,String> httpHeaders, String handlerTypeName) throws Exception
      Parses 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 of Metadata objects. 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)

      Parameters:
      att - attachment
      info - uri info
      handlerTypeName - which type of handler to use
      Returns:
      InputStream that can be deserialized as a list of Metadata objects
      Throws:
      Exception
    • 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 /rmeta endpoint, 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 of Metadata objects. 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)

      Parameters:
      handlerTypeName - which type of handler to use
      Returns:
      InputStream that can be deserialized as a list of Metadata objects
      Throws:
      Exception