[plt-scheme] plt-web-server configuration

From: Marek Kubica (marek at xivilization.net)
Date: Mon Oct 27 17:25:44 EDT 2008

On Mon, 27 Oct 2008 12:17:49 -0600
"Jay McCarthy" <jay.mccarthy at gmail.com> wrote:
 
> @ is a unit.
> 
> ^ is a unit signature.
> 
> A unit is (essentially) a parameterized module. In this case, the
> web-server@ is parameterized over its configuration, which is
> represented by another unit with a bunch of functions and values that
> define its behavior.

Thanks. I tried asking in #scheme, but except for Eli and Grant didn't
see anybody I know from the PLT mailing list.

> You want to look at web-server/private/launch.ss and essentially
> change configuration@ to whatever web-config@ you get from parsing the
> configuration table.

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.

I would appreciate any hints!

regards,
Marek


Posted on the users mailing list.