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

查看:196
本文介绍了如何在服务器模式下使用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 HTTP调用,然后将资源取回. 维基页面

Tika App Network Server非常简单,仅支持一种模式(提取为HTML),通常用于测试/演示/原型制作等. 解决方案

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天全站免登陆