[kpax-devel] static-path

Sven Van Caekenberghe scaekenberghe at common-lisp.net
Mon May 28 07:55:08 UTC 2007


On 27 May 2007, at 18:37, Matthias Teege wrote:

> Moin,
>
> some days ago I ask about static-path and I've got a detailed answer
> from Sven. Many thanks for that. I've killed the Email to early so I
> have to open a new thread.
>
> I don't get static paths to work. I checked /s-http-server and there
> ist no static-handler registered.
>
> On http://kpax.wolf359.be/s-http-server it looks like:
>
> S-HTTP-SERVER:STATIC-RESOURCE-HANDLER /kpax/static/ (#P"/home/sven/ 
> darcs/kpax/example/static/")
> ...
>
> but on my server:
>
> #<CLOSURE (FLET KPAX::S-HTTP-SERVER-HANDLER) {A9B0C6D}> /kpax/ 
> dynamic/ NIL
> S-HTTP-SERVER:S-HTTP-SERVER-HANDLER	/s-http-server	(:BUILTIN)
> S-HTTP-SERVER:FAVICON-HANDLER	/favicon.ico	(:BUILTIN)
>
> Thats all. Do I need to register a static-handler? How do I register
> the static-handler?
>
> Many thanks again
> Matthias

In the KPAX + S-HTTP-SERVER case, the static paths should be added  
automatically when you start KPAX. More specifically, every web-app  
registered is started when KPAX starts, when KPAX stops the are all  
stopped. Part of starting a web-app is ensuring the static serving  
part works.

KPAX 22 > (start-kpax)
;; KPAX 20070528T074956 INFO Started #<WEB-APP :TODO-LIST 2259251F>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :SECURE-LOGIN 225A72BF>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :SERVER 21B25A37>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :FORMS1 225610D7>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :KIWI 225949BF>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :LSP 225961EF>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :UPLOAD1 2258792F>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :NANO 221446CB>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :STARGATE 2215AA0B>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :HELLOWORLD1 225915EB>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :SNOOP1 2256221B>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :MENU1 22564F33>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :SESSION1 225ABD07>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :BROWSER1 225AABBF>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :FORMS2 2256C5AF>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :CALCULATOR 225AEA3F>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :PI 225A4CE7>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :TABS1 22563B27>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :FACTORIAL1 225AC91F>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :BENCHMARK1 22569B2F>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :LIST-WEB-APPS 22565CCB>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :WIKI 225947F3>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :UPLOAD2 2258946F>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :SECURE1 22586E13>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :REDDIT 225A0EFB>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :UPLOAD3 225ACCE3>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :WELCOME 20C9181F>
;; KPAX 20070528T074956 INFO Started #<WEB-APP :NO-SESSION1 22562827>
;; KPAX 20070528T074956 INFO Server running
#<S-HTTP-SERVER :RUNNING 200F0D87>

KPAX 23 > (pprint (s-http-server:get-contexts (get-s-http-server *web- 
app-server*)))

((S-HTTP-SERVER:STATIC-RESOURCE-HANDLER "/kpax/static/" #P"/Users/ 
sven/darcs/kpax/example/static/")
(#<Closure ((METHOD INIT (S-HTTP-SERVER)) . S-HTTP-SERVER-HANDLER)  
200F0922> "/kpax/dynamic/")
(S-HTTP-SERVER:S-HTTP-SERVER-HANDLER "/s-http-server" :BUILTIN)
(S-HTTP-SERVER:FAVICON-HANDLER "/favicon.ico" :BUILTIN))

KPAX 24 > (stop-kpax)
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :TODO-LIST 2259251F>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :SECURE-LOGIN 225A72BF>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :SERVER 21B25A37>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :FORMS1 225610D7>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :KIWI 225949BF>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :LSP 225961EF>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :UPLOAD1 2258792F>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :NANO 221446CB>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :STARGATE 2215AA0B>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :HELLOWORLD1 225915EB>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :SNOOP1 2256221B>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :MENU1 22564F33>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :SESSION1 225ABD07>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :BROWSER1 225AABBF>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :FORMS2 2256C5AF>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :CALCULATOR 225AEA3F>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :PI 225A4CE7>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :TABS1 22563B27>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :FACTORIAL1 225AC91F>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :BENCHMARK1 22569B2F>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :LIST-WEB-APPS 22565CCB>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :WIKI 225947F3>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :UPLOAD2 2258946F>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :SECURE1 22586E13>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :REDDIT 225A0EFB>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :UPLOAD3 225ACCE3>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :WELCOME 20C9181F>
;; KPAX 20070528T075114 INFO Stopped #<WEB-APP :NO-SESSION1 22562827>
;; KPAX 20070528T075114 INFO Server stopped and ready
#<S-HTTP-SERVER :READY 200F0D87>

You can manually do start-web-app or stop-web-app. The auto-start/ 
stop trick is relatively recent.

Are you sure you have your web-app(s) defined/loaded ?

HTH,

Sven




More information about the kpax-devel mailing list