[hunchentoot-devel] standalone server lw 5.0
Jens Teich
info at jensteich.de
Wed Mar 7 10:01:01 UTC 2007
Phlex wrote:
> Hello,
>
> 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.
>
> My config : lispworks 5.0, win32, firefox, standalone hunchentoot (no
> mod_lisp, no apache)
Try an easy-handler like this
(define-easy-handler (test :uri (prefixed "test"))()
(with-html-output-to-string (out)
(:html (:head (:title "Testpage"))
(:body "Hello World))))
Jens
More information about the Tbnl-devel
mailing list