[plt-scheme] plt-web-server configuration
On Mon, Oct 27, 2008 at 3:25 PM, Marek Kubica <marek at xivilization.net> wrote:
> Right, several copy&paste, trying stuff in the interpreter etc. I got
> this to work:
>
> #lang scheme
> (require web-server/configuration/configuration-table
> web-server/configuration/configuration-table-structs
> web-server/web-config-unit
> web-server/web-config-sig
> web-server/web-server-unit
> web-server/web-server-sig
> net/tcp-sig
> (only-in web-server/web-server do-not-return))
>
> (define current-configuration-table
> (read-configuration-table default-configuration-table-path))
>
> (set-configuration-table-port! current-configuration-table
> 4113)
>
> (define current-configuration-sexpr
> (configuration-table->sexpr current-configuration-table))
>
> (define configuration@ (configuration-table-sexpr->web-config@
> current-configuration-sexpr))
>
> (define-compound-unit launch@
> (import (T : tcp^))
> (export S)
> (link
> [((C : web-config^)) configuration@]
> [((S : web-server^)) web-server@ T C]))
>
> (define-values/invoke-unit
> launch@
> (import tcp^)
> (export web-server^))
>
> (provide serve)
> (void (serve))
> (do-not-return)
>
> It starts the server properly, but unfortunately the server does not
> find any servlets. Or anything else in the directory containing the
> launcher.
>
> The relevant entry from the configuration-table would probably be
>
> (paths
> (configuration-root "conf")
> (host-root ".")
> (log-file-path "log")
> (file-root "htdocs")
> (servlet-root ".")
> (mime-types "mime.types")
> (password-authentication "passwords"))))
>
> so when I have a servlet headers.scm I should be able to access it
> through http://server:port/headers.scm right? I also tried copying the
> file to a servlets subdirectory in the same way like the default server
> does, but it still doesn't work as expected.
One of the unfortunate things about the configuration table format is
that the 'servlet-root' doesn't say where in 'htdocs' servlets are
searched for. Instead, it says where relative to 'host-root' the
"servlets" directory should be. The name "servlets" is hard-coded.
Jay
--
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://jay.teammccarthy.org
"The glory of God is Intelligence" - D&C 93