Erlang Web 网关接口 (EWGI) 和 Webmachine 之间有什么区别?
EWGI 和 Webmachine 在 Erlang 中提供 HTTP 的抽象。我想知道他们的方法中关键的概念差异是什么?
Both EWGI and Webmachine provide abstractions of HTTP in Erlang. I would like to know what the key conceptual differences are in their approach?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
EWGI 为 HTTP 中间件提供了一个抽象位置,并且本质上对除请求/响应对的存在之外的任何更深层次的东西视而不见。这是一种经过验证的真实模式,用于堆叠系统层以构建一个连贯的整体,但它无助于使整个系统正确或易于理解。
Webmachine 包含一个显式模型,不仅用于处理请求,还用于管理 HTTP 协议本身的内部语义。通过为应用程序开发人员提供一种简单且富有表现力的方式来描述其应用程序的 HTTP 行为,Webmachine 使得创建形状像 Web 且非常容易理解的系统变得非常容易。
这两个系统可能是互补的。目前 Webmachine 仅使用 mochiweb 提供的请求和响应,但如果提供了一个可靠的补丁,允许 Webmachine 充当 EWGI 应用程序,我怀疑它会被接受。考虑到这两个系统的形状,这应该不是一项太大的任务。
EWGI provides an abstract place for HTTP middleware, and is essentially blind to anything deeper than the existence of a Request/Response pair. This is a tried and true pattern for stacking layers of systems to build a coherent whole, but it does not help to make that whole system to be correct or understandable.
Webmachine contains an explicit model not just for handling requests, but for managing the internal semantics of the HTTP protocol itself. By providing the application developer with a straightforward and expressive way to describe their application's HTTP behavior, Webmachine makes it very easy to create systems that are shaped like the Web and are very easy to understand.
The two systems are potentially complementary. Right now Webmachine only uses mochiweb-provided requests and responses, but if a solid patch was provided that allowed Webmachine to act as an EWGI application was produced I suspect that it would be accepted. Given the shape of the two systems this should not be too large an undertaking.
EWGI 应该是用于编写请求处理程序的通用 API,这是许多 Web 服务器实现的 API。 EWGI 的灵感来自Python 的WSGI。
Webmachine 只是一个独立的应用程序,拥有自己的 API,并且单独实现。
EWGI is supposed to be a common API for writing request handlers, an API that many web servers implement. EWGI is inspired by Python's WSGI.
Webmachine is just a standalone application with its own API that it is alone in implementing.