Class TikaResource
- java.lang.Object
-
- org.apache.tika.server.core.resource.TikaResource
-
@Path("/tika") public class TikaResource extends Object
-
-
Constructor Summary
Constructors Constructor Description TikaResource()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
checkIsOperating()
static Parser
createParser()
static String
detectFilename(jakarta.ws.rs.core.MultivaluedMap<String,String> httpHeaders)
static void
fillMetadata(Parser parser, Metadata metadata, jakarta.ws.rs.core.MultivaluedMap<String,String> httpHeaders)
static void
fillParseContext(jakarta.ws.rs.core.MultivaluedMap<String,String> httpHeaders, Metadata metadata, ParseContext parseContext)
static TikaConfig
getConfig()
jakarta.ws.rs.core.StreamingOutput
getHTML(InputStream is, jakarta.ws.rs.core.HttpHeaders httpHeaders, jakarta.ws.rs.core.UriInfo info)
jakarta.ws.rs.core.StreamingOutput
getHTMLFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, jakarta.ws.rs.core.HttpHeaders httpHeaders, jakarta.ws.rs.core.UriInfo info)
static InputStream
getInputStream(InputStream is, Metadata metadata, jakarta.ws.rs.core.HttpHeaders headers, jakarta.ws.rs.core.UriInfo uriInfo)
Metadata
getJson(InputStream is, jakarta.ws.rs.core.HttpHeaders httpHeaders, jakarta.ws.rs.core.UriInfo info, String handlerTypeName)
Metadata
getJsonFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, jakarta.ws.rs.core.HttpHeaders httpHeaders, jakarta.ws.rs.core.UriInfo info, String handlerTypeName)
String
getMessage()
protected static long
getTaskTimeout(ParseContext parseContext)
jakarta.ws.rs.core.StreamingOutput
getText(InputStream is, jakarta.ws.rs.core.HttpHeaders httpHeaders, jakarta.ws.rs.core.UriInfo info)
jakarta.ws.rs.core.StreamingOutput
getTextFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, jakarta.ws.rs.core.HttpHeaders httpHeaders, jakarta.ws.rs.core.UriInfo info)
jakarta.ws.rs.core.StreamingOutput
getTextMain(InputStream is, jakarta.ws.rs.core.HttpHeaders httpHeaders, jakarta.ws.rs.core.UriInfo info)
jakarta.ws.rs.core.StreamingOutput
getTextMainFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, jakarta.ws.rs.core.HttpHeaders httpHeaders, jakarta.ws.rs.core.UriInfo info)
static boolean
getThrowOnWriteLimitReached(jakarta.ws.rs.core.MultivaluedMap<String,String> httpHeaders)
jakarta.ws.rs.core.StreamingOutput
getXML(InputStream is, jakarta.ws.rs.core.HttpHeaders httpHeaders, jakarta.ws.rs.core.UriInfo info)
jakarta.ws.rs.core.StreamingOutput
getXMLFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, jakarta.ws.rs.core.HttpHeaders httpHeaders, jakarta.ws.rs.core.UriInfo info)
static void
init(TikaConfig config, TikaServerConfig tikaServerConfg, DigestingParser.Digester digester, InputStreamFactory inputStreamFactory, ServerStatus serverStatus)
static void
logRequest(org.slf4j.Logger logger, String endpoint, Metadata metadata)
static void
parse(Parser parser, org.slf4j.Logger logger, String path, InputStream inputStream, ContentHandler handler, Metadata metadata, ParseContext parseContext)
Use this to call a parser and unify exception handling.static void
processHeaderConfig(Object object, String key, String val, String prefix)
Utility method to set a property on a class via reflection.jakarta.ws.rs.core.StreamingOutput
produceText(InputStream is, Metadata metadata, jakarta.ws.rs.core.MultivaluedMap<String,String> httpHeaders, jakarta.ws.rs.core.UriInfo info)
jakarta.ws.rs.core.StreamingOutput
produceTextMain(InputStream is, jakarta.ws.rs.core.MultivaluedMap<String,String> httpHeaders, jakarta.ws.rs.core.UriInfo info)
-
-
-
Field Detail
-
GREETING
public static final String GREETING
-
-
Method Detail
-
init
public static void init(TikaConfig config, TikaServerConfig tikaServerConfg, DigestingParser.Digester digester, InputStreamFactory inputStreamFactory, ServerStatus serverStatus)
-
createParser
public static Parser createParser()
-
getConfig
public static TikaConfig getConfig()
-
detectFilename
public static String detectFilename(jakarta.ws.rs.core.MultivaluedMap<String,String> httpHeaders)
-
fillParseContext
public static void fillParseContext(jakarta.ws.rs.core.MultivaluedMap<String,String> httpHeaders, Metadata metadata, ParseContext parseContext)
-
getInputStream
public static InputStream getInputStream(InputStream is, Metadata metadata, jakarta.ws.rs.core.HttpHeaders headers, jakarta.ws.rs.core.UriInfo uriInfo)
-
processHeaderConfig
public static void processHeaderConfig(Object object, String key, String val, String prefix)
Utility method to set a property on a class via reflection.- Parameters:
object
- theObject
to set the property on.key
- the key of the HTTP Header.val
- the value of HTTP header.prefix
- the name of the HTTP Header prefix used to find property.- Throws:
jakarta.ws.rs.WebApplicationException
- thrown when field cannot be found.
-
fillMetadata
public static void fillMetadata(Parser parser, Metadata metadata, jakarta.ws.rs.core.MultivaluedMap<String,String> httpHeaders)
-
parse
public static void parse(Parser parser, org.slf4j.Logger logger, String path, InputStream inputStream, ContentHandler handler, Metadata metadata, ParseContext parseContext) throws IOException
Use this to call a parser and unify exception handling. NOTE: This call to parse closes the InputStream. DO NOT surround the call in an auto-close block.- Parameters:
parser
- parser to uselogger
- logger to usepath
- file pathinputStream
- inputStream (which is closed by this call!)handler
- handler to usemetadata
- metadataparseContext
- parse context- Throws:
IOException
- wrapper for all exceptions
-
getTaskTimeout
protected static long getTaskTimeout(ParseContext parseContext)
-
checkIsOperating
public static void checkIsOperating()
-
logRequest
public static void logRequest(org.slf4j.Logger logger, String endpoint, Metadata metadata)
-
getThrowOnWriteLimitReached
public static boolean getThrowOnWriteLimitReached(jakarta.ws.rs.core.MultivaluedMap<String,String> httpHeaders)
-
getMessage
@GET @Produces("text/plain") public String getMessage()
-
getTextFromMultipart
@POST @Consumes("multipart/form-data") @Produces("text/plain") @Path("form") public jakarta.ws.rs.core.StreamingOutput getTextFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, @Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @Context jakarta.ws.rs.core.UriInfo info)
-
getTextMain
@PUT @Consumes("*/*") @Produces("text/plain") @Path("main") public jakarta.ws.rs.core.StreamingOutput getTextMain(InputStream is, @Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @Context jakarta.ws.rs.core.UriInfo info)
-
getTextMainFromMultipart
@POST @Consumes("multipart/form-data") @Produces("text/plain") @Path("form/main") public jakarta.ws.rs.core.StreamingOutput getTextMainFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, @Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @Context jakarta.ws.rs.core.UriInfo info)
-
produceTextMain
public jakarta.ws.rs.core.StreamingOutput produceTextMain(InputStream is, jakarta.ws.rs.core.MultivaluedMap<String,String> httpHeaders, jakarta.ws.rs.core.UriInfo info)
-
getText
@PUT @Consumes("*/*") @Produces("text/plain") public jakarta.ws.rs.core.StreamingOutput getText(InputStream is, @Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @Context jakarta.ws.rs.core.UriInfo info)
-
produceText
public jakarta.ws.rs.core.StreamingOutput produceText(InputStream is, Metadata metadata, jakarta.ws.rs.core.MultivaluedMap<String,String> httpHeaders, jakarta.ws.rs.core.UriInfo info)
-
getHTMLFromMultipart
@POST @Consumes("multipart/form-data") @Produces("text/html") @Path("form") public jakarta.ws.rs.core.StreamingOutput getHTMLFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, @Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @Context jakarta.ws.rs.core.UriInfo info)
-
getHTML
@PUT @Consumes("*/*") @Produces("text/html") public jakarta.ws.rs.core.StreamingOutput getHTML(InputStream is, @Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @Context jakarta.ws.rs.core.UriInfo info)
-
getXMLFromMultipart
@POST @Consumes("multipart/form-data") @Produces("text/xml") @Path("form") public jakarta.ws.rs.core.StreamingOutput getXMLFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, @Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @Context jakarta.ws.rs.core.UriInfo info)
-
getXML
@PUT @Consumes("*/*") @Produces("text/xml") public jakarta.ws.rs.core.StreamingOutput getXML(InputStream is, @Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @Context jakarta.ws.rs.core.UriInfo info)
-
getJsonFromMultipart
@POST @Consumes("multipart/form-data") @Produces("application/json") @Path("form{handler : (\\w+)?}") public Metadata getJsonFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, @Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @Context jakarta.ws.rs.core.UriInfo info, @PathParam("handler") String handlerTypeName) throws IOException, TikaException
- Throws:
IOException
TikaException
-
getJson
@PUT @Consumes("*/*") @Produces("application/json") @Path("{handler : (\\w+)?}") public Metadata getJson(InputStream is, @Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @Context jakarta.ws.rs.core.UriInfo info, @PathParam("handler") String handlerTypeName) throws IOException, TikaException
- Throws:
IOException
TikaException
-
-