如何通过专门化函数来更改 Hunchentoot 会话 cookie 名称?
我正在使用 Hunchentoot,并且想更改会话 cookie 的名称。这是用通用函数实现的,文档说要更改名称,您可以“专门化函数”。
我不太确定这在这里意味着什么。我的印象是,专门化一个函数就是在某些参数类型上调度一个方法。在这种特殊情况下,该函数采用服务器接受器,我不想更改它。有人可以帮我解释一下吗?
API:http://weitz.de/hunchentoot/#session-cookie-name
这是源代码中的实现:
(defgeneric session-cookie-name (acceptor)
(:documentation "Returns the name \(a string) of the cookie \(or the
GET parameter) which is used to store a session on the client side.
The default is to use the string \"hunchentoot-session\", but you can
specialize this function if you want another name."))
(defmethod session-cookie-name ((acceptor t))
"hunchentoot-session")
I'm using Hunchentoot and would like to change the name of the session cookie. This is implemented with a generic function and the docs say to change the name you can "specialize the function".
I'm not really sure what this means here. I was under the impression that specializing a function is to dispatch a method on certain argument types. In this particular case, the function takes the server acceptor and I don't want to change that. Can someone illuminate me on this?
The API: http://weitz.de/hunchentoot/#session-cookie-name
Here's the implementation in the source:
(defgeneric session-cookie-name (acceptor)
(:documentation "Returns the name \(a string) of the cookie \(or the
GET parameter) which is used to store a session on the client side.
The default is to use the string \"hunchentoot-session\", but you can
specialize this function if you want another name."))
(defmethod session-cookie-name ((acceptor t))
"hunchentoot-session")
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建一个子类并以这种方式专门化:
该函数仍然需要一个接受器,现在它只是您类型的接受器。
Make a subclass and specialize that way:
The function still takes an acceptor, it's just your kind of acceptor, now.