如何在服务器模式下使用 Tika [英] How to use Tika in server mode

查看:33
本文介绍了如何在服务器模式下使用 Tika的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Tika 的网站上,它说(关于 tika-app-1.2.jar)它可以在服务器模式下使用.有谁知道如何在此服务器运行后发送文档和接收来自该服务器的解析文本?

解决方案

Tika 支持两种服务器"模式.更简单原始的是 Tika-App 的 --server 标志.JAX-RS JSR-311 服务器组件功能更强大,但也更新了,它是一个额外的罐子.

Tika-App 网络服务器使用起来非常简单.只需使用 --server 标志和 --port ### 标志启动 Tika-App,告诉它监听哪个端口.然后,连接到该端口并向其发送单个文件.你会得到 html 版本.NetCat 对此很有效,例如 java -jar tika-app.jar --server --port 12345 后跟 nc 127.0.0.1 12345 MyFileToExtract 会让你回到 html

JAX-RS JSR-311 服务器组件支持一些不同的 url,例如元数据、纯文本等.您使用 java -jar tika-server.jar 启动服务器,然后使用您的输入文档对适当的 url 执行 HTTP put 调用,您将获得资源.wiki 页面

Tika App Network Server 比较简单,只支持一种模式(解压到HTML),一般用于测试/演示/原型制作等.Tika JAXRS 服务器 是一个完全 RESTful 的服务,它使用 HTTP,并公开了广泛的 Tika 模式.这是目前普遍推荐的通过网络和/或非 Java 堆栈与 Tika 交互的方式.

On Tika's website it says (concerning tika-app-1.2.jar) it can be used in server mode. Does anyone know how to send documents and receive parsed text from this server once it is running?

解决方案

Tika supports two "server" modes. The simpler and original is the --server flag of Tika-App. The more functional, but also more recent is the JAX-RS JSR-311 server component, which is an additional jar.

The Tika-App Network Server is very simple to use. Simply start Tika-App with the --server flag, and a --port ### flag telling it what port to listen on. Then, connect to that port and send it a single file. You'll get back the html version. NetCat works well for this, something like java -jar tika-app.jar --server --port 12345 followed by nc 127.0.0.1 12345 < MyFileToExtract will get you back the html

The JAX-RS JSR-311 server component supports a few different urls, for things like metadata, plain text etc. You start the server with java -jar tika-server.jar, then do HTTP put calls to the appropriate url with your input document and you'll get the resource back. There are loads of details and examples (including using curl for testing) on the wiki page

The Tika App Network Server is fairly simple, only supports one mode (extract to HTML), and is generally used for testing / demos / prototyping / etc. The Tika JAXRS Server is a fully RESTful service which talks HTTP, and exposes a wide range of Tika's modes. It's the generally recommended way these days to interface with Tika over the network, and/or from non-Java stacks.

这篇关于如何在服务器模式下使用 Tika的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆