REST 可以通过 FTP 实现吗? [英] Can REST be implemented over FTP?

查看:30
本文介绍了REST 可以通过 FTP 实现吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的同事和我不同意 REST 可以通过 FTP 实现的说法.我相信由于 REST 只是一种架构设计,它可以通过任何具有合适接口的协议来实现,例如 FTP.然而,他不同意,并认为目前除了 HTTP REST 之外无法在任何协议上实现.我向他展示了一些评论和链接,但他不接受.谁是正确的?

My colleague and I disagree over the statement that REST can be implemented over FTP. I believe since REST is just an architectural design, it can be implemented over any protocol with a suitable interface, e.g, FTP. However, he disagrees and believes that currently except HTTP REST can't be implemented on any protocol.I showed him a few comments and links but he isn't accepting them. Who is correct?

Quora 上的相同问题

STOR可以跟随REST吗?

FTP 维基百科

推荐答案

REST 是一个宽泛的概念,没有任何真正严格的定义.它主要用于 HTTP 的方式(即 GET、POST、PUT、DELETE.. 方法)可以很容易地与大多数其他协议镜像,只要您也控制服务器端.对于普通的 FTP 服务器,这可能是不可能的(GET、PUT、DELETE 可能映射到 RETR、STOR 和 DELE,但 POST 不是),但 FTP 协议本身可以与自定义服务器一起使用,我实际上已经看到了FTP 协议被滥用于数据库,例如具有提交和回滚的事务(可怕!).

REST is a broad concept without any real stringent definition. The way it is mostly used with HTTP (i.e. GET, POST, PUT, DELETE.. methods) could be easily mirrored with most other protocols, provided you control the server side too. With a normal FTP server this is probably not possible (GET, PUT, DELETE could probably be mapped to RETR, STOR and DELE, but POST not) but the FTP protocol itself could be used with a custom server and I've actually seen the FTP protocol misused for database like transactions with commit and rollback (scary!).

因此,如果您控制服务器,您可能可以在任何可以双向交换数据的协议上实现 REST 的想法,即 FTP、纯 TCP 或 UDP,航空母舰,蜗牛邮件,也许还有彩虹独角兽.但这并不意味着这些协议真的适合这项任务.

So if you control the server you could probably implement the ideas of REST on any protocol which makes it possible to exchange data in both directions, i.e. FTP, plain TCP or UDP, avian carrier, snail mail and maybe rainbow unicorns. But that does not mean that these protocols are really suited for this task.

这篇关于REST 可以通过 FTP 实现吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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