]> gitweb.factorcode.org Git - factor.git/blob - basis/http/server/server-docs.factor
Fixing assorted compile errors and help lint warnings
[factor.git] / basis / http / server / server-docs.factor
1 USING: help.markup help.syntax io.streams.string quotations strings urls http tools.vocabs math io.servers.connection ;
2 IN: http.server
3
4 HELP: trivial-responder
5 { $description "The class of trivial responders, which output the same response for every request. New instances are created by calling " { $link <trivial-responder> } "." } ;
6
7 HELP: <trivial-responder>
8 { $values { "response" response } { "trivial-responder" trivial-responder } }
9 { $description "Creates a new trivial responder which outputs the same response for every request." } ;
10
11 HELP: benchmark?
12 { $var-description "If set to a true value, the HTTP server will log the time taken to process each request." } ;
13
14 HELP: call-responder
15 { $values
16      { "path" "a sequence of strings" } { "responder" "a responder" }
17      { "response" response } }
18 { $description "Calls a responder." } ;
19
20 HELP: call-responder*
21 { $values
22      { "path" "a sequence of strings" } { "responder" "a responder" }
23      { "response" response } }
24 { $contract "Processes an HTTP request and returns a response." }
25 { $notes "When this word is called, various dynamic variables are set; see " { $link "http.server.requests" } "." } ;
26
27 HELP: development?
28 { $var-description "If set to a true value, the HTTP server will call " { $link refresh-all } " on each request, and error pages will contain stack traces." } ;
29
30 HELP: main-responder
31 { $var-description "The responder which will handle HTTP requests." } ;
32
33 HELP: post-request?
34 { $values { "?" "a boolean" } }
35 { $description "Outputs if the current request is a POST request.s" } ;
36
37 HELP: responder-nesting
38 { $description "A sequence of " { $snippet "{ path responder }" } " pairs." } ;
39
40 HELP: http-server
41 { $class-description "The class of HTTP servers. New instances are created by calling " { $link <http-server> } "." } ;
42
43 HELP: <http-server>
44 { $values { "server" http-server } }
45 { $description "Creates a new HTTP server with default parameters." } ;
46
47 HELP: httpd
48 { $values { "port" integer } }
49 { $description "Starts an HTTP server on the specified port number." }
50 { $notes "For more flexibility, use " { $link <http-server> } " and fill in the tuple slots before calling " { $link start-server } "." } ;
51
52 HELP: http-insomniac
53 { $description "Starts a thread which rotates the logs and e-mails a summary of HTTP requests every 24 hours. See " { $link "logging.insomniac" } "." } ;
54
55 ARTICLE: "http.server.requests" "HTTP request variables"
56 "The following variables are set by the HTTP server at the beginning of a request."
57 { $subsection request }
58 { $subsection url }
59 { $subsection post-request? }
60 { $subsection responder-nesting }
61 "Additional vocabularies may be set by vocabularies such as " { $vocab-link "html.forms" } " and " { $vocab-link "furnace.sessions" } "." ;
62
63 ARTICLE: "http.server.responders" "HTTP server responders"
64 "The HTTP server dispatches requests to a main responder:"
65 { $subsection main-responder }
66 "The main responder may in turn dispatch it a subordinate dispatcher, and so on."
67 $nl
68 "Responders process requests and output " { $link "http.responses" } "; concretely are instances of classes which implement a generic word:"
69 { $subsection call-responder* }
70 "To actually call a subordinate responder, use the following word instead:"
71 { $subsection call-responder }
72 "A simple implementation of a responder which always outputs the same response:"
73 { $subsection trivial-responder }
74 { $subsection <trivial-responder> }
75 { $vocab-subsection "Furnace actions" "furnace.actions" }
76 "In particular, writing new responders by hand is rarely necessary, because in most cases it is easier to use " { $vocab-link "furnace.actions" } " instead." ;
77
78 ARTICLE: "http.server.variables" "HTTP server variables"
79 "The following global variables control the behavior of the HTTP server. Both are off by default."
80 { $subsection development? }
81 { $subsection benchmark? } ;
82
83 ARTICLE: "http.server" "HTTP server"
84 "The " { $vocab-link "http.server" } " vocabulary implements an HTTP and HTTPS server on top of " { $vocab-link "io.servers.connection" } "."
85 { $subsection "http.server.responders" }
86 { $subsection "http.server.requests" }
87 "Various types of responders are defined in other vocabularies:"
88 { $subsection "http.server.dispatchers" }
89 { $subsection "http.server.filters" }
90 "Useful canned responses:"
91 { $subsection "http.server.responses" }
92 { $subsection "http.server.redirection" }
93 "Configuration:"
94 { $subsection "http.server.variables" }
95 { $subsection "http.server.remapping" }
96 "Features:"
97 { $subsection "http.server.static" }
98 { $subsection "http.server.cgi" }
99 "The " { $vocab-link "furnace" } " framework implements high-level abstractions which make developing web applications much easier than writing responders by hand." ;
100
101 ABOUT: "http.server"