#lang scheme/base
(require web-server/servlet-env
mzlib/etc
)
(require (only-in web-server/servlet current-servlet-continuation-expiration-handler)
web-server/managers/lru
web-server/http/request-structs
web-server/dispatchers/dispatch
net/url
mzlib/etc
"main.ss"
"depend.ss"
)
(provide (all-defined-out))
(define interface-version 'v2)
(define manager
(create-LRU-manager current-servlet-continuation-expiration-handler
60
3600
(lambda () #t)
#:initial-count 1
#:inform-p (lambda _ (void))))
(define (start-shp-server! path
#:htdocs (htdocs #f)
#:port (port 8080)
#:default (default "index")
#:not-found (not-found #f)
#:required (required "/include/required")
#:topfilter (topfilter #f)
#:chrome (chrome #f))
(let ((shp (make-shp-handler path
#:default default
#:required required
#:topfilter topfilter
#:chrome chrome
#:htdocs htdocs)))
(thread (lambda ()
(serve/servlet shp
#:port port
#:servlet-path "/"
#:launch-browser? #f
#:listen-ip #f
#:servlet-namespace (list (path->string (this-expression-file-name)))
#:servlets-root path
#:servlet-regexp #px".*"
#:server-root-path path
#:extra-files-paths
(list (cond ((not htdocs)
(build-path path 'up "file"))
((string? htdocs) (string->path htdocs))
(else htdocs)))
)))
shp))