Increasing crossrefs. Eli, you can include this in the release
svn: r12492
This commit is contained in:
parent
b35c6545a7
commit
ce734b819c
|
@ -11,7 +11,10 @@ configuring the @web-server .
|
||||||
|
|
||||||
@; ------------------------------------------------------------
|
@; ------------------------------------------------------------
|
||||||
@section[#:tag "configuration-table-structs.ss"]{Configuration Table Structure}
|
@section[#:tag "configuration-table-structs.ss"]{Configuration Table Structure}
|
||||||
@(require (for-label web-server/configuration/configuration-table-structs))
|
@(require (for-label web-server/configuration/configuration-table-structs
|
||||||
|
web-server/http
|
||||||
|
net/url
|
||||||
|
web-server/private/util))
|
||||||
|
|
||||||
@defmodule[web-server/configuration/configuration-table-structs]{
|
@defmodule[web-server/configuration/configuration-table-structs]{
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
#lang scribble/doc
|
#lang scribble/doc
|
||||||
@(require "web-server.ss"
|
@(require "web-server.ss"
|
||||||
|
(for-label web-server/http
|
||||||
|
net/url
|
||||||
|
web-server/servlet/setup
|
||||||
|
web-server/configuration/responders
|
||||||
|
web-server/private/servlet
|
||||||
|
scheme/date
|
||||||
|
web-server/private/util
|
||||||
|
web-server/private/connection-manager)
|
||||||
(for-syntax scheme/base))
|
(for-syntax scheme/base))
|
||||||
|
|
||||||
@(define-syntax (a-dispatcher stx)
|
@(define-syntax (a-dispatcher stx)
|
||||||
|
@ -70,7 +78,7 @@ Consider the following example dispatcher, that captures the essence of URL rewr
|
||||||
(code:comment "Call the inner dispatcher...")
|
(code:comment "Call the inner dispatcher...")
|
||||||
(inner conn
|
(inner conn
|
||||||
(code:comment "with a new request object...")
|
(code:comment "with a new request object...")
|
||||||
(copy-struct request req
|
(struct-copy request req
|
||||||
(code:comment "with a new URL!")
|
(code:comment "with a new URL!")
|
||||||
[request-uri (rule (request-uri req))]))))
|
[request-uri (rule (request-uri req))]))))
|
||||||
]
|
]
|
||||||
|
@ -109,7 +117,7 @@ URLs to paths on the filesystem.
|
||||||
by a file. The most prominent example is obviously servlets.}
|
by a file. The most prominent example is obviously servlets.}
|
||||||
|
|
||||||
@defproc[(filter-url->path [regex regexp?]
|
@defproc[(filter-url->path [regex regexp?]
|
||||||
[url->path url-path/c])
|
[url->path url->path/c])
|
||||||
url->path/c]{
|
url->path/c]{
|
||||||
Runs the underlying @scheme[url->path] but will only return if the path, when considered as a string,
|
Runs the underlying @scheme[url->path] but will only return if the path, when considered as a string,
|
||||||
matches the @scheme[regex]. This is useful to disallow strange files, like GIFs, from being considered
|
matches the @scheme[regex]. This is useful to disallow strange files, like GIFs, from being considered
|
||||||
|
@ -286,7 +294,7 @@ a URL that refreshes the password file, servlet cache, etc.}
|
||||||
|
|
||||||
@scheme[password-file] is parsed as:
|
@scheme[password-file] is parsed as:
|
||||||
@schemeblock[(list ([domain : string?]
|
@schemeblock[(list ([domain : string?]
|
||||||
[path : string-regexp?]
|
[path : string?] (code:comment "This string is interpreted as a regex")
|
||||||
(list [user : symbol?]
|
(list [user : symbol?]
|
||||||
[pass : string?])
|
[pass : string?])
|
||||||
...)
|
...)
|
||||||
|
@ -351,11 +359,11 @@ a URL that refreshes the password file, servlet cache, etc.}
|
||||||
@defproc[(make [url->servlet url->servlet/c]
|
@defproc[(make [url->servlet url->servlet/c]
|
||||||
[#:responders-servlet-loading
|
[#:responders-servlet-loading
|
||||||
responders-servlet-loading
|
responders-servlet-loading
|
||||||
((url url?) (exn exn?) . -> . response?)
|
(url? exn? . -> . response?)
|
||||||
servlet-loading-responder]
|
servlet-loading-responder]
|
||||||
[#:responders-servlet
|
[#:responders-servlet
|
||||||
responders-servlet
|
responders-servlet
|
||||||
((url url?) (exn exn?) . -> . response?)
|
(url? exn? . -> . response?)
|
||||||
servlet-error-responder])
|
servlet-error-responder])
|
||||||
dispatcher/c]{
|
dispatcher/c]{
|
||||||
This dispatcher runs Scheme servlets, using @scheme[url->servlet] to resolve URLs to the underlying servlets.
|
This dispatcher runs Scheme servlets, using @scheme[url->servlet] to resolve URLs to the underlying servlets.
|
||||||
|
|
|
@ -2,6 +2,12 @@
|
||||||
@(require "web-server.ss")
|
@(require "web-server.ss")
|
||||||
|
|
||||||
@title[#:tag "private" #:style 'toc]{Internal}
|
@title[#:tag "private" #:style 'toc]{Internal}
|
||||||
|
@(require (for-label scheme/tcp
|
||||||
|
web-server/dispatchers/dispatch
|
||||||
|
net/url
|
||||||
|
scheme/serialize
|
||||||
|
xml
|
||||||
|
net/tcp-sig))
|
||||||
|
|
||||||
The @web-server is a complicated piece of software and as a result,
|
The @web-server is a complicated piece of software and as a result,
|
||||||
defines a number of interesting and independently useful sub-components.
|
defines a number of interesting and independently useful sub-components.
|
||||||
|
@ -147,12 +153,15 @@ The @scheme[dispatch-server^] signature is an alias for
|
||||||
@defthing[initial-connection-timeout integer?]{Specifies the initial timeout given to a connection.}
|
@defthing[initial-connection-timeout integer?]{Specifies the initial timeout given to a connection.}
|
||||||
@defproc[(read-request [c connection?]
|
@defproc[(read-request [c connection?]
|
||||||
[p port?]
|
[p port?]
|
||||||
[port-addresses port-addresses?])
|
[port-addresses (-> port? boolean?
|
||||||
|
(or/c (values string? string?)
|
||||||
|
(values string? (integer-in 1 65535)
|
||||||
|
string? (integer-in 1 65535))))])
|
||||||
any/c]{
|
any/c]{
|
||||||
Defines the way the server reads requests off connections to be passed
|
Defines the way the server reads requests off connections to be passed
|
||||||
to @scheme[dispatch].
|
to @scheme[dispatch].
|
||||||
}
|
}
|
||||||
@defthing[dispatch dispatcher?]{How to handle requests.}
|
@defthing[dispatch dispatcher/c]{How to handle requests.}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,11 @@
|
||||||
@(require "web-server.ss")
|
@(require "web-server.ss")
|
||||||
|
|
||||||
@title[#:tag "setup.ss"]{Setting Up Servlets}
|
@title[#:tag "setup.ss"]{Setting Up Servlets}
|
||||||
@(require (for-label web-server/servlet/setup))
|
@(require (for-label web-server/servlet/setup
|
||||||
|
web-server/http
|
||||||
|
web-server/private/servlet
|
||||||
|
web-server/managers/manager
|
||||||
|
web-server/configuration/namespace))
|
||||||
|
|
||||||
@defmodule[web-server/servlet/setup]{
|
@defmodule[web-server/servlet/setup]{
|
||||||
|
|
||||||
|
@ -39,7 +43,7 @@ Equivalent to @scheme[(path? . -> . servlet?)].
|
||||||
@defproc[(make-default-path->servlet
|
@defproc[(make-default-path->servlet
|
||||||
[#:make-servlet-namespace
|
[#:make-servlet-namespace
|
||||||
make-servlet-namespace
|
make-servlet-namespace
|
||||||
make-servlet-namespace?
|
make-servlet-namespace/c
|
||||||
(make-make-servlet-namespace)]
|
(make-make-servlet-namespace)]
|
||||||
[#:timeouts-default-servlet
|
[#:timeouts-default-servlet
|
||||||
timeouts-default-servlet
|
timeouts-default-servlet
|
||||||
|
@ -50,4 +54,24 @@ Equivalent to @scheme[(path? . -> . servlet?)].
|
||||||
using a timeout manager with @scheme[timeouts-default-servlet] as the default timeout (if no manager is given.)
|
using a timeout manager with @scheme[timeouts-default-servlet] as the default timeout (if no manager is given.)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@section{Internal Servlet Representation}
|
||||||
|
|
||||||
|
@defmodule[web-server/private/servlet]{
|
||||||
|
@defstruct[servlet ([custodian custodian?]
|
||||||
|
[namespace namespace?]
|
||||||
|
[manager manager?]
|
||||||
|
[directory path?]
|
||||||
|
[handler (request? . -> . response?)])
|
||||||
|
#:mutable]{
|
||||||
|
Instances of this structure hold the necessary parts of a servlet:
|
||||||
|
the @scheme[custodian] responsible for the servlet's resources,
|
||||||
|
the @scheme[namespace] the servlet is executed within,
|
||||||
|
the @scheme[manager] responsible for the servlet's continuations,
|
||||||
|
the current @scheme[directory] of the servlet,
|
||||||
|
and the @scheme[handler] for all requests to the servlet.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,15 @@
|
||||||
|
|
||||||
@title[#:tag "web-config-unit.ss"
|
@title[#:tag "web-config-unit.ss"
|
||||||
#:style 'toc]{Web Config Unit}
|
#:style 'toc]{Web Config Unit}
|
||||||
@(require (for-label web-server/web-config-unit)
|
@(require (for-label web-server/web-config-unit
|
||||||
(for-label web-server/web-config-sig))
|
web-server/configuration/namespace
|
||||||
|
web-server/configuration/configuration-table
|
||||||
|
web-server/configuration/configuration-table-structs
|
||||||
|
web-server/private/util
|
||||||
|
web-server/servlet/setup
|
||||||
|
scheme/tcp
|
||||||
|
(prefix-in servlets: web-server/dispatchers/dispatch-servlets)
|
||||||
|
web-server/web-config-sig))
|
||||||
|
|
||||||
The @web-server offers a unit-based approach to configuring the server.
|
The @web-server offers a unit-based approach to configuring the server.
|
||||||
|
|
||||||
|
@ -40,8 +47,8 @@ Provides contains the following identifiers.
|
||||||
Passed to @scheme[tcp-accept].
|
Passed to @scheme[tcp-accept].
|
||||||
}
|
}
|
||||||
|
|
||||||
@defthing[make-servlet-namespace make-servlet-namespace?]{
|
@defthing[make-servlet-namespace make-servlet-namespace/c]{
|
||||||
Passed to @scheme[servlets:make].
|
Passed to @scheme[servlets:make] through @scheme[make-default-path->servlet].
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +61,7 @@ Provides contains the following identifiers.
|
||||||
@defproc[(configuration-table->web-config@ [path path?]
|
@defproc[(configuration-table->web-config@ [path path?]
|
||||||
[#:port port (or/c false/c port-number?) #f]
|
[#:port port (or/c false/c port-number?) #f]
|
||||||
[#:listen-ip listen-ip (or/c false/c string?) #f]
|
[#:listen-ip listen-ip (or/c false/c string?) #f]
|
||||||
[#:make-servlet-namespace make-servlet-namespace make-servlet-namespace? (make-make-servlet-namespace)])
|
[#:make-servlet-namespace make-servlet-namespace make-servlet-namespace/c (make-make-servlet-namespace)])
|
||||||
(unit? web-config^)]{
|
(unit? web-config^)]{
|
||||||
Reads the S-expression at @scheme[path] and calls
|
Reads the S-expression at @scheme[path] and calls
|
||||||
@scheme[configuration-table-sexpr->web-config@] appropriately.
|
@scheme[configuration-table-sexpr->web-config@] appropriately.
|
||||||
|
@ -64,7 +71,7 @@ Provides contains the following identifiers.
|
||||||
[#:web-server-root web-server-root path? (directory-part default-configuration-table-path)]
|
[#:web-server-root web-server-root path? (directory-part default-configuration-table-path)]
|
||||||
[#:port port (or/c false/c port-number?) #f]
|
[#:port port (or/c false/c port-number?) #f]
|
||||||
[#:listen-ip listen-ip (or/c false/c string?) #f]
|
[#:listen-ip listen-ip (or/c false/c string?) #f]
|
||||||
[#:make-servlet-namespace make-servlet-namespace make-servlet-namespace? (make-make-servlet-namespace)])
|
[#:make-servlet-namespace make-servlet-namespace make-servlet-namespace/c (make-make-servlet-namespace)])
|
||||||
(unit? web-config^)]{
|
(unit? web-config^)]{
|
||||||
Parses @scheme[sexpr] as a configuration-table and constructs a @scheme[web-config^] unit.
|
Parses @scheme[sexpr] as a configuration-table and constructs a @scheme[web-config^] unit.
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,12 @@
|
||||||
|
|
||||||
@title[#:tag "web-server-unit.ss"
|
@title[#:tag "web-server-unit.ss"
|
||||||
#:style 'toc]{Web Server Unit}
|
#:style 'toc]{Web Server Unit}
|
||||||
@(require (for-label web-server/web-server-sig)
|
@(require (for-label web-server/web-server-sig
|
||||||
(for-label web-server/web-server-unit))
|
web-server/web-server-unit
|
||||||
|
net/tcp-sig
|
||||||
|
web-server/dispatchers/dispatch
|
||||||
|
web-server/web-config-sig
|
||||||
|
web-server/web-config-unit))
|
||||||
|
|
||||||
The @web-server offers a unit-based approach to running the server.
|
The @web-server offers a unit-based approach to running the server.
|
||||||
|
|
||||||
|
@ -37,7 +41,7 @@ The @web-server offers a unit-based approach to running the server.
|
||||||
@defthing[web-server@ (unit/c (web-config^ tcp^)
|
@defthing[web-server@ (unit/c (web-config^ tcp^)
|
||||||
(web-server^))]{
|
(web-server^))]{
|
||||||
|
|
||||||
Uses the @scheme[web-config^] to construct a @scheme[dispatcher?]
|
Uses the @scheme[web-config^] to construct a @scheme[dispatcher/c]
|
||||||
function that sets up one virtual host dispatcher, for each virtual
|
function that sets up one virtual host dispatcher, for each virtual
|
||||||
host in the @scheme[web-config^], that sequences the following
|
host in the @scheme[web-config^], that sequences the following
|
||||||
operations:
|
operations:
|
||||||
|
@ -52,7 +56,7 @@ operations:
|
||||||
@item{Serves files under the @scheme["/"] URL in the given htdocs directory.}
|
@item{Serves files under the @scheme["/"] URL in the given htdocs directory.}
|
||||||
]
|
]
|
||||||
|
|
||||||
Using this @scheme[dispatcher?], it loads a dispatching server that provides @scheme[serve]
|
Using this @scheme[dispatcher/c], it loads a dispatching server that provides @scheme[serve]
|
||||||
and @scheme[serve-ports] functions that operate as expected.
|
and @scheme[serve-ports] functions that operate as expected.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user