PageRenderTime 1680ms CodeModel.GetById 17ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 1653ms

/extra/webapps/ip/ip.factor

http://github.com/abeaumont/factor
Unknown | 23 lines | 18 code | 5 blank | 0 comment | 0 complexity | 0a9c76cdbd1bf189f51a9fac4f4ffaec MD5 | raw file
 1! Copyright (C) 2008 Doug Coleman.
 2! See http://factorcode.org/license.txt for BSD license.
 3USING: accessors furnace.actions http.server
 4http.server.dispatchers html.forms io.sockets
 5namespaces prettyprint kernel ;
 6IN: webapps.ip
 7
 8TUPLE: ip-app < dispatcher ;
 9
10: <display-ip-action> ( -- action )
11    <page-action>
12        [ remote-address get host>> "ip" set-value ] >>init
13        { ip-app "ip" } >>template ;
14
15: <ip-app> ( -- dispatcher )
16    ip-app new-dispatcher
17        <display-ip-action> "" add-responder ;
18
19: run-ip-app ( -- )
20    <ip-app> main-responder set-global
21    8080 httpd drop ;
22
23MAIN: run-ip-app