Package org.apache.tika.server.resource
Class TikaResource
- java.lang.Object
-
- org.apache.tika.server.resource.TikaResource
-
@Path("/tika") public class TikaResource extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
GREETING
static String
PASSWORD
static String
PASSWORD_BASE64_UTF8
static String
X_TIKA_OCR_HEADER_PREFIX
static String
X_TIKA_PDF_HEADER_PREFIX
-
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(javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders)
static void
fillMetadata(Parser parser, Metadata metadata, ParseContext context, javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders)
static void
fillParseContext(ParseContext parseContext, javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders, Parser embeddedParser)
static TikaConfig
getConfig()
static Detector
getDetector(Parser p)
javax.ws.rs.core.StreamingOutput
getHTML(InputStream is, javax.ws.rs.core.HttpHeaders httpHeaders, javax.ws.rs.core.UriInfo info)
javax.ws.rs.core.StreamingOutput
getHTMLFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, javax.ws.rs.core.UriInfo info)
static InputStream
getInputStream(InputStream is, Metadata metadata, javax.ws.rs.core.HttpHeaders headers)
String
getMessage()
javax.ws.rs.core.StreamingOutput
getText(InputStream is, javax.ws.rs.core.HttpHeaders httpHeaders, javax.ws.rs.core.UriInfo info)
javax.ws.rs.core.StreamingOutput
getTextFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, javax.ws.rs.core.UriInfo info)
javax.ws.rs.core.StreamingOutput
getTextMain(InputStream is, javax.ws.rs.core.HttpHeaders httpHeaders, javax.ws.rs.core.UriInfo info)
javax.ws.rs.core.StreamingOutput
getTextMainFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, javax.ws.rs.core.UriInfo info)
javax.ws.rs.core.StreamingOutput
getXML(InputStream is, javax.ws.rs.core.HttpHeaders httpHeaders, javax.ws.rs.core.UriInfo info)
javax.ws.rs.core.StreamingOutput
getXMLFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, javax.ws.rs.core.UriInfo info)
static void
init(TikaConfig config, DigestingParser.Digester digestr, InputStreamFactory iSF, ServerStatus serverStatus)
static void
logRequest(org.slf4j.Logger logger, javax.ws.rs.core.UriInfo info, 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.javax.ws.rs.core.StreamingOutput
produceText(InputStream is, Metadata metadata, javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders, javax.ws.rs.core.UriInfo info)
javax.ws.rs.core.StreamingOutput
produceTextMain(InputStream is, javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders, javax.ws.rs.core.UriInfo info)
static void
setDetector(Parser p, Detector detector)
-
-
-
Field Detail
-
GREETING
public static final String GREETING
-
X_TIKA_OCR_HEADER_PREFIX
public static final String X_TIKA_OCR_HEADER_PREFIX
- See Also:
- Constant Field Values
-
X_TIKA_PDF_HEADER_PREFIX
public static final String X_TIKA_PDF_HEADER_PREFIX
- See Also:
- Constant Field Values
-
PASSWORD
public static final String PASSWORD
- See Also:
- Constant Field Values
-
PASSWORD_BASE64_UTF8
public static final String PASSWORD_BASE64_UTF8
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public static void init(TikaConfig config, DigestingParser.Digester digestr, InputStreamFactory iSF, ServerStatus serverStatus)
-
createParser
public static Parser createParser()
-
getConfig
public static TikaConfig getConfig()
-
detectFilename
public static String detectFilename(javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders)
-
fillParseContext
public static void fillParseContext(ParseContext parseContext, javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders, Parser embeddedParser)
-
getInputStream
public static InputStream getInputStream(InputStream is, Metadata metadata, javax.ws.rs.core.HttpHeaders headers)
-
fillMetadata
public static void fillMetadata(Parser parser, Metadata metadata, ParseContext context, javax.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
-
checkIsOperating
public static void checkIsOperating()
-
logRequest
public static void logRequest(org.slf4j.Logger logger, javax.ws.rs.core.UriInfo info, Metadata metadata)
-
getMessage
@GET @Produces("text/plain") public String getMessage()
-
getTextFromMultipart
@POST @Consumes("multipart/form-data") @Produces("text/plain") @Path("form") public javax.ws.rs.core.StreamingOutput getTextFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, @Context javax.ws.rs.core.UriInfo info)
-
getTextMain
@PUT @Consumes("*/*") @Produces("text/plain") @Path("main") public javax.ws.rs.core.StreamingOutput getTextMain(InputStream is, @Context javax.ws.rs.core.HttpHeaders httpHeaders, @Context javax.ws.rs.core.UriInfo info)
-
getTextMainFromMultipart
@POST @Consumes("multipart/form-data") @Produces("text/plain") @Path("form/main") public javax.ws.rs.core.StreamingOutput getTextMainFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, @Context javax.ws.rs.core.UriInfo info)
-
produceTextMain
public javax.ws.rs.core.StreamingOutput produceTextMain(InputStream is, javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders, javax.ws.rs.core.UriInfo info)
-
getText
@PUT @Consumes("*/*") @Produces("text/plain") public javax.ws.rs.core.StreamingOutput getText(InputStream is, @Context javax.ws.rs.core.HttpHeaders httpHeaders, @Context javax.ws.rs.core.UriInfo info)
-
produceText
public javax.ws.rs.core.StreamingOutput produceText(InputStream is, Metadata metadata, javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders, javax.ws.rs.core.UriInfo info)
-
getHTMLFromMultipart
@POST @Consumes("multipart/form-data") @Produces("text/html") @Path("form") public javax.ws.rs.core.StreamingOutput getHTMLFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, @Context javax.ws.rs.core.UriInfo info)
-
getHTML
@PUT @Consumes("*/*") @Produces("text/html") public javax.ws.rs.core.StreamingOutput getHTML(InputStream is, @Context javax.ws.rs.core.HttpHeaders httpHeaders, @Context javax.ws.rs.core.UriInfo info)
-
getXMLFromMultipart
@POST @Consumes("multipart/form-data") @Produces("text/xml") @Path("form") public javax.ws.rs.core.StreamingOutput getXMLFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, @Context javax.ws.rs.core.UriInfo info)
-
getXML
@PUT @Consumes("*/*") @Produces("text/xml") public javax.ws.rs.core.StreamingOutput getXML(InputStream is, @Context javax.ws.rs.core.HttpHeaders httpHeaders, @Context javax.ws.rs.core.UriInfo info)
-
-