Document furnace.conversations

db4
Slava Pestov 2008-11-14 21:59:15 -06:00
parent 96545ca6ea
commit e6da3dc638
6 changed files with 58 additions and 119 deletions

View File

@ -5,7 +5,7 @@ IN: furnace.asides
HELP: <asides>
{ $values
{ "responder" "a responder" }
{ "responder'" asides }
{ "responder'" "a new responder" }
}
{ $description "Creates a new " { $link asides } " responder wrapping an existing responder." } ;
@ -22,7 +22,7 @@ ARTICLE: "furnace.asides" "Furnace asides"
$nl
"To use asides, wrap your responder in an aside responder:"
{ $subsection <asides> }
"The aside responder must be wrapped inside a session responder (" { $link <sessions> } "), which in turn must be wrapped inside a database persistence responder (" { $link <db-persistence> } "). The " { $vocab-link "furnace.alloy" } " vocabulary combines all of these responders into one."
"The asides responder must be wrapped inside a session responder (" { $link <sessions> } "), which in turn must be wrapped inside a database persistence responder (" { $link <db-persistence> } "). The " { $vocab-link "furnace.alloy" } " vocabulary combines all of these responders into one."
$nl
"Saving the current page in an aside which propagates through " { $link <redirect> } " responses:"
{ $subsection begin-aside }

View File

@ -1,5 +1,3 @@
! Copyright (C) 2008 Your name.
! See http://factorcode.org/license.txt for BSD license.
USING: help.markup help.syntax io.streams.string
http.server.dispatchers ;
IN: furnace.boilerplate

View File

@ -1,6 +1,53 @@
USING: help.markup help.syntax ;
USING: help.markup help.syntax urls http words kernel
furnace.sessions furnace.db ;
IN: furnace.conversations
ARTICLE: "furnace.conversations" "Furnace conversation scope"
HELP: <conversations>
{ $values
{ "responder" "a responder" }
{ "responder'" "a new responder" }
}
{ $description "Creates a new " { $link conversations } " responder wrapping an existing responder." } ;
;
HELP: begin-conversation
{ $description "Starts a new conversation scope. Values can be stored in the conversation scope with " { $link cset } ", and the conversation can be continued with " { $link <continue-conversation> } "." } ;
HELP: end-conversation
{ $description "Ends the current conversation scope." } ;
HELP: <continue-conversation>
{ $values { "url" url } { "response" response } }
{ $description "Creates an HTTP response which redirects the client to the specified URL while continuing the conversation. Any values set in the current conversation scope will be visible to the resonder handling the URL." } ;
HELP: cget
{ $values { "key" symbol } { "value" object } }
{ $description "Outputs the value of a conversation variable." } ;
HELP: cset
{ $values { "value" object } { "key" symbol } }
{ $description "Sets the value of a conversation variable." } ;
HELP: cchange
{ $values { "key" symbol } { "quot" "a quotation with stack effect " { $snippet "( old -- new )" } } }
{ $description "Applies the quotation to the old value of the conversation variable, and assigns the resulting value back to the variable." } ;
ARTICLE: "furnace.conversations" "Furnace conversation scope"
"The " { $vocab-link "furnace.conversations" } " vocabulary implements conversation scope, which allows data to be passed between requests on a finer level of granularity than session scope."
$nl
"Conversation scope is used by form validation to pass validation errors between requests."
$nl
"To use conversation scope, wrap your responder in an conversation responder:"
{ $subsection <conversations> }
"The conversations responder must be wrapped inside a session responder (" { $link <sessions> } "), which in turn must be wrapped inside a database persistence responder (" { $link <db-persistence> } "). The " { $vocab-link "furnace.alloy" } " vocabulary combines all of these responders into one."
$nl
"Managing conversation scopes:"
{ $subsection begin-conversation }
{ $subsection end-conversation }
{ $subsection <continue-conversation> }
"Reading and writing conversation variables:"
{ $subsection cget }
{ $subsection cset }
{ $subsection cchange }
"Note that conversation scope is serialized as part of the session, which means that only serializable objects can be stored there. See " { $link "furnace.sessions.serialize" } " for details." ;
ABOUT: "furnace.conversations"

View File

@ -166,10 +166,8 @@ ARTICLE: "furnace" "Furnace web framework"
}
"Major functionality:"
{ $subsection "furnace.actions" }
{ $subsection "furnace.syndication" }
{ $subsection "furnace.boilerplate" }
{ $subsection "furnace.db" }
"Server-side state:"
{ $subsection "furnace.db" }
{ $subsection "furnace.sessions" }
{ $subsection "furnace.conversations" }
{ $subsection "furnace.asides" }
@ -180,8 +178,10 @@ ARTICLE: "furnace" "Furnace web framework"
{ $subsection "html.templates" }
{ $subsection "html.templates.chloe" }
{ $subsection "html.templates.fhtml" }
{ $subsection "furnace.boilerplate" }
"Utilities:"
{ $subsection "furnace.alloy" }
{ $subsection "furnace.syndication" }
{ $subsection "furnace.json" }
{ $subsection "furnace.redirection" }
{ $subsection "furnace.referrer" } ;

View File

@ -1,22 +1,6 @@
! Copyright (C) 2008 Your name.
! See http://factorcode.org/license.txt for BSD license.
USING: help.markup help.syntax io.streams.string quotations strings ;
IN: furnace.sessions
HELP: <session-cookie>
{ $values
{ "cookie" null }
}
{ $description "" } ;
HELP: <session>
{ $values
{ "id" null }
{ "session" null }
}
{ $description "" } ;
HELP: <sessions>
{ $values
{ "responder" null }
@ -24,98 +8,18 @@ HELP: <sessions>
}
{ $description "" } ;
HELP: begin-session
{ $values
{ "session" null }
}
{ $description "" } ;
HELP: check-session
{ $values
{ "state/f" null }
{ "state/f" null }
}
{ $description "" } ;
HELP: empty-session
{ $values
{ "session" null }
}
{ $description "" } ;
HELP: existing-session
{ $values
{ "path" "a pathname string" } { "session" null }
{ "response" null }
}
{ $description "" } ;
HELP: get-session
{ $values
{ "id" null }
{ "session" null }
}
{ $description "" } ;
HELP: init-session
{ $values
{ "session" null }
}
{ $description "" } ;
HELP: init-session*
{ $values
{ "responder" null }
}
{ $description "" } ;
HELP: put-session-cookie
{ $values
{ "response" null }
{ "response'" null }
}
{ $description "" } ;
HELP: remote-host
{ $values
{ "string" string }
}
{ $description "" } ;
HELP: request-session
{ $values
{ "session/f" null }
}
{ $description "" } ;
HELP: save-session-after
{ $values
{ "session" null }
}
{ $description "" } ;
HELP: schange
{ $values
{ "key" null } { "quot" quotation }
}
{ $description "" } ;
HELP: session
{ $description "" } ;
HELP: session-changed
{ $description "" } ;
HELP: session-id-key
{ $description "" } ;
HELP: sessions
{ $description "" } ;
HELP: sget
{ $values
{ "key" null }
@ -129,21 +33,13 @@ HELP: sset
}
{ $description "" } ;
HELP: touch-session
{ $values
{ "session" null }
}
{ $description "" } ;
ARTICLE: "furnace.sessions.serialize" "Session state serialization"
HELP: verify-session
{ $values
{ "session" null }
{ "session" null }
}
{ $description "" } ;
;
ARTICLE: "furnace.sessions" "Furnace sessions"
{ $vocab-link "furnace.sessions" }
;
ABOUT: "furnace.sessions"

View File

@ -1,5 +1,3 @@
! Copyright (C) 2008 Your name.
! See http://factorcode.org/license.txt for BSD license.
USING: help.markup help.syntax io.streams.string kernel sequences strings urls ;
IN: furnace.syndication