up
svn: r8339
This commit is contained in:
parent
1f3605562a
commit
cc3ef674b8
|
@ -52,7 +52,27 @@ dispatcher. See @filepath{run.ss} for an example of such a script.
|
||||||
Constructs an appropriate @scheme[dispatch-config^], invokes the @scheme[dispatch-server\@],
|
Constructs an appropriate @scheme[dispatch-config^], invokes the @scheme[dispatch-server\@],
|
||||||
and calls its @scheme[serve] function.
|
and calls its @scheme[serve] function.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@; XXX Not the right `server' above.
|
||||||
|
|
||||||
|
Here's an example of a simple web server that serves files
|
||||||
|
from a given path:
|
||||||
|
|
||||||
|
@require[(for-label web-server/dispatchers/filesystem-map)]
|
||||||
|
@require[(prefix-in files: (for-label web-server/dispatchers/dispatch-files))]
|
||||||
|
|
||||||
|
@schemeblock[
|
||||||
|
(define (start-file-server base)
|
||||||
|
(serve
|
||||||
|
#:dispatch
|
||||||
|
(files:make
|
||||||
|
#:url->path (make-url->path base)
|
||||||
|
#:path->mime-type
|
||||||
|
(lambda (path)
|
||||||
|
#"application/octet-stream"))
|
||||||
|
#:port 8080))
|
||||||
|
]
|
||||||
|
|
||||||
@defproc[(serve/ports [#:dispatch dispatch dispatcher?]
|
@defproc[(serve/ports [#:dispatch dispatch dispatcher?]
|
||||||
[#:tcp\@ tcp\@ tcp-unit^ raw:tcp\@]
|
[#:tcp\@ tcp\@ tcp-unit^ raw:tcp\@]
|
||||||
[#:ports ports (listof integer?) (list 80)]
|
[#:ports ports (listof integer?) (list 80)]
|
||||||
|
|
|
@ -12,7 +12,7 @@ of these servlets. This API is provided by @filepath{servlet.ss}.
|
||||||
|
|
||||||
@; ------------------------------------------------------------
|
@; ------------------------------------------------------------
|
||||||
@section[#:tag "module-servlets"]{Definition}
|
@section[#:tag "module-servlets"]{Definition}
|
||||||
@require[(for-label "dummy-servlet.ss")] ; to give a binding context
|
@require[(for-label "dummy-servlet.ss")] @; to give a binding context
|
||||||
|
|
||||||
@declare-exporting[web-server/scribblings/dummy-servlet]
|
@declare-exporting[web-server/scribblings/dummy-servlet]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user