PageRenderTime 325ms CodeModel.GetById 274ms app.highlight 2ms RepoModel.GetById 47ms app.codeStats 0ms

/counter_test.io

http://github.com/pgregory/blackpool
Unknown | 26 lines | 21 code | 5 blank | 0 comment | 0 complexity | 06e7cfb6d3faa616e16e2f008cf15d5b MD5 | raw file
 1Importer addSearchPath(Directory currentWorkingDirectory asMutable appendPathSeq("lib"))
 2Importer addSearchPath(Directory currentWorkingDirectory asMutable appendPathSeq("app/models"))
 3Importer addSearchPath(Directory currentWorkingDirectory asMutable appendPathSeq("app/components"))
 4
 5server := HttpServer clone do(
 6  setPort(8090)
 7
 8  sessions := Registry clone
 9
10  renderResponse := method(request, response,
11    session := nil
12    cookie := request cookies at("ioweb")
13    if (cookie != nil, session = sessions find(cookie))
14    if (session == nil,
15      session = Session clone do(
16        root ::= MyCounter clone
17        writeln("Cloned!")
18      )
19      response setCookie("ioweb", sessions register(session))
20    )
21
22    session handle(request, response)
23  )
24)
25
26server start