Repository: cxf
Updated Branches:
  refs/heads/master cc2341a45 -> 1b2a3d0d2


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
Commit: 1b2a3d0d2e1a4c8f13368fd7c3e0e1cbfabd2b32
Parents: cc2341a
Author: Sergey Beryozkin <sberyoz...@gmail.com>
Authored: Thu Sep 15 11:24:06 2016 +0100
Committer: Sergey Beryozkin <sberyoz...@gmail.com>
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<String, MediaType>();
         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<Runnable>(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));

Reply via email to