How to disable static file serving with hunchentoot?

Viewed 68

I was browsing hunchentoot documentation and source files for the better part of last night but could not find a hint as to how to disable static file serving.

All I want is to write a few handlers, which reply to HTTP Post requests. Since I did not find any hints as to how to disable static file sharing in the documentation, I feel unable to give any "coding attempt" here, along with this question.

My current (untested first attempt) is, giving :document-root the value nil but it is undocumented what hunchentoot will do with that (either what I want or use default root-dir...).

(let ((acceptor (make-instance 'hunchentoot:easy-acceptor
                 :port port
                 :document-root nil
                 :name 'storage-acceptor)))
   ;; ...
)

The fact, that hunchentoot seems to use CLOS heavily makes it even harder for me, because I usually avoid CLOS and stick to "normal" lisp programming (also for performance reasons...).

The other point of confusion of hunchentoot arises from some (for me, at least) new kind of global variable usage (I never saw defvar-unbound or anything similar before).

So, if you provide sample snippets of how to disable file serving with hunchentoot, do not assume too much about my CLOS and global variable technique knowledge.

Also, I want to use the single-threaded-acceptor in my code, because hunchentoot will run in an lparallel task on a single thread in my program. Not sure if that has an impact on your answers, though.

1 Answers

From reading the initialization and use in acceptor.lisp, I'd be pretty sure that setting document-root explicitly to nil will disable lookup of static files from the file system. I agree that this should be tested and added to the documentation.

Related