furnace.alloy docs
parent
b17dbcd394
commit
faeacba224
|
@ -0,0 +1,42 @@
|
|||
IN: furnace.alloy
|
||||
USING: help.markup help.syntax db multiline ;
|
||||
|
||||
HELP: init-furnace-tables
|
||||
{ $description "Initializes database tables used by asides, conversations and session management. This word must be invoked inside a " { $link with-db } " scope." } ;
|
||||
|
||||
HELP: <alloy>
|
||||
{ $values { "responder" "a responder" } { "db" db } { "alloy" "an alloy responder" } }
|
||||
{ $description "Wraps the responder with support for asides, conversations, sessions and database persistence." }
|
||||
{ $examples
|
||||
"The " { $vocab-link "webapps.counter" } " vocabulary uses an alloy to configure the counter:"
|
||||
{ $code
|
||||
<" : counter-db ( -- db ) "counter.db" <sqlite-db> ;
|
||||
|
||||
: run-counter ( -- )
|
||||
<counter-app>
|
||||
counter-db <alloy>
|
||||
main-responder set-global
|
||||
8080 httpd ;">
|
||||
}
|
||||
} ;
|
||||
|
||||
HELP: start-expiring
|
||||
{ $values { "db" db } }
|
||||
{ $description "Starts a timer which expires old session state from the given database." } ;
|
||||
|
||||
ARTICLE: "furnace.alloy" "Furnace alloy responder"
|
||||
"The " { $vocab-link "furnace.alloy" } " vocabulary implements a convenience responder which combines several Furnace features into one easy-to-use wrapper:"
|
||||
{ $list
|
||||
{ $link "furnace.asides" }
|
||||
{ $link "furnace.conversations" }
|
||||
{ $link "furnace.sessions" }
|
||||
{ $link "furnace.db" }
|
||||
}
|
||||
"A word to wrap a responder in an alloy:"
|
||||
{ $subsection <alloy> }
|
||||
"Initializing database tables for asides, conversations and sessions:"
|
||||
{ $subsection init-furnace-tables }
|
||||
"Start a timer to expire asides, conversations and sessions:"
|
||||
{ $subsection start-expiring } ;
|
||||
|
||||
ABOUT: "furnace.alloy"
|
|
@ -0,0 +1,33 @@
|
|||
USING: help.markup help.syntax io.streams.string urls
|
||||
furnace.redirection http furnace.sessions furnace.db ;
|
||||
IN: furnace.asides
|
||||
|
||||
HELP: <asides>
|
||||
{ $values
|
||||
{ "responder" "a responder" }
|
||||
{ "responder'" asides }
|
||||
}
|
||||
{ $description "Creates a new " { $link asides } " responder wrapping an existing responder." } ;
|
||||
|
||||
HELP: begin-aside
|
||||
{ $values { "url" url } }
|
||||
{ $description "Begins an aside. When the current action returns a " { $link <redirect> } ", the redirect will have query parameters which reference the current page via an opaque handle." } ;
|
||||
|
||||
HELP: end-aside
|
||||
{ $values { "default" url } { "response" response } }
|
||||
{ $description "Ends an aside. If an aside is currently active, the response redirects the client " } ;
|
||||
|
||||
ARTICLE: "furnace.asides" "Furnace asides"
|
||||
"The " { $vocab-link "furnace.asides" } " vocabulary provides support for sending a user to a page which can then return to the former location."
|
||||
$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."
|
||||
$nl
|
||||
"Saving the current page in an aside which propagates through " { $link <redirect> } " responses:"
|
||||
{ $subsection begin-aside }
|
||||
"Returning from an aside:"
|
||||
{ $subsection end-aside }
|
||||
"Asides are used by " { $vocab-link "furnace.auth.login" } "; when the client requests a protected page, an aside begins and the client is redirected to a login page. Upon a successful login, the aside ends and the client returns to the protected page. If the client directly visits the login page and logs in, there is no current aside, so the client is sent to the default URL passed to " { $link end-aside } ", which in the case of login is the root URL." ;
|
||||
|
||||
ABOUT: "furnace.asides"
|
|
@ -0,0 +1,20 @@
|
|||
! Copyright (C) 2008 Your name.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: help.markup help.syntax io.streams.string ;
|
||||
IN: furnace.db
|
||||
|
||||
HELP: <db-persistence>
|
||||
{ $values
|
||||
{ "responder" null } { "db" null }
|
||||
{ "responder'" null }
|
||||
}
|
||||
{ $description "" } ;
|
||||
|
||||
HELP: db-persistence
|
||||
{ $description "" } ;
|
||||
|
||||
ARTICLE: "furnace.db" "Furnace database support"
|
||||
{ $vocab-link "furnace.db" }
|
||||
;
|
||||
|
||||
ABOUT: "furnace.db"
|
|
@ -0,0 +1,149 @@
|
|||
! 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 }
|
||||
{ "responder'" null }
|
||||
}
|
||||
{ $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 }
|
||||
{ "value" null }
|
||||
}
|
||||
{ $description "" } ;
|
||||
|
||||
HELP: sset
|
||||
{ $values
|
||||
{ "value" null } { "key" null }
|
||||
}
|
||||
{ $description "" } ;
|
||||
|
||||
HELP: touch-session
|
||||
{ $values
|
||||
{ "session" null }
|
||||
}
|
||||
{ $description "" } ;
|
||||
|
||||
HELP: verify-session
|
||||
{ $values
|
||||
{ "session" null }
|
||||
{ "session" null }
|
||||
}
|
||||
{ $description "" } ;
|
||||
|
||||
ARTICLE: "furnace.sessions" "Furnace sessions"
|
||||
{ $vocab-link "furnace.sessions" }
|
||||
;
|
||||
|
||||
ABOUT: "furnace.sessions"
|
Loading…
Reference in New Issue