You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2020/07/15 18:59:40 UTC
[tika] 03/05: writeLimit and maxEmbeddedResources for recursive
parsing - add header (#326)
This is an automated email from the ASF dual-hosted git repository.
tallison pushed a commit to branch branch_1x
in repository https://gitbox.apache.org/repos/asf/tika.git
commit a11314f8ab395074bc4d5e8a4ba35ef5c8c2012d
Author: Nicholas DiPiazza <ni...@lucidworks.com>
AuthorDate: Wed Jul 15 12:36:48 2020 -0500
writeLimit and maxEmbeddedResources for recursive parsing - add header (#326)
parameters so that this can be customized.
---
.../tika/server/resource/RecursiveMetadataResource.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/tika-server/src/main/java/org/apache/tika/server/resource/RecursiveMetadataResource.java b/tika-server/src/main/java/org/apache/tika/server/resource/RecursiveMetadataResource.java
index 524759e..15aca64 100644
--- a/tika-server/src/main/java/org/apache/tika/server/resource/RecursiveMetadataResource.java
+++ b/tika-server/src/main/java/org/apache/tika/server/resource/RecursiveMetadataResource.java
@@ -139,10 +139,20 @@ public class RecursiveMetadataResource {
TikaResource.fillParseContext(context, httpHeaders, null);
TikaResource.logRequest(LOG, info, metadata);
- BasicContentHandlerFactory.HANDLER_TYPE type =
+ int writeLimit = -1;
+ if (httpHeaders.containsKey("writeLimit")) {
+ writeLimit = Integer.parseInt(httpHeaders.getFirst("writeLimit"));
+ }
+
+ int maxEmbeddedResources = -1;
+ if (httpHeaders.containsKey("maxEmbeddedResources")) {
+ writeLimit = Integer.parseInt(httpHeaders.getFirst("maxEmbeddedResources"));
+ }
+
+ BasicContentHandlerFactory.HANDLER_TYPE type =
BasicContentHandlerFactory.parseHandlerType(handlerTypeName, DEFAULT_HANDLER_TYPE);
RecursiveParserWrapperHandler handler = new RecursiveParserWrapperHandler(
- new BasicContentHandlerFactory(type, -1), -1);
+ new BasicContentHandlerFactory(type, writeLimit), maxEmbeddedResources);
try {
TikaResource.parse(wrapper, LOG, info.getPath(), is, handler, metadata, context);
} catch (SecurityException e) {