Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 49F77200B8F for ; Fri, 16 Sep 2016 03:36:55 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 484FC160AE4; Fri, 16 Sep 2016 01:36:55 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 75843160AE1 for ; Fri, 16 Sep 2016 03:36:54 +0200 (CEST) Received: (qmail 13942 invoked by uid 500); 16 Sep 2016 01:36:53 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 13541 invoked by uid 99); 16 Sep 2016 01:36:53 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Sep 2016 01:36:53 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id BEE2DEEE29; Fri, 16 Sep 2016 01:36:52 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: reta@apache.org To: commits@cxf.apache.org Date: Fri, 16 Sep 2016 01:37:00 -0000 Message-Id: <7abf1e58d8404e049caa89339c873496@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [09/22] cxf git commit: Minor update to the Tika demo code archived-at: Fri, 16 Sep 2016 01:36:55 -0000 Minor update to the Tika demo code Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/1b2a3d0d Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/1b2a3d0d Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/1b2a3d0d Branch: refs/heads/master-jaxrs-2.1 Commit: 1b2a3d0d2e1a4c8f13368fd7c3e0e1cbfabd2b32 Parents: cc2341a Author: Sergey Beryozkin Authored: Thu Sep 15 11:24:06 2016 +0100 Committer: Sergey Beryozkin Committed: Thu Sep 15 11:24:06 2016 +0100 ---------------------------------------------------------------------- .../main/java/demo/jaxrs/server/StreamingService.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/1b2a3d0d/distribution/src/main/release/samples/jax_rs/spark/src/main/java/demo/jaxrs/server/StreamingService.java ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/spark/src/main/java/demo/jaxrs/server/StreamingService.java b/distribution/src/main/release/samples/jax_rs/spark/src/main/java/demo/jaxrs/server/StreamingService.java index 0d2fdea..000d8bc 100644 --- a/distribution/src/main/release/samples/jax_rs/spark/src/main/java/demo/jaxrs/server/StreamingService.java +++ b/distribution/src/main/release/samples/jax_rs/spark/src/main/java/demo/jaxrs/server/StreamingService.java @@ -55,11 +55,6 @@ import org.apache.spark.streaming.api.java.JavaPairDStream; import org.apache.spark.streaming.api.java.JavaReceiverInputDStream; import org.apache.spark.streaming.api.java.JavaStreamingContext; import org.apache.spark.streaming.receiver.Receiver; -import org.apache.tika.parser.AutoDetectParser; -import org.apache.tika.parser.ParseContext; -import org.apache.tika.parser.Parser; -import org.apache.tika.parser.odf.OpenDocumentParser; -import org.apache.tika.parser.pdf.PDFParser; import scala.Tuple2; @@ -71,6 +66,7 @@ public class StreamingService { MEDIA_TYPE_TABLE = new HashMap(); MEDIA_TYPE_TABLE.put("pdf", MediaType.valueOf("application/pdf")); MEDIA_TYPE_TABLE.put("odt", MediaType.valueOf("application/vnd.oasis.opendocument.text")); + MEDIA_TYPE_TABLE.put("odp", MediaType.valueOf("application/vnd.oasis.opendocument.presentation")); } private Executor executor = new ThreadPoolExecutor(5, 5, 0, TimeUnit.SECONDS, new ArrayBlockingQueue(10)); @@ -83,9 +79,6 @@ public class StreamingService { @Produces("text/plain") public void processMultipartStream(@Suspended AsyncResponse async, @Multipart("file") Attachment att) { - TikaContentExtractor tika = new TikaContentExtractor( - Arrays.asList(new PDFParser(), new OpenDocumentParser())); - MediaType mediaType = att.getContentType(); if (mediaType == null) { String fileName = att.getContentDisposition().getFilename(); @@ -97,8 +90,7 @@ public class StreamingService { } } - ParseContext context = new ParseContext(); - context.set(Parser.class, new AutoDetectParser()); + TikaContentExtractor tika = new TikaContentExtractor(); TikaContent tikaContent = tika.extract(att.getObject(InputStream.class), mediaType); processStream(async, new TikaReceiver(tikaContent));