有关 sw-http 中 APPLICATION-FINDER-FN 的详细信息
我正在寻找在 Common Lisp 中进行一些同步网络编程,并且我正在收集选项。其中之一是 sw-http
,一个“为阿贾克斯/彗星”。该文档似乎有点缺乏,因为我能找到的唯一一块告诉你
子类 SERVER 并将 APPLICATION-FINDER-FN 插槽设置为回调 生成您的内容。
似乎没有任何关于回调应该是什么样子的注释或示例(一些提示告诉我它应该期望一个 server
和一个 connection
作为参数,但是没有关于它应该返回或做什么的信息)。
将其设置为天真的东西
(lambda (server conn) (declare (ignore server conn)) "Hello world")
似乎没有做任何事情,所以我假设我要么需要写入某处的流,要么以更少的方式与 server
/connection
交互-比完全显而易见的方式。
有什么提示吗?
I'm looking to do some synchronous web-programming in Common Lisp, and I'm rounding up options. One of them is sw-http
, an "HTTP server tailored for AJAX/Comet". The documentation seems to be a bit lacking because the only piece I could find tells you to
Sub-class SERVER and set the APPLICATION-FINDER-FN slot to a callback
that generates your content.
There doesn't seem to be any notes or examples about what that callback should look like (some prodding told me that it should expect a server
and a connection
as arguments, but nothing about what it should return or do).
setting it to something naive like
(lambda (server conn) (declare (ignore server conn)) "Hello world")
doesn't seem to do anything, so I assume I either need to write to a stream somewhere or interact with the server
/connection
in some less-than-perfectly-obvious way.
Any hints?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该处理程序采用一个
连接
,该连接具有一个响应
,其中包含一些块
。假设您要将内容添加到
连接
的响应
的块
(即八位字节
)中。幸运的是,定义了一些辅助方法来使这变得更容易。你可以尝试这个(我无法编译 SW-HTTP,所以我不能):
祝你好运!
The handler takes a
connection
which has aresponse
which has somechunks
.Presumably you're to add your content to the
chunks
(which areoctets
) of theresponse
of theconnection
. Luckily there are some helper methods defined to make this easier.You might try this (I couldn't get SW-HTTP to compile so I can't):
Good luck!