[hunchentoot-devel] standalone server lw 5.0
Edi Weitz
edi at agharta.de
Wed Mar 7 10:11:15 UTC 2007
On Wed, 07 Mar 2007 10:48:43 +0100, Phlex <Phlex at telenet.be> wrote:
> I'm a user of tbnl and finally decided to make the switch to
> hunchentoot. When trying what's below, i get an empty page in the
> web browser.
>
> Here is what i'm trying :
>
> (defparameter *web-server* (start-server :port 3000))
>
> (defmacro with-html (&body body)
> `(with-html-output-to-string (*standard-output* nil :prologue t)
> , at body))
>
> (defparameter *original-standard-output* *standard-output*)
>
> (defmethod dispatch-request :around (dispatch-table)
> (pprint "coucou1" *original-standard-output*)
> (let ((result (call-next-method)))
> (pprint result *original-standard-output*)
> (pprint "coucou2" *original-standard-output*)
> result))
>
> (defun bleh ()
> (with-html
> (:html
> (:head (:title "easy demo"))
> (:body "That's bleh !"))))
>
> (setq *dispatch-table* (list (create-prefix-dispatcher "/" #'bleh)))
>
> Here is what i see on my standard ouput when i try to visit the web
> site at this address : http://localhost:3000/
>
> "coucou1"
> "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
> \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"><html><head><title>easy
> demo</title></head><body>That's bleh !</body></html>"
> "coucou2"
>
> So it seems that everything goes well ... i'm at a loss wrt what i
> should do now to actually see the web page ... Thanks in advance
> for any pointer.
Your example works fine for me if entered in the order you showed
above (assuming you're within a package where the Hunchentoot and
CL-WHO symbols are accessible).
If you don't see anything in your browser, my /guess/ is that maybe
you redefined BLEH. I'd recommend using
(setq *dispatch-table* (list (create-prefix-dispatcher "/" 'bleh)))
instead, so changes to BLEH are immediately picked up.
Let us know if that doesn't help.
Cheers,
Edi.
More information about the Tbnl-devel
mailing list