@Path(value="/tika") public class TikaResource extends Object
Constructor and Description |
---|
TikaResource() |
Modifier and Type | Method and 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,
javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders) |
static void |
fillParseContext(javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders,
Metadata metadata,
ParseContext parseContext) |
static TikaConfig |
getConfig() |
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.HttpHeaders httpHeaders,
javax.ws.rs.core.UriInfo info) |
static InputStream |
getInputStream(InputStream is,
Metadata metadata,
javax.ws.rs.core.HttpHeaders headers) |
Metadata |
getJson(InputStream is,
javax.ws.rs.core.HttpHeaders httpHeaders,
javax.ws.rs.core.UriInfo info,
String handlerTypeName) |
Metadata |
getJsonFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att,
javax.ws.rs.core.HttpHeaders httpHeaders,
javax.ws.rs.core.UriInfo info,
String handlerTypeName) |
String |
getMessage() |
protected static long |
getTaskTimeout(ParseContext parseContext) |
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.HttpHeaders httpHeaders,
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.HttpHeaders httpHeaders,
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.HttpHeaders httpHeaders,
javax.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.
|
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) |
public static final String GREETING
public static void init(TikaConfig config, TikaServerConfig tikaServerConfg, DigestingParser.Digester digester, InputStreamFactory inputStreamFactory, ServerStatus serverStatus)
public static Parser createParser()
public static TikaConfig getConfig()
public static String detectFilename(javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders)
public static void fillParseContext(javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders, Metadata metadata, ParseContext parseContext)
public static InputStream getInputStream(InputStream is, Metadata metadata, javax.ws.rs.core.HttpHeaders headers)
public static void processHeaderConfig(Object object, String key, String val, String prefix)
object
- the Object
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.javax.ws.rs.WebApplicationException
- thrown when field cannot be found.public static void fillMetadata(Parser parser, Metadata metadata, javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders)
public static void parse(Parser parser, org.slf4j.Logger logger, String path, InputStream inputStream, ContentHandler handler, Metadata metadata, ParseContext parseContext) throws IOException
parser
- parser to uselogger
- logger to usepath
- file pathinputStream
- inputStream (which is closed by this call!)handler
- handler to usemetadata
- metadataparseContext
- parse contextIOException
- wrapper for all exceptionsprotected static long getTaskTimeout(ParseContext parseContext)
public static void checkIsOperating()
public static void logRequest(org.slf4j.Logger logger, String endpoint, Metadata metadata)
@GET @Produces(value="text/plain") public String getMessage()
@POST @Consumes(value="multipart/form-data") @Produces(value="text/plain") @Path(value="form") public javax.ws.rs.core.StreamingOutput getTextFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, @Context javax.ws.rs.core.HttpHeaders httpHeaders, @Context javax.ws.rs.core.UriInfo info)
@PUT @Consumes(value="*/*") @Produces(value="text/plain") @Path(value="main") public javax.ws.rs.core.StreamingOutput getTextMain(InputStream is, @Context javax.ws.rs.core.HttpHeaders httpHeaders, @Context javax.ws.rs.core.UriInfo info)
@POST @Consumes(value="multipart/form-data") @Produces(value="text/plain") @Path(value="form/main") public javax.ws.rs.core.StreamingOutput getTextMainFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, @Context javax.ws.rs.core.HttpHeaders httpHeaders, @Context javax.ws.rs.core.UriInfo info)
public javax.ws.rs.core.StreamingOutput produceTextMain(InputStream is, javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders, javax.ws.rs.core.UriInfo info)
@PUT @Consumes(value="*/*") @Produces(value="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)
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)
@POST @Consumes(value="multipart/form-data") @Produces(value="text/html") @Path(value="form") public javax.ws.rs.core.StreamingOutput getHTMLFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, @Context javax.ws.rs.core.HttpHeaders httpHeaders, @Context javax.ws.rs.core.UriInfo info)
@PUT @Consumes(value="*/*") @Produces(value="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)
@POST @Consumes(value="multipart/form-data") @Produces(value="text/xml") @Path(value="form") public javax.ws.rs.core.StreamingOutput getXMLFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, @Context javax.ws.rs.core.HttpHeaders httpHeaders, @Context javax.ws.rs.core.UriInfo info)
@PUT @Consumes(value="*/*") @Produces(value="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)
@POST @Consumes(value="multipart/form-data") @Produces(value="application/json") @Path(value="form{handler : (\\w+)?}") public Metadata getJsonFromMultipart(org.apache.cxf.jaxrs.ext.multipart.Attachment att, @Context javax.ws.rs.core.HttpHeaders httpHeaders, @Context javax.ws.rs.core.UriInfo info, @PathParam(value="handler") String handlerTypeName) throws IOException, TikaException
IOException
TikaException
@PUT @Consumes(value="*/*") @Produces(value="application/json") @Path(value="{handler : (\\w+)?}") public Metadata getJson(InputStream is, @Context javax.ws.rs.core.HttpHeaders httpHeaders, @Context javax.ws.rs.core.UriInfo info, @PathParam(value="handler") String handlerTypeName) throws IOException, TikaException
IOException
TikaException
Copyright © 2007–2021 The Apache Software Foundation. All rights reserved.