CMIS 与 REST。哪个客户端更容易从头开始实施?

发布于 2024-11-28 19:09:27 字数 153 浏览 3 评论 0原文

我正在开发一个 Java 项目,需要使用 REST 或 CMIS 上传文件(这两种服务都可用)。我对这些 API 完全陌生,想问一下哪一个最容易实现且更直接。 我无法在项目中使用外部库,因此我需要从头开始实现客户端。

注意:唯一的要求是上传文件。

提前致谢。

Im working on a Java project that needs to upload files using either REST or CMIS (both services are available). I'm completely new to these APIs and would like to ask which one would be easiest and more straightforward to implement.
I can't use external libraries in the project, so I will need to implement the client from scratch.

Note: the only requirement is to upload files.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一抹微笑 2024-12-05 19:09:27

内容管理互操作性服务 (CMIS) 规范的目标是提供一组用于处理丰富内容存储库的服务。它为 ECM 应用程序提供了完整的规范,可以是 REST 或 SOAP。

CMIS 为控制文件夹、文档、关系和策略的操作提供规范。

我认为对于您的上传,使用 CMIS 就像用炸弹杀死苍蝇一样。

The goal of the Content Management Interoperability Services (CMIS) specification is to provide a set of services for working with rich content repositories. It provides a entire specification for ECM applications, that can be REST or SOAP.

CMIS provides specification to operations that control folders,documents,relationships and policy.

I think that for your upload, using CMIS would be like killing a fly with a bomb.

当梦初醒 2024-12-05 19:09:27

虽然我承认我不了解 CMIS,但使用 REST 的文件上传只是经典的 HTTP 文件上传,您将路径名解释为指示要更新或替换的资源。基本的 REST 用法将让您执行(HTTP)GET(方法)作为“读取文件”,POST 作为“选择新名称时创建文件”(通常随后进行重定向,以便客户端可以找出名称是什么)选择),PUT 为“使用给定名称创建文件或替换该文件的内容”,DELETE 为“删除文件”。此外,您不需要支持所有这些方法;想做多少就做多少(但支持一些 GET 请求是个好主意,即使只是为了让人们知道他们的上传有效)。

但是,在实现时,您在所有情况下都希望尽量避免将文件的大部分数据保存在内存中;那无法扩展。最好花时间实现流传输,这样您实际上就不需要缓冲超过几千字节的数据。您当然可以使用 REST/HTTP 来做到这一点。 (您甚至可以使用 MTOM 通过 SOAP 来完成此操作,但这可能超出了您的范围......)

While I admit that I don't know CMIS, file upload with REST is just classic HTTP file upload where you interpret the path name as indicative of the resource to update or replace. Basic REST usage would have you do (an HTTP) GET (method) as “read the file”, POST as “create the file while picking a new name” (typically with a redirect afterwards so that the client can find out what name was picked), PUT as “create the file with the given name or replace that file's contents”, and DELETE as “delete the file”. Moreover, you don't need to support all those methods; do as few as you want (but it's a good idea to support some GET requests, even if just to let people that their uploads worked).

However, when implementing you want in all cases to try to avoid holding much of the file's data in memory; that doesn't scale. Better to take the time to implement streaming transfers so that you never actually need to buffer more than a few kilobytes. You can certainly do this with REST/HTTP. (You could even do it with SOAP using MTOM, but that's probably out of scope for you…)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文