Dun*_*yne 1 common-lisp hunchentoot
www我正在尝试从项目内的目录中使用 Hunchentoot 提供静态文件。我的接受者定义为:
(defvar *acceptor* (make-instance 'easy-acceptor
:port 4242
:document-root (truename "./www/")))
Run Code Online (Sandbox Code Playgroud)
然后我开始:
(start *acceptor*)
Run Code Online (Sandbox Code Playgroud)
接受器可以工作,因为我可以使用它define-easy-handler来创建根页面:
(define-easy-handler (index :uri "/") ()
(with-html-output-to-string (_)
(:html
(:head
(:title "Hello world")
(:body
(:h1 "Hello world!))))))
Run Code Online (Sandbox Code Playgroud)
...当我浏览到http://localhost:4242/时,我看到了该页面。
但我的目录中没有提供静态文件www。例如,如果我创建www/jquery-3.2.1.min.js并浏览到http://localhost:4242/jquery-3.2.1.min.js我会收到 404。
127.0.0.1 - [2017-08-11 08:08:02] "GET /jquery-3.2.1.min.js HTTP/1.1" 404 355 "-" "Mozilla/5.0 (X11; FreeBSD amd64; rv:54.0) Gecko/20100101 Firefox/54.0"
HELLOWORLD> (directory (make-pathname :directory '(:relative "www") :name :wild :type "js"))
(#P"/usr/home/duncan/code/helloworld/www/jquery-3.2.1.min.js")
Run Code Online (Sandbox Code Playgroud)