1 USING: assocs help.markup help.syntax kernel
2 quotations sequences strings urls xml.data http ;
5 HELP: adjust-redirect-url
6 { $values { "url" url } { "url'" url } }
7 { $description "Adjusts a redirection URL by filtering the URL's query parameters through the " { $link modify-redirect-query } " generic word on every responder involved in handling the current request." } ;
10 { $values { "url" url } { "url'" url } }
11 { $description "Adjusts a link URL by filtering the URL's query parameters through the " { $link modify-query } " generic word on every responder involved in handling the current request." } ;
14 { $values { "key" string } { "value/f" { $maybe string } } }
15 { $description "Looks up a cookie (if the current request is a GET or HEAD request) or a POST parameter (if the current request is a POST request)." }
16 { $notes "This word is used by session management, conversation scope and asides." } ;
19 { $values { "quot" { $quotation "( responder -- )" } } }
20 { $description "Applies the quotation to each responder involved in processing the current request." } ;
22 HELP: hidden-form-field
23 { $values { "value" string } { "name" string } }
24 { $description "Renders an HTML hidden form field tag." }
25 { $notes "This word is used by session management, conversation scope and asides." }
28 "USING: furnace.utilities io ;"
29 "\"bar\" \"foo\" hidden-form-field nl"
30 "<input type='hidden' name='foo' value='bar'/>"
35 { $values { "tag" tag } { "responder" "a responder" } }
36 { $contract "Modifies an XHTML " { $snippet "a" } " tag." }
37 { $notes "This word is called by " { $link "html.templates.chloe.tags.form" } "." }
38 { $examples "Conversation scope adds attributes to link tags." } ;
41 { $values { "responder" "a responder" } }
42 { $contract "Emits hidden form fields using " { $link hidden-form-field } "." }
43 { $notes "This word is called by " { $link "html.templates.chloe.tags.form" } "." }
44 { $examples "Session management, conversation scope and asides use hidden form fields to pass state." } ;
47 { $values { "query" assoc } { "responder" "a responder" } { "query'" assoc } }
48 { $contract "Modifies the query parameters of a URL destined to be displayed as a link." }
49 { $notes "This word is called by " { $link "html.templates.chloe.tags.form" } "." }
50 { $examples "Asides add query parameters to URLs." } ;
52 HELP: modify-redirect-query
53 { $values { "query" assoc } { "responder" "a responder" } { "query'" assoc } }
54 { $contract "Modifies the query parameters of a URL destined to be used with a redirect." }
55 { $notes "This word is called by " { $link "furnace.redirection" } "." }
56 { $examples "Conversation scope and asides add query parameters to redirect URLs." } ;
58 HELP: nested-responders
59 { $values { "seq" "a sequence of responders" } }
63 { $values { "referrer/f" { $maybe string } } }
64 { $description "Outputs the current request's referrer URL." } ;
67 { $values { "request" request } { "assoc" assoc } }
68 { $description "Outputs the query parameters (if the current request is a GET or HEAD request) or the POST parameters (if the current request is a POST request)." } ;
70 HELP: resolve-base-path
71 { $values { "string" string } { "string'" string } }
74 HELP: resolve-template-path
75 { $values { "pair" "a pair with shape " { $snippet "{ class string }" } } { "path" "a pathname string" } }
79 { $values { "url" url } { "?" "a boolean" } }
80 { $description "Tests if the given URL is located on the same host as the URL of the current request." } ;
83 { $values { "user-agent" { $maybe string } } }
84 { $description "Outputs the user agent reported by the client for the current request." } ;
87 { $values { "vocab" "a vocabulary specifier" } { "path" "a pathname string" } }
91 { $values { "value" object } }
92 { $description "Exits from an outer " { $link with-exit-continuation } "." } ;
94 HELP: with-exit-continuation
95 { $values { "quot" { $quotation { "( -- value )" } } } { "value" "a value returned by the quotation or an " { $link exit-with } " invocation" } }
96 { $description "Runs a quotation with the " { $link exit-continuation } " variable bound. Calling " { $link exit-with } " in the quotation will immediately return." }
97 { $notes "Furnace actions and authentication realms wrap their execution in this combinator, allowing form validation failures and login requests, respectively, to immediately return an HTTP response to the client without running any more responder code." } ;
99 ARTICLE: "furnace.extension-points" "Furnace extension points"
100 "Furnace features such as session management, conversation scope and asides need to modify URLs in links and redirects, and insert hidden form fields, to implement state on top of the stateless HTTP protocol. In order to decouple the server-side state management code from the HTML templating code, a series of hooks are used."
102 "Responders can implement methods on the following generic words:"
103 { $subsection modify-query }
104 { $subsection modify-redirect-query }
105 { $subsection link-attr }
106 { $subsection modify-form }
107 "Presentation-level code can call the following words:"
108 { $subsection adjust-url }
109 { $subsection adjust-redirect-url } ;
111 ARTICLE: "furnace.misc" "Miscellaneous Furnace features"
112 "Inspecting the chain of responders handling the current request:"
113 { $subsection nested-responders }
114 { $subsection each-responder }
115 { $subsection resolve-base-path }
116 "Vocabulary root-relative resources:"
117 { $subsection vocab-path }
118 { $subsection resolve-template-path }
119 "Early return from a responder:"
120 { $subsection with-exit-continuation }
121 { $subsection exit-with }
122 "Other useful words:"
123 { $subsection hidden-form-field }
124 { $subsection request-params }
125 { $subsection client-state }
126 { $subsection user-agent } ;