Hey everyone,
so i was going through the hunchentoot documenation and I noticed that Edi said "Unless you are in a Lisp without MP capabilities, you can have several active instances of ACCEPTOR http://weitz.de/hunchentoot/#acceptor(listening on different ports) at the same time."
Now this is great but I can not seem to understand how do you link a dispatcher to an acceptor (any kind of dispatcher) should the uri we put include a port or something. Can anyone point out this? Thanks in advance.
Regards, Mackram Raydan
Website: www.trailoflight.net "An invasion of armies can be resisted, but not an idea whose time has come." Victor Hugo
Mackram Raydan wrote:
so i was going through the hunchentoot documenation and I noticed that Edi said "Unless you are in a Lisp without MP capabilities, you can have several active instances of ACCEPTOR http://weitz.de/hunchentoot/#acceptor(listening on different ports) at the same time."
Now this is great but I can not seem to understand how do you link a dispatcher to an acceptor (any kind of dispatcher) should the uri we put include a port or something. Can anyone point out this? Thanks in advance.
The default acceptor refers to *dispatch-table* to find a dispatcher that is willing to return a handler.
To modify this behavior (e.g. have a separate table per acceptor) you need to subclass ACCEPTOR and set the REQUEST-DISPATCHER slot to an appropriate function:
(request-dispatcher :initarg :request-dispatcher :accessor acceptor-request-dispatcher :documentation "A designator for the request dispatcher function used by this acceptor. A function which accepts a REQUEST object and calls a request handler of its choice (and returns its return value). The default is the unexported symbol LIST-REQUEST-DISPATCHER which works through the list *DISPATCH-TABLE*.")
HTH,
Leslie
On Sat, Aug 29, 2009 at 10:12, Mackram Raydanmackram@gmail.com wrote:
so i was going through the hunchentoot documenation and I noticed that Edi said "Unless you are in a Lisp without MP capabilities, you can have several active instances of ACCEPTOR (listening on different ports) at the same time."
Now this is great but I can not seem to understand how do you link a dispatcher to an acceptor (any kind of dispatcher) should the uri we put include a port or something. Can anyone point out this? Thanks in advance.
Do you want something like
(let ((server-1 (hunchentoot:start (make-instance 'hunchentoot:acceptor :port 1111 :request-dispatcher 'my-dispatcher)))) (server-2 (hunchentoot:start (make-instance 'hunchentoot:acceptor :port 2222 :request-dispatcher 'my-dispatcher))))) ...)
or am I missing your question?
In a non-MP lisp, hunchentoot:start would block, which is what the sentence cited from the documentation explains.
I can't see any need for subclassing as Leslie has suggested.
-Hans
Hans Hübner wrote:
I can't see any need for subclassing as Leslie has suggested.
That's right, the :request-dispatcher initarg is enough.
Leslie