wee 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (231) hide show
  1. data/ChangeLog +286 -0
  2. data/Features +185 -0
  3. data/doc/rdoc/classes/ActionView.html +107 -0
  4. data/doc/rdoc/classes/ActionView/Base.html +133 -0
  5. data/doc/rdoc/classes/Array.html +7 -59
  6. data/doc/rdoc/classes/Cache/StorageCache.html +38 -38
  7. data/doc/rdoc/classes/Cache/Strategy/CapacityBounded.html +30 -30
  8. data/doc/rdoc/classes/Cache/Strategy/LFU.html +24 -24
  9. data/doc/rdoc/classes/Cache/Strategy/LRU.html +24 -24
  10. data/doc/rdoc/classes/Cache/Strategy/Unbounded.html +24 -24
  11. data/doc/rdoc/classes/Enumerable.html +6 -6
  12. data/doc/rdoc/classes/Hash.html +120 -0
  13. data/doc/rdoc/classes/Main.html +58 -34
  14. data/doc/rdoc/classes/Object.html +12 -12
  15. data/doc/rdoc/classes/OgScaffolder.html +165 -166
  16. data/doc/rdoc/classes/OgScaffolder/Editor.html +112 -112
  17. data/doc/rdoc/classes/String.html +7 -59
  18. data/doc/rdoc/classes/Struct.html +14 -14
  19. data/doc/rdoc/classes/Wee.html +70 -6
  20. data/doc/rdoc/classes/Wee/AbstractSession.html +502 -0
  21. data/doc/rdoc/classes/Wee/AnswerDecoration.html +11 -11
  22. data/doc/rdoc/classes/Wee/Application.html +139 -84
  23. data/doc/rdoc/classes/Wee/Brush.html +21 -18
  24. data/doc/rdoc/classes/Wee/Brush/AnchorTag.html +90 -17
  25. data/doc/rdoc/classes/Wee/Brush/CheckboxTag.html +162 -0
  26. data/doc/rdoc/classes/Wee/Brush/FileUploadTag.html +7 -7
  27. data/doc/rdoc/classes/Wee/Brush/FormTag.html +41 -17
  28. data/doc/rdoc/classes/Wee/Brush/GenericEncodedTextBrush.html +12 -12
  29. data/doc/rdoc/classes/Wee/Brush/GenericSingleTagBrush.html +7 -7
  30. data/doc/rdoc/classes/Wee/Brush/GenericTagBrush.html +112 -86
  31. data/doc/rdoc/classes/Wee/Brush/GenericTextBrush.html +12 -12
  32. data/doc/rdoc/classes/Wee/Brush/HiddenInputTag.html +160 -0
  33. data/doc/rdoc/classes/Wee/Brush/ImageButtonTag.html +15 -15
  34. data/doc/rdoc/classes/Wee/Brush/ImageTag.html +21 -21
  35. data/doc/rdoc/classes/Wee/Brush/InputTag.html +14 -14
  36. data/doc/rdoc/classes/Wee/Brush/JavascriptTag.html +7 -7
  37. data/doc/rdoc/classes/Wee/Brush/Page.html +14 -14
  38. data/doc/rdoc/classes/Wee/Brush/RadioButtonTag.html +234 -0
  39. data/doc/rdoc/classes/Wee/Brush/RadioButtonTag/RadioGroup.html +207 -0
  40. data/doc/rdoc/classes/Wee/Brush/SelectListTag.html +124 -28
  41. data/doc/rdoc/classes/Wee/Brush/SelectListTag/SelectListCallback.html +7 -7
  42. data/doc/rdoc/classes/Wee/Brush/SelectOptionTag.html +7 -7
  43. data/doc/rdoc/classes/Wee/Brush/SubmitButtonTag.html +7 -7
  44. data/doc/rdoc/classes/Wee/Brush/TableDataTag.html +14 -14
  45. data/doc/rdoc/classes/Wee/Brush/TableHeaderTag.html +7 -7
  46. data/doc/rdoc/classes/Wee/Brush/TableRowTag.html +42 -42
  47. data/doc/rdoc/classes/Wee/Brush/TableTag.html +7 -7
  48. data/doc/rdoc/classes/Wee/Brush/TextAreaTag.html +48 -15
  49. data/doc/rdoc/classes/Wee/Brush/TextInputTag.html +7 -7
  50. data/doc/rdoc/classes/Wee/CallbackRegistry.html +38 -38
  51. data/doc/rdoc/classes/Wee/CallbackStream.html +18 -18
  52. data/doc/rdoc/classes/Wee/CanvasMixin.html +225 -0
  53. data/doc/rdoc/classes/Wee/Component.html +202 -201
  54. data/doc/rdoc/classes/Wee/Component/OnAnswer.html +7 -7
  55. data/doc/rdoc/classes/Wee/ComponentDispatcher.html +289 -0
  56. data/doc/rdoc/classes/Wee/ComponentRunner.html +321 -0
  57. data/doc/rdoc/classes/Wee/Context.html +63 -3
  58. data/doc/rdoc/classes/Wee/Decoration.html +45 -45
  59. data/doc/rdoc/classes/Wee/Delegate.html +30 -30
  60. data/doc/rdoc/classes/Wee/DupReplaceSnapshotMixin.html +164 -0
  61. data/doc/rdoc/classes/Wee/ErrorResponse.html +16 -16
  62. data/doc/rdoc/classes/Wee/Examples.html +114 -0
  63. data/doc/rdoc/classes/Wee/Examples/Calculator.html +319 -0
  64. data/doc/rdoc/classes/Wee/Examples/Counter.html +289 -0
  65. data/doc/rdoc/classes/Wee/Examples/EditableCounter.html +210 -0
  66. data/doc/rdoc/classes/Wee/Examples/Window.html +346 -0
  67. data/doc/rdoc/classes/Wee/FastCGIAdaptor.html +227 -0
  68. data/doc/rdoc/classes/Wee/FormDecoration.html +6 -6
  69. data/doc/rdoc/classes/Wee/GenericResponse.html +7 -7
  70. data/doc/rdoc/classes/Wee/HtmlCanvasRenderer.html +1230 -0
  71. data/doc/rdoc/classes/Wee/HtmlWriter.html +40 -40
  72. data/doc/rdoc/classes/Wee/IdGenerator.html +148 -0
  73. data/doc/rdoc/classes/Wee/LiteralMethodCallback.html +27 -14
  74. data/doc/rdoc/classes/Wee/LoginDecoration.html +261 -0
  75. data/doc/rdoc/classes/Wee/Md5IdGenerator.html +14 -14
  76. data/doc/rdoc/classes/Wee/MessageBox.html +14 -14
  77. data/doc/rdoc/classes/Wee/Nitro.html +114 -0
  78. data/doc/rdoc/classes/Wee/Nitro/ControllerClassMixin.html +192 -0
  79. data/doc/rdoc/classes/Wee/Nitro/ControllerMixin.html +345 -0
  80. data/doc/rdoc/classes/Wee/Nitro/FormTag.html +155 -0
  81. data/doc/rdoc/classes/Wee/Nitro/HtmlCanvasRenderer.html +178 -0
  82. data/doc/rdoc/classes/Wee/Page.html +4 -0
  83. data/doc/rdoc/classes/Wee/PageDecoration.html +18 -18
  84. data/doc/rdoc/classes/Wee/PagelessApplication.html +13 -11
  85. data/doc/rdoc/classes/Wee/PagelessComponentDriver.html +296 -0
  86. data/doc/rdoc/classes/Wee/PagelessRequest.html +52 -21
  87. data/doc/rdoc/classes/Wee/PagelessSession.html +130 -91
  88. data/doc/rdoc/classes/Wee/Pager.html +534 -0
  89. data/doc/rdoc/classes/Wee/Presenter.html +482 -298
  90. data/doc/rdoc/classes/Wee/Rails.html +114 -0
  91. data/doc/rdoc/classes/Wee/Rails/ControllerClassMixin.html +192 -0
  92. data/doc/rdoc/classes/Wee/Rails/ControllerMixin.html +342 -0
  93. data/doc/rdoc/classes/Wee/Rails/FormTag.html +155 -0
  94. data/doc/rdoc/classes/Wee/Rails/HtmlCanvasRenderer.html +177 -0
  95. data/doc/rdoc/classes/Wee/RedirectResponse.html +7 -7
  96. data/doc/rdoc/classes/Wee/RefreshResponse.html +7 -7
  97. data/doc/rdoc/classes/Wee/Renderer.html +208 -0
  98. data/doc/rdoc/classes/Wee/RenderingContext.html +175 -3
  99. data/doc/rdoc/classes/Wee/Request.html +197 -46
  100. data/doc/rdoc/classes/Wee/RequestHandler.html +31 -31
  101. data/doc/rdoc/classes/Wee/Response.html +44 -43
  102. data/doc/rdoc/classes/Wee/Session.html +296 -402
  103. data/doc/rdoc/classes/Wee/SimpleIdGenerator.html +14 -14
  104. data/doc/rdoc/classes/Wee/Snapshot.html +19 -19
  105. data/doc/rdoc/classes/Wee/Utils.html +22 -22
  106. data/doc/rdoc/classes/Wee/Utils/LRUCache.html +6 -6
  107. data/doc/rdoc/classes/Wee/ValueHolder.html +19 -19
  108. data/doc/rdoc/classes/Wee/WEBrickAdaptor.html +72 -46
  109. data/doc/rdoc/classes/Wee/WrapperDecoration.html +6 -6
  110. data/doc/rdoc/created.rid +1 -1
  111. data/doc/rdoc/files/INSTALL.html +1 -1
  112. data/doc/rdoc/files/README.html +8 -12
  113. data/doc/rdoc/files/lib/cache/cache_rb.html +1 -1
  114. data/doc/rdoc/files/lib/wee/abstractsession_rb.html +108 -0
  115. data/doc/rdoc/files/lib/wee/adaptors/fastcgi_rb.html +108 -0
  116. data/doc/rdoc/files/lib/wee/adaptors/nitro_rb.html +101 -0
  117. data/doc/rdoc/files/lib/wee/adaptors/rails_rb.html +101 -0
  118. data/doc/rdoc/files/lib/wee/adaptors/webrick_rb.html +1 -1
  119. data/doc/rdoc/files/lib/wee/application_rb.html +1 -1
  120. data/doc/rdoc/files/lib/wee/components/component_dispatcher_rb.html +108 -0
  121. data/doc/rdoc/files/lib/wee/components/form_decoration_rb.html +1 -1
  122. data/doc/rdoc/files/lib/wee/components/login_decoration_rb.html +101 -0
  123. data/doc/rdoc/files/lib/wee/components/messagebox_rb.html +1 -1
  124. data/doc/rdoc/files/lib/wee/components/page_decoration_rb.html +1 -1
  125. data/doc/rdoc/files/lib/wee/components/pager_rb.html +101 -0
  126. data/doc/rdoc/files/lib/wee/components/wrapper_decoration_rb.html +1 -1
  127. data/doc/rdoc/files/lib/wee/components_rb.html +4 -1
  128. data/doc/rdoc/files/lib/wee/continuation/core/component_rb.html +1 -1
  129. data/doc/rdoc/files/lib/wee/continuation/session_rb.html +1 -1
  130. data/doc/rdoc/files/lib/wee/continuation_rb.html +1 -1
  131. data/doc/rdoc/files/lib/wee/core/callback_rb.html +1 -1
  132. data/doc/rdoc/files/lib/wee/core/component_rb.html +1 -1
  133. data/doc/rdoc/files/lib/wee/core/componentrunner_rb.html +110 -0
  134. data/doc/rdoc/files/lib/wee/core/context_rb.html +101 -0
  135. data/doc/rdoc/files/lib/wee/core/decoration_rb.html +1 -1
  136. data/doc/rdoc/files/lib/wee/core/idgen_rb.html +101 -0
  137. data/doc/rdoc/files/lib/wee/core/page_rb.html +101 -0
  138. data/doc/rdoc/files/lib/wee/core/presenter_rb.html +1 -1
  139. data/doc/rdoc/files/lib/wee/core/renderer_rb.html +107 -0
  140. data/doc/rdoc/files/lib/wee/core/snapshot_rb.html +1 -1
  141. data/doc/rdoc/files/lib/wee/core/valueholder_rb.html +2 -2
  142. data/doc/rdoc/files/lib/wee/core_ext_rb.html +101 -0
  143. data/doc/rdoc/files/lib/wee/core_rb.html +7 -14
  144. data/doc/rdoc/files/lib/wee/databases/og/application_rb.html +1 -1
  145. data/doc/rdoc/files/lib/wee/databases/og/old_scaffolder_rb.html +1 -1
  146. data/doc/rdoc/files/lib/wee/databases/og/scaffolder_rb.html +1 -1
  147. data/doc/rdoc/files/lib/wee/databases/og/session_rb.html +1 -1
  148. data/doc/rdoc/files/lib/wee/databases/og_rb.html +1 -1
  149. data/doc/rdoc/files/lib/wee/examples/calculator_rb.html +107 -0
  150. data/doc/rdoc/files/lib/wee/examples/counter_rb.html +101 -0
  151. data/doc/rdoc/files/lib/wee/examples/editable_counter_rb.html +114 -0
  152. data/doc/rdoc/files/lib/wee/examples/window_rb.html +101 -0
  153. data/doc/rdoc/files/lib/wee/idgen/md5_rb.html +1 -1
  154. data/doc/rdoc/files/lib/wee/idgen/simple_rb.html +1 -1
  155. data/doc/rdoc/files/lib/wee/page_rb.html +1 -1
  156. data/doc/rdoc/files/lib/wee/pageless/application_rb.html +8 -1
  157. data/doc/rdoc/files/lib/wee/pageless/request_rb.html +1 -1
  158. data/doc/rdoc/files/lib/wee/pageless/session_rb.html +2 -1
  159. data/doc/rdoc/files/lib/wee/pageless_rb.html +1 -1
  160. data/doc/rdoc/files/lib/wee/renderer/html/brushes_rb.html +1 -1
  161. data/doc/rdoc/files/lib/wee/renderer/html/canvas_rb.html +1 -1
  162. data/doc/rdoc/files/lib/wee/renderer/html/writer_rb.html +1 -1
  163. data/doc/rdoc/files/lib/wee/request_rb.html +5 -4
  164. data/doc/rdoc/files/lib/wee/requesthandler_rb.html +1 -1
  165. data/doc/rdoc/files/lib/wee/response_rb.html +2 -1
  166. data/doc/rdoc/files/lib/wee/session_rb.html +2 -3
  167. data/doc/rdoc/files/lib/wee/skeleton/og/components/main_rb.html +1 -1
  168. data/doc/rdoc/files/lib/wee/skeleton/og/conf/db_rb.html +2 -2
  169. data/doc/rdoc/files/lib/wee/skeleton/og/models/recipe_rb.html +1 -1
  170. data/doc/rdoc/files/lib/wee/skeleton/og/run_rb.html +1 -1
  171. data/doc/rdoc/files/lib/wee/skeleton/simple/components/main_rb.html +1 -1
  172. data/doc/rdoc/files/lib/wee/skeleton/simple/run_rb.html +1 -1
  173. data/doc/rdoc/files/lib/wee/snapshot_ext_rb.html +1 -1
  174. data/doc/rdoc/files/lib/wee/template_rb.html +1 -1
  175. data/doc/rdoc/files/lib/wee/utils/autoreload_rb.html +1 -1
  176. data/doc/rdoc/files/lib/wee/utils/cache_rb.html +1 -1
  177. data/doc/rdoc/files/lib/wee/utils/helper_rb.html +1 -1
  178. data/doc/rdoc/files/lib/wee/utils_rb.html +1 -1
  179. data/doc/rdoc/files/lib/wee_rb.html +5 -3
  180. data/doc/rdoc/fr_class_index.html +34 -2
  181. data/doc/rdoc/fr_file_index.html +17 -1
  182. data/doc/rdoc/fr_method_index.html +464 -314
  183. data/examples/ajax/ajax.rb +1 -1
  184. data/examples/demo.rb +47 -0
  185. data/examples/{calendar.rb → demo/calendar.rb} +89 -97
  186. data/examples/{example.rb → demo/example.rb} +17 -97
  187. data/examples/dispatcher.rb +37 -0
  188. data/examples/draw.rb +14 -11
  189. data/examples/nitro/run.rb +42 -0
  190. data/examples/radio.rb +44 -0
  191. data/examples/test.rb +3 -27
  192. data/lib/wee.rb +15 -3
  193. data/lib/wee/adaptors/nitro.rb +154 -0
  194. data/lib/wee/adaptors/rails.rb +154 -0
  195. data/lib/wee/application.rb +22 -20
  196. data/lib/wee/components.rb +3 -0
  197. data/lib/wee/components/component_dispatcher.rb +46 -0
  198. data/lib/wee/components/login_decoration.rb +35 -0
  199. data/lib/wee/components/messagebox.rb +2 -2
  200. data/lib/wee/components/pager.rb +102 -0
  201. data/lib/wee/continuation/core/component.rb +13 -12
  202. data/lib/wee/continuation/session.rb +11 -19
  203. data/lib/wee/core.rb +8 -7
  204. data/lib/wee/core/component.rb +8 -28
  205. data/lib/wee/core/componentrunner.rb +73 -0
  206. data/lib/wee/core/context.rb +27 -0
  207. data/lib/wee/core/idgen.rb +5 -0
  208. data/lib/wee/core/page.rb +1 -0
  209. data/lib/wee/core/presenter.rb +10 -126
  210. data/lib/wee/core/renderer.rb +23 -0
  211. data/lib/wee/core_ext.rb +122 -0
  212. data/lib/wee/databases/og/scaffolder.rb +0 -1
  213. data/lib/wee/examples/calculator.rb +70 -0
  214. data/lib/wee/examples/counter.rb +33 -0
  215. data/lib/wee/examples/editable_counter.rb +31 -0
  216. data/{examples → lib/wee/examples}/window.rb +29 -23
  217. data/lib/wee/idgen/md5.rb +1 -1
  218. data/lib/wee/idgen/simple.rb +1 -1
  219. data/lib/wee/pageless/session.rb +2 -3
  220. data/lib/wee/renderer/html/brushes.rb +142 -22
  221. data/lib/wee/renderer/html/canvas.rb +57 -19
  222. data/lib/wee/response.rb +3 -2
  223. data/lib/wee/session.rb +10 -54
  224. data/lib/wee/skeleton/og/components/main.rb +5 -1
  225. data/lib/wee/skeleton/og/conf/db.rb +1 -1
  226. data/lib/wee/snapshot_ext.rb +4 -10
  227. data/lib/wee/template.rb +19 -5
  228. data/lib/wee/utils/helper.rb +2 -2
  229. metadata +90 -13
  230. data/examples/calculator.rb +0 -67
  231. data/lib/wee/context.rb +0 -2
@@ -88,11 +88,11 @@
88
88
  <h3 class="section-bar">Methods</h3>
89
89
 
90
90
  <div class="name-list">
91
- <a href="#M000310">alive?</a>&nbsp;&nbsp;
92
- <a href="#M000311">handle_request</a>&nbsp;&nbsp;
93
- <a href="#M000313">new</a>&nbsp;&nbsp;
94
- <a href="#M000312">statistics</a>&nbsp;&nbsp;
95
- <a href="#M000309">teminate</a>&nbsp;&nbsp;
91
+ <a href="#M000418">alive?</a>&nbsp;&nbsp;
92
+ <a href="#M000419">handle_request</a>&nbsp;&nbsp;
93
+ <a href="#M000421">new</a>&nbsp;&nbsp;
94
+ <a href="#M000420">statistics</a>&nbsp;&nbsp;
95
+ <a href="#M000417">teminate</a>&nbsp;&nbsp;
96
96
  </div>
97
97
  </div>
98
98
 
@@ -175,19 +175,19 @@ The maximum number of requests this handler should serve. A value of
175
175
  <div id="methods">
176
176
  <h3 class="section-bar">Public Class methods</h3>
177
177
 
178
- <div id="method-M000313" class="method-detail">
179
- <a name="M000313"></a>
178
+ <div id="method-M000421" class="method-detail">
179
+ <a name="M000421"></a>
180
180
 
181
181
  <div class="method-heading">
182
- <a href="#M000313" class="method-signature">
182
+ <a href="#M000421" class="method-signature">
183
183
  <span class="method-name">new</span><span class="method-args">()</span>
184
184
  </a>
185
185
  </div>
186
186
 
187
187
  <div class="method-description">
188
188
  <p><a class="source-toggle" href="#"
189
- onclick="toggleCode('M000313-source');return false;">[Source]</a></p>
190
- <div class="method-source-code" id="M000313-source">
189
+ onclick="toggleCode('M000421-source');return false;">[Source]</a></p>
190
+ <div class="method-source-code" id="M000421-source">
191
191
  <pre>
192
192
  <span class="ruby-comment cmt"># File lib/wee/requesthandler.rb, line 74</span>
193
193
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
@@ -203,11 +203,11 @@ The maximum number of requests this handler should serve. A value of
203
203
 
204
204
  <h3 class="section-bar">Public Instance methods</h3>
205
205
 
206
- <div id="method-M000310" class="method-detail">
207
- <a name="M000310"></a>
206
+ <div id="method-M000418" class="method-detail">
207
+ <a name="M000418"></a>
208
208
 
209
209
  <div class="method-heading">
210
- <a href="#M000310" class="method-signature">
210
+ <a href="#M000418" class="method-signature">
211
211
  <span class="method-name">alive?</span><span class="method-args">()</span>
212
212
  </a>
213
213
  </div>
@@ -217,8 +217,8 @@ The maximum number of requests this handler should serve. A value of
217
217
  Query whether this handler is still alive.
218
218
  </p>
219
219
  <p><a class="source-toggle" href="#"
220
- onclick="toggleCode('M000310-source');return false;">[Source]</a></p>
221
- <div class="method-source-code" id="M000310-source">
220
+ onclick="toggleCode('M000418-source');return false;">[Source]</a></p>
221
+ <div class="method-source-code" id="M000418-source">
222
222
  <pre>
223
223
  <span class="ruby-comment cmt"># File lib/wee/requesthandler.rb, line 43</span>
224
224
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">alive?</span>
@@ -238,23 +238,23 @@ Query whether this handler is still alive.
238
238
  </div>
239
239
  </div>
240
240
 
241
- <div id="method-M000311" class="method-detail">
242
- <a name="M000311"></a>
241
+ <div id="method-M000419" class="method-detail">
242
+ <a name="M000419"></a>
243
243
 
244
244
  <div class="method-heading">
245
- <a href="#M000311" class="method-signature">
245
+ <a href="#M000419" class="method-signature">
246
246
  <span class="method-name">handle_request</span><span class="method-args">(context)</span>
247
247
  </a>
248
248
  </div>
249
249
 
250
250
  <div class="method-description">
251
251
  <p>
252
- Extend <a href="RequestHandler.html#M000311">handle_request</a> in your own
252
+ Extend <a href="RequestHandler.html#M000419">handle_request</a> in your own
253
253
  subclass.
254
254
  </p>
255
255
  <p><a class="source-toggle" href="#"
256
- onclick="toggleCode('M000311-source');return false;">[Source]</a></p>
257
- <div class="method-source-code" id="M000311-source">
256
+ onclick="toggleCode('M000419-source');return false;">[Source]</a></p>
257
+ <div class="method-source-code" id="M000419-source">
258
258
  <pre>
259
259
  <span class="ruby-comment cmt"># File lib/wee/requesthandler.rb, line 58</span>
260
260
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_request</span>(<span class="ruby-identifier">context</span>)
@@ -266,19 +266,19 @@ subclass.
266
266
  </div>
267
267
  </div>
268
268
 
269
- <div id="method-M000312" class="method-detail">
270
- <a name="M000312"></a>
269
+ <div id="method-M000420" class="method-detail">
270
+ <a name="M000420"></a>
271
271
 
272
272
  <div class="method-heading">
273
- <a href="#M000312" class="method-signature">
273
+ <a href="#M000420" class="method-signature">
274
274
  <span class="method-name">statistics</span><span class="method-args">()</span>
275
275
  </a>
276
276
  </div>
277
277
 
278
278
  <div class="method-description">
279
279
  <p><a class="source-toggle" href="#"
280
- onclick="toggleCode('M000312-source');return false;">[Source]</a></p>
281
- <div class="method-source-code" id="M000312-source">
280
+ onclick="toggleCode('M000420-source');return false;">[Source]</a></p>
281
+ <div class="method-source-code" id="M000420-source">
282
282
  <pre>
283
283
  <span class="ruby-comment cmt"># File lib/wee/requesthandler.rb, line 63</span>
284
284
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">statistics</span>
@@ -296,11 +296,11 @@ subclass.
296
296
  </div>
297
297
  </div>
298
298
 
299
- <div id="method-M000309" class="method-detail">
300
- <a name="M000309"></a>
299
+ <div id="method-M000417" class="method-detail">
300
+ <a name="M000417"></a>
301
301
 
302
302
  <div class="method-heading">
303
- <a href="#M000309" class="method-signature">
303
+ <a href="#M000417" class="method-signature">
304
304
  <span class="method-name">teminate</span><span class="method-args">()</span>
305
305
  </a>
306
306
  </div>
@@ -314,8 +314,8 @@ This will usually not immediatly terminate the handler from running, but
314
314
  further requests will not be answered.
315
315
  </p>
316
316
  <p><a class="source-toggle" href="#"
317
- onclick="toggleCode('M000309-source');return false;">[Source]</a></p>
318
- <div class="method-source-code" id="M000309-source">
317
+ onclick="toggleCode('M000417-source');return false;">[Source]</a></p>
318
+ <div class="method-source-code" id="M000417-source">
319
319
  <pre>
320
320
  <span class="ruby-comment cmt"># File lib/wee/requesthandler.rb, line 37</span>
321
321
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">teminate</span>
@@ -88,12 +88,12 @@
88
88
  <h3 class="section-bar">Methods</h3>
89
89
 
90
90
  <div class="name-list">
91
- <a href="#M000234">&lt;&lt;</a>&nbsp;&nbsp;
92
- <a href="#M000232">content_type</a>&nbsp;&nbsp;
93
- <a href="#M000233">content_type=</a>&nbsp;&nbsp;
94
- <a href="#M000230">cookies</a>&nbsp;&nbsp;
95
- <a href="#M000229">cookies?</a>&nbsp;&nbsp;
96
- <a href="#M000231">new</a>&nbsp;&nbsp;
91
+ <a href="#M000292">&lt;&lt;</a>&nbsp;&nbsp;
92
+ <a href="#M000290">content_type</a>&nbsp;&nbsp;
93
+ <a href="#M000291">content_type=</a>&nbsp;&nbsp;
94
+ <a href="#M000288">cookies</a>&nbsp;&nbsp;
95
+ <a href="#M000287">cookies?</a>&nbsp;&nbsp;
96
+ <a href="#M000289">new</a>&nbsp;&nbsp;
97
97
  </div>
98
98
  </div>
99
99
 
@@ -113,7 +113,7 @@
113
113
  <tr class="top-aligned-row context-row">
114
114
  <td class="context-item-name">DEFAULT_HEADER</td>
115
115
  <td>=</td>
116
- <td class="context-item-value">{ 'Content-Type' =&gt; 'text/html' }.freeze</td>
116
+ <td class="context-item-value">{}.freeze</td>
117
117
  </tr>
118
118
  </table>
119
119
  </div>
@@ -151,24 +151,25 @@
151
151
  <div id="methods">
152
152
  <h3 class="section-bar">Public Class methods</h3>
153
153
 
154
- <div id="method-M000231" class="method-detail">
155
- <a name="M000231"></a>
154
+ <div id="method-M000289" class="method-detail">
155
+ <a name="M000289"></a>
156
156
 
157
157
  <div class="method-heading">
158
- <a href="#M000231" class="method-signature">
158
+ <a href="#M000289" class="method-signature">
159
159
  <span class="method-name">new</span><span class="method-args">(mime_type = 'text/html', content='')</span>
160
160
  </a>
161
161
  </div>
162
162
 
163
163
  <div class="method-description">
164
164
  <p><a class="source-toggle" href="#"
165
- onclick="toggleCode('M000231-source');return false;">[Source]</a></p>
166
- <div class="method-source-code" id="M000231-source">
165
+ onclick="toggleCode('M000289-source');return false;">[Source]</a></p>
166
+ <div class="method-source-code" id="M000289-source">
167
167
  <pre>
168
- <span class="ruby-comment cmt"># File lib/wee/response.rb, line 17</span>
168
+ <span class="ruby-comment cmt"># File lib/wee/response.rb, line 18</span>
169
169
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">mime_type</span> = <span class="ruby-value str">'text/html'</span>, <span class="ruby-identifier">content</span>=<span class="ruby-value str">''</span>)
170
170
  <span class="ruby-ivar">@status</span> = <span class="ruby-value">200</span>
171
171
  <span class="ruby-ivar">@header</span> = <span class="ruby-constant">DEFAULT_HEADER</span>.<span class="ruby-identifier">dup</span>
172
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">content_type</span> = <span class="ruby-identifier">mime_type</span>
172
173
  <span class="ruby-ivar">@content</span> = <span class="ruby-identifier">content</span>
173
174
  <span class="ruby-keyword kw">end</span>
174
175
  </pre>
@@ -178,21 +179,21 @@
178
179
 
179
180
  <h3 class="section-bar">Public Instance methods</h3>
180
181
 
181
- <div id="method-M000234" class="method-detail">
182
- <a name="M000234"></a>
182
+ <div id="method-M000292" class="method-detail">
183
+ <a name="M000292"></a>
183
184
 
184
185
  <div class="method-heading">
185
- <a href="#M000234" class="method-signature">
186
+ <a href="#M000292" class="method-signature">
186
187
  <span class="method-name">&lt;&lt;</span><span class="method-args">(str)</span>
187
188
  </a>
188
189
  </div>
189
190
 
190
191
  <div class="method-description">
191
192
  <p><a class="source-toggle" href="#"
192
- onclick="toggleCode('M000234-source');return false;">[Source]</a></p>
193
- <div class="method-source-code" id="M000234-source">
193
+ onclick="toggleCode('M000292-source');return false;">[Source]</a></p>
194
+ <div class="method-source-code" id="M000292-source">
194
195
  <pre>
195
- <span class="ruby-comment cmt"># File lib/wee/response.rb, line 31</span>
196
+ <span class="ruby-comment cmt"># File lib/wee/response.rb, line 33</span>
196
197
  <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;&lt;</span>(<span class="ruby-identifier">str</span>)
197
198
  <span class="ruby-ivar">@content</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">str</span>
198
199
  <span class="ruby-keyword kw">end</span>
@@ -201,21 +202,21 @@
201
202
  </div>
202
203
  </div>
203
204
 
204
- <div id="method-M000232" class="method-detail">
205
- <a name="M000232"></a>
205
+ <div id="method-M000290" class="method-detail">
206
+ <a name="M000290"></a>
206
207
 
207
208
  <div class="method-heading">
208
- <a href="#M000232" class="method-signature">
209
+ <a href="#M000290" class="method-signature">
209
210
  <span class="method-name">content_type</span><span class="method-args">()</span>
210
211
  </a>
211
212
  </div>
212
213
 
213
214
  <div class="method-description">
214
215
  <p><a class="source-toggle" href="#"
215
- onclick="toggleCode('M000232-source');return false;">[Source]</a></p>
216
- <div class="method-source-code" id="M000232-source">
216
+ onclick="toggleCode('M000290-source');return false;">[Source]</a></p>
217
+ <div class="method-source-code" id="M000290-source">
217
218
  <pre>
218
- <span class="ruby-comment cmt"># File lib/wee/response.rb, line 23</span>
219
+ <span class="ruby-comment cmt"># File lib/wee/response.rb, line 25</span>
219
220
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content_type</span>
220
221
  <span class="ruby-ivar">@header</span>[<span class="ruby-value str">'Content-Type'</span>]
221
222
  <span class="ruby-keyword kw">end</span>
@@ -224,21 +225,21 @@
224
225
  </div>
225
226
  </div>
226
227
 
227
- <div id="method-M000233" class="method-detail">
228
- <a name="M000233"></a>
228
+ <div id="method-M000291" class="method-detail">
229
+ <a name="M000291"></a>
229
230
 
230
231
  <div class="method-heading">
231
- <a href="#M000233" class="method-signature">
232
+ <a href="#M000291" class="method-signature">
232
233
  <span class="method-name">content_type=</span><span class="method-args">(mime_type)</span>
233
234
  </a>
234
235
  </div>
235
236
 
236
237
  <div class="method-description">
237
238
  <p><a class="source-toggle" href="#"
238
- onclick="toggleCode('M000233-source');return false;">[Source]</a></p>
239
- <div class="method-source-code" id="M000233-source">
239
+ onclick="toggleCode('M000291-source');return false;">[Source]</a></p>
240
+ <div class="method-source-code" id="M000291-source">
240
241
  <pre>
241
- <span class="ruby-comment cmt"># File lib/wee/response.rb, line 27</span>
242
+ <span class="ruby-comment cmt"># File lib/wee/response.rb, line 29</span>
242
243
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content_type=</span>(<span class="ruby-identifier">mime_type</span>)
243
244
  <span class="ruby-ivar">@header</span>[<span class="ruby-value str">'Content-Type'</span>] = <span class="ruby-identifier">mime_type</span>
244
245
  <span class="ruby-keyword kw">end</span>
@@ -247,21 +248,21 @@
247
248
  </div>
248
249
  </div>
249
250
 
250
- <div id="method-M000230" class="method-detail">
251
- <a name="M000230"></a>
251
+ <div id="method-M000288" class="method-detail">
252
+ <a name="M000288"></a>
252
253
 
253
254
  <div class="method-heading">
254
- <a href="#M000230" class="method-signature">
255
+ <a href="#M000288" class="method-signature">
255
256
  <span class="method-name">cookies</span><span class="method-args">()</span>
256
257
  </a>
257
258
  </div>
258
259
 
259
260
  <div class="method-description">
260
261
  <p><a class="source-toggle" href="#"
261
- onclick="toggleCode('M000230-source');return false;">[Source]</a></p>
262
- <div class="method-source-code" id="M000230-source">
262
+ onclick="toggleCode('M000288-source');return false;">[Source]</a></p>
263
+ <div class="method-source-code" id="M000288-source">
263
264
  <pre>
264
- <span class="ruby-comment cmt"># File lib/wee/response.rb, line 13</span>
265
+ <span class="ruby-comment cmt"># File lib/wee/response.rb, line 14</span>
265
266
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cookies</span>
266
267
  <span class="ruby-ivar">@cookies</span> <span class="ruby-operator">||=</span> []
267
268
  <span class="ruby-keyword kw">end</span>
@@ -270,21 +271,21 @@
270
271
  </div>
271
272
  </div>
272
273
 
273
- <div id="method-M000229" class="method-detail">
274
- <a name="M000229"></a>
274
+ <div id="method-M000287" class="method-detail">
275
+ <a name="M000287"></a>
275
276
 
276
277
  <div class="method-heading">
277
- <a href="#M000229" class="method-signature">
278
+ <a href="#M000287" class="method-signature">
278
279
  <span class="method-name">cookies?</span><span class="method-args">()</span>
279
280
  </a>
280
281
  </div>
281
282
 
282
283
  <div class="method-description">
283
284
  <p><a class="source-toggle" href="#"
284
- onclick="toggleCode('M000229-source');return false;">[Source]</a></p>
285
- <div class="method-source-code" id="M000229-source">
285
+ onclick="toggleCode('M000287-source');return false;">[Source]</a></p>
286
+ <div class="method-source-code" id="M000287-source">
286
287
  <pre>
287
- <span class="ruby-comment cmt"># File lib/wee/response.rb, line 9</span>
288
+ <span class="ruby-comment cmt"># File lib/wee/response.rb, line 10</span>
288
289
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cookies?</span>
289
290
  <span class="ruby-ivar">@cookies</span>
290
291
  <span class="ruby-keyword kw">end</span>
@@ -69,8 +69,8 @@
69
69
  <tr class="top-aligned-row">
70
70
  <td><strong>Parent:</strong></td>
71
71
  <td>
72
- <a href="RequestHandler.html">
73
- Wee::RequestHandler
72
+ <a href="AbstractSession.html">
73
+ Wee::AbstractSession
74
74
  </a>
75
75
  </td>
76
76
  </tr>
@@ -89,7 +89,7 @@
89
89
  <div id="contents-list">
90
90
  <h3 class="section-bar">Contents</h3>
91
91
  <ul>
92
- <li><a href="#SEC00016">Properties</a></li>
92
+ <li><a href="#SEC00015">Request processing/handling</a></li>
93
93
  </ul>
94
94
  </div>
95
95
 
@@ -97,23 +97,22 @@
97
97
  <h3 class="section-bar">Methods</h3>
98
98
 
99
99
  <div class="name-list">
100
- <a href="#M000204">awake</a>&nbsp;&nbsp;
101
- <a href="#M000203">create_page</a>&nbsp;&nbsp;
102
- <a href="#M000199">current</a>&nbsp;&nbsp;
103
- <a href="#M000208">current_callbacks</a>&nbsp;&nbsp;
104
- <a href="#M000207">current_context</a>&nbsp;&nbsp;
105
- <a href="#M000209">get_property</a>&nbsp;&nbsp;
106
- <a href="#M000210">handle_new_page_view</a>&nbsp;&nbsp;
107
- <a href="#M000202">handle_request</a>&nbsp;&nbsp;
108
- <a href="#M000214">handle_request</a>&nbsp;&nbsp;
109
- <a href="#M000200">new</a>&nbsp;&nbsp;
110
- <a href="#M000213">new</a>&nbsp;&nbsp;
111
- <a href="#M000206">process_request</a>&nbsp;&nbsp;
112
- <a href="#M000212">respond</a>&nbsp;&nbsp;
113
- <a href="#M000211">set_response</a>&nbsp;&nbsp;
114
- <a href="#M000205">sleep</a>&nbsp;&nbsp;
115
- <a href="#M000201">snapshot</a>&nbsp;&nbsp;
116
- <a href="#M000215">start_request_response_loop</a>&nbsp;&nbsp;
100
+ <a href="#M000278">create_page</a>&nbsp;&nbsp;
101
+ <a href="#M000266">current_callbacks</a>&nbsp;&nbsp;
102
+ <a href="#M000273">handle_callback_phase</a>&nbsp;&nbsp;
103
+ <a href="#M000270">handle_existing_page</a>&nbsp;&nbsp;
104
+ <a href="#M000271">handle_invalid_page</a>&nbsp;&nbsp;
105
+ <a href="#M000269">handle_new_page</a>&nbsp;&nbsp;
106
+ <a href="#M000274">handle_new_page_view</a>&nbsp;&nbsp;
107
+ <a href="#M000272">handle_render_phase</a>&nbsp;&nbsp;
108
+ <a href="#M000265">new</a>&nbsp;&nbsp;
109
+ <a href="#M000279">new</a>&nbsp;&nbsp;
110
+ <a href="#M000277">post_callbacks_hook</a>&nbsp;&nbsp;
111
+ <a href="#M000276">pre_respond_hook</a>&nbsp;&nbsp;
112
+ <a href="#M000268">process_request</a>&nbsp;&nbsp;
113
+ <a href="#M000275">respond</a>&nbsp;&nbsp;
114
+ <a href="#M000267">setup</a>&nbsp;&nbsp;
115
+ <a href="#M000280">start_request_response_loop</a>&nbsp;&nbsp;
117
116
  </div>
118
117
  </div>
119
118
 
@@ -134,12 +133,12 @@
134
133
  <div class="name-list">
135
134
  <table>
136
135
  <tr class="top-aligned-row context-row">
137
- <td class="context-item-name">page_store</td>
136
+ <td class="context-item-name">component_runner</td>
138
137
  <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
139
138
  <td class="context-item-desc"></td>
140
139
  </tr>
141
140
  <tr class="top-aligned-row context-row">
142
- <td class="context-item-name">root_component</td>
141
+ <td class="context-item-name">page_store</td>
143
142
  <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
144
143
  <td class="context-item-desc"></td>
145
144
  </tr>
@@ -153,64 +152,24 @@
153
152
  <div id="methods">
154
153
  <h3 class="section-bar">Public Class methods</h3>
155
154
 
156
- <div id="method-M000199" class="method-detail">
157
- <a name="M000199"></a>
155
+ <div id="method-M000265" class="method-detail">
156
+ <a name="M000265"></a>
158
157
 
159
158
  <div class="method-heading">
160
- <a href="#M000199" class="method-signature">
161
- <span class="method-name">current</span><span class="method-args">()</span>
162
- </a>
163
- </div>
164
-
165
- <div class="method-description">
166
- <p><a class="source-toggle" href="#"
167
- onclick="toggleCode('M000199-source');return false;">[Source]</a></p>
168
- <div class="method-source-code" id="M000199-source">
169
- <pre>
170
- <span class="ruby-comment cmt"># File lib/wee/session.rb, line 7</span>
171
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">current</span>
172
- <span class="ruby-identifier">sess</span> = <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:wee_session</span>]
173
- <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;not in session&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">sess</span>.<span class="ruby-identifier">nil?</span>
174
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">sess</span>
175
- <span class="ruby-keyword kw">end</span>
176
- </pre>
177
- </div>
178
- </div>
179
- </div>
180
-
181
- <div id="method-M000200" class="method-detail">
182
- <a name="M000200"></a>
183
-
184
- <div class="method-heading">
185
- <a href="#M000200" class="method-signature">
159
+ <a href="#M000265" class="method-signature">
186
160
  <span class="method-name">new</span><span class="method-args">(&amp;block)</span>
187
161
  </a>
188
162
  </div>
189
163
 
190
164
  <div class="method-description">
191
165
  <p><a class="source-toggle" href="#"
192
- onclick="toggleCode('M000200-source');return false;">[Source]</a></p>
193
- <div class="method-source-code" id="M000200-source">
166
+ onclick="toggleCode('M000265-source');return false;">[Source]</a></p>
167
+ <div class="method-source-code" id="M000265-source">
194
168
  <pre>
195
- <span class="ruby-comment cmt"># File lib/wee/session.rb, line 13</span>
169
+ <span class="ruby-comment cmt"># File lib/wee/session.rb, line 8</span>
196
170
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
197
- <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:wee_session</span>] = <span class="ruby-keyword kw">self</span>
198
-
199
- <span class="ruby-ivar">@idgen</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">SimpleIdGenerator</span>.<span class="ruby-identifier">new</span>
200
-
201
- <span class="ruby-comment cmt"># to serialize the requests we need a mutex</span>
202
- <span class="ruby-ivar">@mutex</span> = <span class="ruby-constant">Mutex</span>.<span class="ruby-identifier">new</span>
203
-
204
- <span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-keyword kw">self</span>)
205
-
206
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;No root component specified&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@root_component</span>.<span class="ruby-identifier">nil?</span>
207
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;No page_store specified&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@page_store</span>.<span class="ruby-identifier">nil?</span>
208
-
209
- <span class="ruby-ivar">@initial_snapshot</span> = <span class="ruby-identifier">snapshot</span>()
210
-
211
171
  <span class="ruby-keyword kw">super</span>()
212
- <span class="ruby-keyword kw">ensure</span>
213
- <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:wee_session</span>] = <span class="ruby-keyword kw">nil</span>
172
+ <span class="ruby-identifier">setup</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
214
173
  <span class="ruby-keyword kw">end</span>
215
174
  </pre>
216
175
  </div>
@@ -219,136 +178,198 @@
219
178
 
220
179
  <h3 class="section-bar">Public Instance methods</h3>
221
180
 
222
- <div id="method-M000204" class="method-detail">
223
- <a name="M000204"></a>
181
+ <div id="method-M000266" class="method-detail">
182
+ <a name="M000266"></a>
224
183
 
225
184
  <div class="method-heading">
226
- <a href="#M000204" class="method-signature">
227
- <span class="method-name">awake</span><span class="method-args">()</span>
185
+ <a href="#M000266" class="method-signature">
186
+ <span class="method-name">current_callbacks</span><span class="method-args">()</span>
228
187
  </a>
229
188
  </div>
230
189
 
231
190
  <div class="method-description">
232
- <p>
233
- Is called before <a href="Session.html#M000206">process_request</a> is
234
- invoked Can be used to setup e.g. a database connection.
235
- </p>
236
191
  <p><a class="source-toggle" href="#"
237
- onclick="toggleCode('M000204-source');return false;">[Source]</a></p>
238
- <div class="method-source-code" id="M000204-source">
192
+ onclick="toggleCode('M000266-source');return false;">[Source]</a></p>
193
+ <div class="method-source-code" id="M000266-source">
239
194
  <pre>
240
- <span class="ruby-comment cmt"># File lib/wee/session.rb, line 66</span>
241
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">awake</span>
195
+ <span class="ruby-comment cmt"># File lib/wee/session.rb, line 13</span>
196
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">current_callbacks</span>
197
+ <span class="ruby-ivar">@page</span>.<span class="ruby-identifier">callbacks</span>
242
198
  <span class="ruby-keyword kw">end</span>
243
199
  </pre>
244
200
  </div>
245
201
  </div>
246
202
  </div>
247
203
 
248
- <div id="method-M000203" class="method-detail">
249
- <a name="M000203"></a>
204
+
205
+ </div>
206
+ <div id="section">
207
+ <h2 class="section-title"><a name="SEC00015">Request processing/handling</a></h2>
208
+ <div class="section-comment">
209
+
210
+ </div>
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+ <!-- if method_list -->
220
+ <div id="methods">
221
+ <h3 class="section-bar">Public Class methods</h3>
222
+
223
+ <div id="method-M000279" class="method-detail">
224
+ <a name="M000279"></a>
250
225
 
251
226
  <div class="method-heading">
252
- <a href="#M000203" class="method-signature">
253
- <span class="method-name">create_page</span><span class="method-args">(snapshot)</span>
227
+ <a href="#M000279" class="method-signature">
228
+ <span class="method-name">new</span><span class="method-args">(&amp;block)</span>
254
229
  </a>
255
230
  </div>
256
231
 
257
232
  <div class="method-description">
258
233
  <p><a class="source-toggle" href="#"
259
- onclick="toggleCode('M000203-source');return false;">[Source]</a></p>
260
- <div class="method-source-code" id="M000203-source">
234
+ onclick="toggleCode('M000279-source');return false;">[Source]</a></p>
235
+ <div class="method-source-code" id="M000279-source">
261
236
  <pre>
262
- <span class="ruby-comment cmt"># File lib/wee/session.rb, line 59</span>
263
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_page</span>(<span class="ruby-identifier">snapshot</span>)
264
- <span class="ruby-identifier">idgen</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">SimpleIdGenerator</span>.<span class="ruby-identifier">new</span>
265
- <span class="ruby-identifier">page</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">Page</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">snapshot</span>, <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">CallbackRegistry</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">idgen</span>))
237
+ <span class="ruby-comment cmt"># File lib/wee/continuation/session.rb, line 20</span>
238
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
239
+ <span class="ruby-keyword kw">super</span>()
240
+ <span class="ruby-ivar">@in_queue</span>, <span class="ruby-ivar">@out_queue</span> = <span class="ruby-constant">SizedQueue</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">1</span>), <span class="ruby-constant">SizedQueue</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">1</span>)
241
+ <span class="ruby-identifier">setup</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
242
+ <span class="ruby-identifier">start_request_response_loop</span>
266
243
  <span class="ruby-keyword kw">end</span>
267
244
  </pre>
268
245
  </div>
269
246
  </div>
270
247
  </div>
271
248
 
272
- <div id="method-M000208" class="method-detail">
273
- <a name="M000208"></a>
249
+ <h3 class="section-bar">Public Instance methods</h3>
250
+
251
+ <div id="method-M000280" class="method-detail">
252
+ <a name="M000280"></a>
274
253
 
275
254
  <div class="method-heading">
276
- <a href="#M000208" class="method-signature">
277
- <span class="method-name">current_callbacks</span><span class="method-args">()</span>
255
+ <a href="#M000280" class="method-signature">
256
+ <span class="method-name">start_request_response_loop</span><span class="method-args">()</span>
278
257
  </a>
279
258
  </div>
280
259
 
281
260
  <div class="method-description">
282
261
  <p><a class="source-toggle" href="#"
283
- onclick="toggleCode('M000208-source');return false;">[Source]</a></p>
284
- <div class="method-source-code" id="M000208-source">
262
+ onclick="toggleCode('M000280-source');return false;">[Source]</a></p>
263
+ <div class="method-source-code" id="M000280-source">
285
264
  <pre>
286
- <span class="ruby-comment cmt"># File lib/wee/session.rb, line 153</span>
287
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">current_callbacks</span>
288
- <span class="ruby-ivar">@page</span>.<span class="ruby-identifier">callbacks</span>
265
+ <span class="ruby-comment cmt"># File lib/wee/continuation/session.rb, line 27</span>
266
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start_request_response_loop</span>
267
+ <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">abort_on_exception</span> = <span class="ruby-keyword kw">true</span>
268
+ <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> {
269
+ <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:wee_session</span>] = <span class="ruby-keyword kw">self</span>
270
+ <span class="ruby-identifier">loop</span> {
271
+ <span class="ruby-ivar">@context</span> = <span class="ruby-keyword kw">nil</span>
272
+
273
+ <span class="ruby-comment cmt"># get a request, check whether this session is alive after every 5</span>
274
+ <span class="ruby-comment cmt"># seconds.</span>
275
+ <span class="ruby-keyword kw">while</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">nil?</span>
276
+ <span class="ruby-keyword kw">begin</span>
277
+ <span class="ruby-constant">Timeout</span>.<span class="ruby-identifier">timeout</span>(<span class="ruby-value">5</span>) {
278
+ <span class="ruby-ivar">@context</span> = <span class="ruby-ivar">@in_queue</span>.<span class="ruby-identifier">pop</span>
279
+ }
280
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Timeout</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span>
281
+ <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">alive?</span>
282
+ <span class="ruby-keyword kw">end</span>
283
+ <span class="ruby-keyword kw">end</span>
284
+
285
+ <span class="ruby-comment cmt"># abort thread if no longer alive</span>
286
+ <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">alive?</span>
287
+
288
+ <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;invalid request&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">nil?</span>
289
+
290
+ <span class="ruby-keyword kw">begin</span>
291
+ <span class="ruby-identifier">awake</span>
292
+ <span class="ruby-identifier">process_request</span>
293
+ <span class="ruby-identifier">sleep</span>
294
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">exn</span>
295
+ <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">response</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">ErrorResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">exn</span>)
296
+ <span class="ruby-keyword kw">end</span>
297
+ <span class="ruby-ivar">@out_queue</span>.<span class="ruby-identifier">push</span>(<span class="ruby-ivar">@context</span>)
298
+ }
299
+ <span class="ruby-identifier">p</span> <span class="ruby-value str">&quot;session loop terminated&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
300
+ }
289
301
  <span class="ruby-keyword kw">end</span>
290
302
  </pre>
291
303
  </div>
292
304
  </div>
293
305
  </div>
294
306
 
295
- <div id="method-M000207" class="method-detail">
296
- <a name="M000207"></a>
307
+ <h3 class="section-bar">Protected Instance methods</h3>
308
+
309
+ <div id="method-M000278" class="method-detail">
310
+ <a name="M000278"></a>
297
311
 
298
312
  <div class="method-heading">
299
- <a href="#M000207" class="method-signature">
300
- <span class="method-name">current_context</span><span class="method-args">()</span>
313
+ <a href="#M000278" class="method-signature">
314
+ <span class="method-name">create_page</span><span class="method-args">(snapshot)</span>
301
315
  </a>
302
316
  </div>
303
317
 
304
318
  <div class="method-description">
319
+ <p>
320
+ Return a new <a href="Page.html">Wee::Page</a> object with the given
321
+ snapshot assigned.
322
+ </p>
305
323
  <p><a class="source-toggle" href="#"
306
- onclick="toggleCode('M000207-source');return false;">[Source]</a></p>
307
- <div class="method-source-code" id="M000207-source">
324
+ onclick="toggleCode('M000278-source');return false;">[Source]</a></p>
325
+ <div class="method-source-code" id="M000278-source">
308
326
  <pre>
309
- <span class="ruby-comment cmt"># File lib/wee/session.rb, line 149</span>
310
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">current_context</span>
311
- <span class="ruby-ivar">@context</span>
327
+ <span class="ruby-comment cmt"># File lib/wee/session.rb, line 145</span>
328
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_page</span>(<span class="ruby-identifier">snapshot</span>)
329
+ <span class="ruby-identifier">idgen</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">SimpleIdGenerator</span>.<span class="ruby-identifier">new</span>
330
+ <span class="ruby-identifier">page</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">Page</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">snapshot</span>, <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">CallbackRegistry</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">idgen</span>))
312
331
  <span class="ruby-keyword kw">end</span>
313
332
  </pre>
314
333
  </div>
315
334
  </div>
316
335
  </div>
317
336
 
318
- <div id="method-M000202" class="method-detail">
319
- <a name="M000202"></a>
337
+ <div id="method-M000273" class="method-detail">
338
+ <a name="M000273"></a>
320
339
 
321
340
  <div class="method-heading">
322
- <a href="#M000202" class="method-signature">
323
- <span class="method-name">handle_request</span><span class="method-args">(context)</span>
341
+ <a href="#M000273" class="method-signature">
342
+ <span class="method-name">handle_callback_phase</span><span class="method-args">()</span>
324
343
  </a>
325
344
  </div>
326
345
 
327
346
  <div class="method-description">
328
- <p>
329
- called by application to send the session a request
330
- </p>
331
347
  <p><a class="source-toggle" href="#"
332
- onclick="toggleCode('M000202-source');return false;">[Source]</a></p>
333
- <div class="method-source-code" id="M000202-source">
348
+ onclick="toggleCode('M000273-source');return false;">[Source]</a></p>
349
+ <div class="method-source-code" id="M000273-source">
334
350
  <pre>
335
- <span class="ruby-comment cmt"># File lib/wee/session.rb, line 40</span>
336
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_request</span>(<span class="ruby-identifier">context</span>)
337
- <span class="ruby-ivar">@mutex</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span>
338
- <span class="ruby-keyword kw">begin</span>
339
- <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:wee_session</span>] = <span class="ruby-keyword kw">self</span>
340
- <span class="ruby-ivar">@context</span> = <span class="ruby-identifier">context</span>
341
- <span class="ruby-keyword kw">super</span>
342
- <span class="ruby-identifier">awake</span>
343
- <span class="ruby-identifier">process_request</span>
344
- <span class="ruby-identifier">sleep</span>
345
- <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">exn</span>
346
- <span class="ruby-identifier">set_response</span>(<span class="ruby-identifier">context</span>, <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">ErrorResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">exn</span>))
347
- <span class="ruby-keyword kw">ensure</span>
348
- <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:wee_session</span>] = <span class="ruby-keyword kw">nil</span>
349
- <span class="ruby-ivar">@context</span> = <span class="ruby-keyword kw">nil</span>
350
- <span class="ruby-ivar">@page</span> = <span class="ruby-keyword kw">nil</span>
351
- <span class="ruby-keyword kw">end</span>
351
+ <span class="ruby-comment cmt"># File lib/wee/session.rb, line 97</span>
352
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_callback_phase</span>
353
+ <span class="ruby-comment cmt"># Actions/inputs were specified.</span>
354
+ <span class="ruby-comment cmt">#</span>
355
+ <span class="ruby-comment cmt"># We process the request and invoke actions/inputs. Then we generate a</span>
356
+ <span class="ruby-comment cmt"># new page view. </span>
357
+
358
+ <span class="ruby-identifier">callback_stream</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">CallbackStream</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@page</span>.<span class="ruby-identifier">callbacks</span>, <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">fields</span>)
359
+ <span class="ruby-identifier">premature_response</span> = <span class="ruby-ivar">@component_runner</span>.<span class="ruby-identifier">process_callbacks</span>(<span class="ruby-identifier">callback_stream</span>)
360
+
361
+ <span class="ruby-identifier">post_callbacks_hook</span>()
362
+
363
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">premature_response</span>
364
+ <span class="ruby-comment cmt"># replace existing page with new snapshot</span>
365
+ <span class="ruby-ivar">@page</span>.<span class="ruby-identifier">snapshot</span> = <span class="ruby-ivar">@component_runner</span>.<span class="ruby-identifier">snapshot</span>
366
+ <span class="ruby-ivar">@page_store</span>[<span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">page_id</span>] = <span class="ruby-ivar">@page</span>
367
+ <span class="ruby-ivar">@snapshot_page_id</span> = <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">page_id</span>
368
+
369
+ <span class="ruby-comment cmt"># and send response</span>
370
+ <span class="ruby-identifier">set_response</span>(<span class="ruby-ivar">@context</span>, <span class="ruby-identifier">premature_response</span>)
371
+ <span class="ruby-keyword kw">else</span>
372
+ <span class="ruby-identifier">handle_new_page_view</span>(<span class="ruby-ivar">@context</span>)
352
373
  <span class="ruby-keyword kw">end</span>
353
374
  <span class="ruby-keyword kw">end</span>
354
375
  </pre>
@@ -356,93 +377,30 @@ called by application to send the session a request
356
377
  </div>
357
378
  </div>
358
379
 
359
- <div id="method-M000206" class="method-detail">
360
- <a name="M000206"></a>
380
+ <div id="method-M000270" class="method-detail">
381
+ <a name="M000270"></a>
361
382
 
362
383
  <div class="method-heading">
363
- <a href="#M000206" class="method-signature">
364
- <span class="method-name">process_request</span><span class="method-args">()</span>
384
+ <a href="#M000270" class="method-signature">
385
+ <span class="method-name">handle_existing_page</span><span class="method-args">()</span>
365
386
  </a>
366
387
  </div>
367
388
 
368
389
  <div class="method-description">
369
390
  <p><a class="source-toggle" href="#"
370
- onclick="toggleCode('M000206-source');return false;">[Source]</a></p>
371
- <div class="method-source-code" id="M000206-source">
391
+ onclick="toggleCode('M000270-source');return false;">[Source]</a></p>
392
+ <div class="method-source-code" id="M000270-source">
372
393
  <pre>
373
- <span class="ruby-comment cmt"># File lib/wee/session.rb, line 74</span>
374
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_request</span>
375
- <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">page_id</span>.<span class="ruby-identifier">nil?</span>
376
-
377
- <span class="ruby-comment cmt"># No page_id was specified in the URL. This means that we start with a</span>
378
- <span class="ruby-comment cmt"># fresh component and a fresh page_id, then redirect to render itself.</span>
379
-
380
- <span class="ruby-identifier">handle_new_page_view</span>(<span class="ruby-ivar">@context</span>, <span class="ruby-ivar">@initial_snapshot</span>)
381
-
382
- <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@page</span> = <span class="ruby-ivar">@page_store</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">page_id</span>, <span class="ruby-keyword kw">false</span>)
383
-
384
- <span class="ruby-comment cmt"># A valid page_id was specified and the corresponding page exists.</span>
385
-
386
- <span class="ruby-ivar">@page</span>.<span class="ruby-identifier">snapshot</span>.<span class="ruby-identifier">restore</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">page_id</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@snapshot_page_id</span>
387
-
388
- <span class="ruby-identifier">p</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">fields</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
389
-
390
- <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">fields</span>.<span class="ruby-identifier">empty?</span>
391
-
392
- <span class="ruby-comment cmt"># No action/inputs were specified -&gt; render page</span>
393
- <span class="ruby-comment cmt">#</span>
394
- <span class="ruby-comment cmt"># 1. Reset the action/input fields (as they are regenerated in the</span>
395
- <span class="ruby-comment cmt"># rendering process).</span>
396
- <span class="ruby-comment cmt"># 2. Render the page (respond).</span>
397
- <span class="ruby-comment cmt"># 3. Store the page back into the store</span>
398
-
399
- <span class="ruby-ivar">@page</span> = <span class="ruby-identifier">create_page</span>(<span class="ruby-ivar">@page</span>.<span class="ruby-identifier">snapshot</span>) <span class="ruby-comment cmt"># remove all action/input handlers</span>
400
- <span class="ruby-identifier">respond</span>(<span class="ruby-ivar">@context</span>, <span class="ruby-ivar">@page</span>.<span class="ruby-identifier">callbacks</span>) <span class="ruby-comment cmt"># render</span>
401
- <span class="ruby-ivar">@page_store</span>[<span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">page_id</span>] = <span class="ruby-ivar">@page</span> <span class="ruby-comment cmt"># store</span>
402
-
403
- <span class="ruby-keyword kw">else</span>
404
-
405
- <span class="ruby-comment cmt"># Actions/inputs were specified.</span>
406
- <span class="ruby-comment cmt">#</span>
407
- <span class="ruby-comment cmt"># We process the request and invoke actions/inputs. Then we generate a</span>
408
- <span class="ruby-comment cmt"># new page view. </span>
409
-
410
- <span class="ruby-identifier">callback_stream</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">CallbackStream</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@page</span>.<span class="ruby-identifier">callbacks</span>, <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">fields</span>)
411
-
412
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">callback_stream</span>.<span class="ruby-identifier">all_of_type</span>(<span class="ruby-identifier">:action</span>).<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>
413
- <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Not allowed to specify more than one action callback&quot;</span>
414
- <span class="ruby-keyword kw">end</span>
415
-
416
- <span class="ruby-identifier">live_update_response</span> = <span class="ruby-identifier">catch</span>(<span class="ruby-identifier">:wee_live_update</span>) {
417
- <span class="ruby-identifier">catch</span>(<span class="ruby-identifier">:wee_back_to_session</span>) {
418
- <span class="ruby-ivar">@root_component</span>.<span class="ruby-identifier">process_callbacks_chain</span>(<span class="ruby-identifier">callback_stream</span>)
419
- }
420
- <span class="ruby-keyword kw">nil</span>
421
- }
422
-
423
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">live_update_response</span>
424
- <span class="ruby-comment cmt"># replace existing page with new snapshot</span>
425
- <span class="ruby-ivar">@page</span>.<span class="ruby-identifier">snapshot</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">snapshot</span>
426
- <span class="ruby-ivar">@page_store</span>[<span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">page_id</span>] = <span class="ruby-ivar">@page</span>
427
- <span class="ruby-ivar">@snapshot_page_id</span> = <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">page_id</span>
428
- <span class="ruby-identifier">set_response</span>(<span class="ruby-ivar">@context</span>, <span class="ruby-identifier">live_update_response</span>)
429
- <span class="ruby-keyword kw">else</span>
430
- <span class="ruby-identifier">handle_new_page_view</span>(<span class="ruby-ivar">@context</span>)
431
- <span class="ruby-keyword kw">end</span>
394
+ <span class="ruby-comment cmt"># File lib/wee/session.rb, line 66</span>
395
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_existing_page</span>
396
+ <span class="ruby-ivar">@page</span>.<span class="ruby-identifier">snapshot</span>.<span class="ruby-identifier">restore</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">page_id</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@snapshot_page_id</span>
432
397
 
433
- <span class="ruby-keyword kw">end</span>
398
+ <span class="ruby-identifier">p</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">fields</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
434
399
 
400
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">render?</span>
401
+ <span class="ruby-identifier">handle_render_phase</span>
435
402
  <span class="ruby-keyword kw">else</span>
436
-
437
- <span class="ruby-comment cmt"># A page_id was specified in the URL, but there's no page for it in the</span>
438
- <span class="ruby-comment cmt"># page store. Either the page has timed out, or an invalid page_id was</span>
439
- <span class="ruby-comment cmt"># specified. </span>
440
- <span class="ruby-comment cmt">#</span>
441
- <span class="ruby-comment cmt"># TODO:: Display an &quot;invalid page or page timed out&quot; message, which</span>
442
- <span class="ruby-comment cmt"># forwards to /app/session-id</span>
443
-
444
- <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Not yet implemented&quot;</span>
445
-
403
+ <span class="ruby-identifier">handle_callback_phase</span>
446
404
  <span class="ruby-keyword kw">end</span>
447
405
  <span class="ruby-keyword kw">end</span>
448
406
  </pre>
@@ -450,320 +408,256 @@ called by application to send the session a request
450
408
  </div>
451
409
  </div>
452
410
 
453
- <div id="method-M000205" class="method-detail">
454
- <a name="M000205"></a>
411
+ <div id="method-M000271" class="method-detail">
412
+ <a name="M000271"></a>
455
413
 
456
414
  <div class="method-heading">
457
- <a href="#M000205" class="method-signature">
458
- <span class="method-name">sleep</span><span class="method-args">()</span>
415
+ <a href="#M000271" class="method-signature">
416
+ <span class="method-name">handle_invalid_page</span><span class="method-args">()</span>
459
417
  </a>
460
418
  </div>
461
419
 
462
420
  <div class="method-description">
463
- <p>
464
- Is called after <a href="Session.html#M000206">process_request</a> is run
465
- Can be used to release e.g. a database connection.
466
- </p>
467
421
  <p><a class="source-toggle" href="#"
468
- onclick="toggleCode('M000205-source');return false;">[Source]</a></p>
469
- <div class="method-source-code" id="M000205-source">
422
+ onclick="toggleCode('M000271-source');return false;">[Source]</a></p>
423
+ <div class="method-source-code" id="M000271-source">
470
424
  <pre>
471
- <span class="ruby-comment cmt"># File lib/wee/session.rb, line 71</span>
472
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sleep</span>
425
+ <span class="ruby-comment cmt"># File lib/wee/session.rb, line 78</span>
426
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_invalid_page</span>
427
+ <span class="ruby-comment cmt"># TODO:: Display an &quot;invalid page or page timed out&quot; message, which</span>
428
+ <span class="ruby-comment cmt"># forwards to /app/session-id</span>
429
+ <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Not yet implemented&quot;</span>
473
430
  <span class="ruby-keyword kw">end</span>
474
431
  </pre>
475
432
  </div>
476
433
  </div>
477
434
  </div>
478
435
 
479
- <div id="method-M000201" class="method-detail">
480
- <a name="M000201"></a>
436
+ <div id="method-M000269" class="method-detail">
437
+ <a name="M000269"></a>
481
438
 
482
439
  <div class="method-heading">
483
- <a href="#M000201" class="method-signature">
484
- <span class="method-name">snapshot</span><span class="method-args">()</span>
440
+ <a href="#M000269" class="method-signature">
441
+ <span class="method-name">handle_new_page</span><span class="method-args">()</span>
485
442
  </a>
486
443
  </div>
487
444
 
488
445
  <div class="method-description">
489
446
  <p><a class="source-toggle" href="#"
490
- onclick="toggleCode('M000201-source');return false;">[Source]</a></p>
491
- <div class="method-source-code" id="M000201-source">
447
+ onclick="toggleCode('M000269-source');return false;">[Source]</a></p>
448
+ <div class="method-source-code" id="M000269-source">
492
449
  <pre>
493
- <span class="ruby-comment cmt"># File lib/wee/session.rb, line 33</span>
494
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">snapshot</span>
495
- <span class="ruby-ivar">@root_component</span>.<span class="ruby-identifier">backtrack_state_chain</span>(<span class="ruby-identifier">snap</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">Snapshot</span>.<span class="ruby-identifier">new</span>)
496
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">snap</span>.<span class="ruby-identifier">freeze</span>
450
+ <span class="ruby-comment cmt"># File lib/wee/session.rb, line 62</span>
451
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_new_page</span>
452
+ <span class="ruby-identifier">handle_new_page_view</span>(<span class="ruby-ivar">@context</span>, <span class="ruby-ivar">@initial_snapshot</span>)
497
453
  <span class="ruby-keyword kw">end</span>
498
454
  </pre>
499
455
  </div>
500
456
  </div>
501
457
  </div>
502
458
 
503
-
504
- </div>
505
- <div id="section">
506
- <h2 class="section-title"><a name="SEC00016">Properties</a></h2>
507
- <div class="section-comment">
508
-
509
- </div>
510
-
511
-
512
-
513
-
514
-
515
- <div id="attribute-list">
516
- <h3 class="section-bar">Attributes</h3>
517
-
518
- <div class="name-list">
519
- <table>
520
- <tr class="top-aligned-row context-row">
521
- <td class="context-item-name">properties</td>
522
- <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
523
- <td class="context-item-desc"></td>
524
- </tr>
525
- </table>
526
- </div>
527
- </div>
528
-
529
-
530
-
531
- <!-- if method_list -->
532
- <div id="methods">
533
- <h3 class="section-bar">Public Class methods</h3>
534
-
535
- <div id="method-M000213" class="method-detail">
536
- <a name="M000213"></a>
459
+ <div id="method-M000274" class="method-detail">
460
+ <a name="M000274"></a>
537
461
 
538
462
  <div class="method-heading">
539
- <a href="#M000213" class="method-signature">
540
- <span class="method-name">new</span><span class="method-args">(&amp;block)</span>
463
+ <a href="#M000274" class="method-signature">
464
+ <span class="method-name">handle_new_page_view</span><span class="method-args">(context, snapshot=nil)</span>
541
465
  </a>
542
466
  </div>
543
467
 
544
468
  <div class="method-description">
545
469
  <p><a class="source-toggle" href="#"
546
- onclick="toggleCode('M000213-source');return false;">[Source]</a></p>
547
- <div class="method-source-code" id="M000213-source">
470
+ onclick="toggleCode('M000274-source');return false;">[Source]</a></p>
471
+ <div class="method-source-code" id="M000274-source">
548
472
  <pre>
549
- <span class="ruby-comment cmt"># File lib/wee/continuation/session.rb, line 4</span>
550
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
551
- <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:wee_session</span>] = <span class="ruby-keyword kw">self</span>
552
-
553
- <span class="ruby-ivar">@idgen</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">SimpleIdGenerator</span>.<span class="ruby-identifier">new</span>
554
- <span class="ruby-ivar">@in_queue</span>, <span class="ruby-ivar">@out_queue</span> = <span class="ruby-constant">SizedQueue</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">1</span>), <span class="ruby-constant">SizedQueue</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">1</span>)
555
-
556
- <span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-keyword kw">self</span>)
557
-
558
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;No root component specified&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@root_component</span>.<span class="ruby-identifier">nil?</span>
559
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;No page_store specified&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@page_store</span>.<span class="ruby-identifier">nil?</span>
560
-
561
- <span class="ruby-ivar">@initial_snapshot</span> = <span class="ruby-identifier">snapshot</span>()
562
-
563
- <span class="ruby-identifier">start_request_response_loop</span>
564
- <span class="ruby-keyword kw">super</span>()
565
- <span class="ruby-keyword kw">ensure</span>
566
- <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:wee_session</span>] = <span class="ruby-keyword kw">nil</span>
473
+ <span class="ruby-comment cmt"># File lib/wee/session.rb, line 121</span>
474
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_new_page_view</span>(<span class="ruby-identifier">context</span>, <span class="ruby-identifier">snapshot</span>=<span class="ruby-keyword kw">nil</span>)
475
+ <span class="ruby-identifier">new_page_id</span> = <span class="ruby-ivar">@idgen</span>.<span class="ruby-identifier">next</span>.<span class="ruby-identifier">to_s</span>
476
+ <span class="ruby-identifier">new_page</span> = <span class="ruby-identifier">create_page</span>(<span class="ruby-identifier">snapshot</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@component_runner</span>.<span class="ruby-identifier">snapshot</span>)
477
+ <span class="ruby-ivar">@page_store</span>[<span class="ruby-identifier">new_page_id</span>] = <span class="ruby-identifier">new_page</span>
478
+ <span class="ruby-ivar">@snapshot_page_id</span> = <span class="ruby-identifier">new_page_id</span>
479
+ <span class="ruby-identifier">redirect_url</span> = <span class="ruby-identifier">context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">build_url</span>(<span class="ruby-identifier">:page_id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">new_page_id</span>)
480
+ <span class="ruby-identifier">set_response</span>(<span class="ruby-identifier">context</span>, <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">RedirectResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">redirect_url</span>))
567
481
  <span class="ruby-keyword kw">end</span>
568
482
  </pre>
569
483
  </div>
570
484
  </div>
571
485
  </div>
572
486
 
573
- <h3 class="section-bar">Public Instance methods</h3>
574
-
575
- <div id="method-M000209" class="method-detail">
576
- <a name="M000209"></a>
487
+ <div id="method-M000272" class="method-detail">
488
+ <a name="M000272"></a>
577
489
 
578
490
  <div class="method-heading">
579
- <a href="#M000209" class="method-signature">
580
- <span class="method-name">get_property</span><span class="method-args">(prop, klass)</span>
491
+ <a href="#M000272" class="method-signature">
492
+ <span class="method-name">handle_render_phase</span><span class="method-args">()</span>
581
493
  </a>
582
494
  </div>
583
495
 
584
496
  <div class="method-description">
585
- <p>
586
- Returns an &quot;owned&quot; property for the given <tt>klass</tt>.
587
- </p>
588
497
  <p><a class="source-toggle" href="#"
589
- onclick="toggleCode('M000209-source');return false;">[Source]</a></p>
590
- <div class="method-source-code" id="M000209-source">
498
+ onclick="toggleCode('M000272-source');return false;">[Source]</a></p>
499
+ <div class="method-source-code" id="M000272-source">
591
500
  <pre>
592
- <span class="ruby-comment cmt"># File lib/wee/session.rb, line 165</span>
593
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_property</span>(<span class="ruby-identifier">prop</span>, <span class="ruby-identifier">klass</span>)
594
- <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@properties</span>
595
- <span class="ruby-ivar">@properties</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">klass</span>, {})[<span class="ruby-identifier">prop</span>]
596
- <span class="ruby-keyword kw">else</span>
597
- <span class="ruby-keyword kw">nil</span>
598
- <span class="ruby-keyword kw">end</span>
501
+ <span class="ruby-comment cmt"># File lib/wee/session.rb, line 84</span>
502
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_render_phase</span>
503
+ <span class="ruby-comment cmt"># No action/inputs were specified -&gt; render page</span>
504
+ <span class="ruby-comment cmt">#</span>
505
+ <span class="ruby-comment cmt"># 1. Reset the action/input fields (as they are regenerated in the</span>
506
+ <span class="ruby-comment cmt"># rendering process).</span>
507
+ <span class="ruby-comment cmt"># 2. Render the page (respond).</span>
508
+ <span class="ruby-comment cmt"># 3. Store the page back into the store</span>
509
+
510
+ <span class="ruby-ivar">@page</span> = <span class="ruby-identifier">create_page</span>(<span class="ruby-ivar">@page</span>.<span class="ruby-identifier">snapshot</span>) <span class="ruby-comment cmt"># remove all action/input handlers</span>
511
+ <span class="ruby-identifier">respond</span>(<span class="ruby-ivar">@context</span>, <span class="ruby-ivar">@page</span>.<span class="ruby-identifier">callbacks</span>) <span class="ruby-comment cmt"># render</span>
512
+ <span class="ruby-ivar">@page_store</span>[<span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">page_id</span>] = <span class="ruby-ivar">@page</span> <span class="ruby-comment cmt"># store</span>
599
513
  <span class="ruby-keyword kw">end</span>
600
514
  </pre>
601
515
  </div>
602
516
  </div>
603
517
  </div>
604
518
 
605
- <div id="method-M000214" class="method-detail">
606
- <a name="M000214"></a>
519
+ <div id="method-M000277" class="method-detail">
520
+ <a name="M000277"></a>
607
521
 
608
522
  <div class="method-heading">
609
- <a href="#M000214" class="method-signature">
610
- <span class="method-name">handle_request</span><span class="method-args">(context)</span>
523
+ <a href="#M000277" class="method-signature">
524
+ <span class="method-name">post_callbacks_hook</span><span class="method-args">()</span>
611
525
  </a>
612
526
  </div>
613
527
 
614
528
  <div class="method-description">
615
- <p>
616
- called by application to send the session a request
617
- </p>
618
529
  <p><a class="source-toggle" href="#"
619
- onclick="toggleCode('M000214-source');return false;">[Source]</a></p>
620
- <div class="method-source-code" id="M000214-source">
530
+ onclick="toggleCode('M000277-source');return false;">[Source]</a></p>
531
+ <div class="method-source-code" id="M000277-source">
621
532
  <pre>
622
- <span class="ruby-comment cmt"># File lib/wee/continuation/session.rb, line 24</span>
623
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_request</span>(<span class="ruby-identifier">context</span>)
624
- <span class="ruby-keyword kw">super</span>
625
-
626
- <span class="ruby-comment cmt"># Send a request to the session. If the session is currently busy</span>
627
- <span class="ruby-comment cmt"># processing another request, this will block. </span>
628
- <span class="ruby-ivar">@in_queue</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">context</span>)
629
-
630
- <span class="ruby-comment cmt"># Wait for the response.</span>
631
- <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@out_queue</span>.<span class="ruby-identifier">pop</span>
533
+ <span class="ruby-comment cmt"># File lib/wee/session.rb, line 140</span>
534
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">post_callbacks_hook</span>
632
535
  <span class="ruby-keyword kw">end</span>
633
536
  </pre>
634
537
  </div>
635
538
  </div>
636
539
  </div>
637
540
 
638
- <div id="method-M000215" class="method-detail">
639
- <a name="M000215"></a>
541
+ <div id="method-M000276" class="method-detail">
542
+ <a name="M000276"></a>
640
543
 
641
544
  <div class="method-heading">
642
- <a href="#M000215" class="method-signature">
643
- <span class="method-name">start_request_response_loop</span><span class="method-args">()</span>
545
+ <a href="#M000276" class="method-signature">
546
+ <span class="method-name">pre_respond_hook</span><span class="method-args">()</span>
644
547
  </a>
645
548
  </div>
646
549
 
647
550
  <div class="method-description">
648
551
  <p><a class="source-toggle" href="#"
649
- onclick="toggleCode('M000215-source');return false;">[Source]</a></p>
650
- <div class="method-source-code" id="M000215-source">
552
+ onclick="toggleCode('M000276-source');return false;">[Source]</a></p>
553
+ <div class="method-source-code" id="M000276-source">
651
554
  <pre>
652
- <span class="ruby-comment cmt"># File lib/wee/continuation/session.rb, line 35</span>
653
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start_request_response_loop</span>
654
- <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">abort_on_exception</span> = <span class="ruby-keyword kw">true</span>
655
- <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> {
656
- <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:wee_session</span>] = <span class="ruby-keyword kw">self</span>
657
- <span class="ruby-identifier">loop</span> {
658
- <span class="ruby-ivar">@context</span> = <span class="ruby-keyword kw">nil</span>
659
-
660
- <span class="ruby-comment cmt"># get a request, check whether this session is alive after every 5</span>
661
- <span class="ruby-comment cmt"># seconds.</span>
662
- <span class="ruby-keyword kw">while</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">nil?</span>
663
- <span class="ruby-keyword kw">begin</span>
664
- <span class="ruby-constant">Timeout</span>.<span class="ruby-identifier">timeout</span>(<span class="ruby-value">5</span>) {
665
- <span class="ruby-ivar">@context</span> = <span class="ruby-ivar">@in_queue</span>.<span class="ruby-identifier">pop</span>
666
- }
667
- <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Timeout</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span>
668
- <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">alive?</span>
669
- <span class="ruby-keyword kw">end</span>
670
- <span class="ruby-keyword kw">end</span>
671
-
672
- <span class="ruby-comment cmt"># abort thread if no longer alive</span>
673
- <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">alive?</span>
674
-
675
- <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;invalid request&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">nil?</span>
676
-
677
- <span class="ruby-keyword kw">begin</span>
678
- <span class="ruby-identifier">awake</span>
679
- <span class="ruby-identifier">process_request</span>
680
- <span class="ruby-identifier">sleep</span>
681
- <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">exn</span>
682
- <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">response</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">ErrorResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">exn</span>)
683
- <span class="ruby-keyword kw">end</span>
684
- <span class="ruby-ivar">@out_queue</span>.<span class="ruby-identifier">push</span>(<span class="ruby-ivar">@context</span>)
685
- }
686
- <span class="ruby-identifier">p</span> <span class="ruby-value str">&quot;session loop terminated&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
687
- }
555
+ <span class="ruby-comment cmt"># File lib/wee/session.rb, line 137</span>
556
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pre_respond_hook</span>
688
557
  <span class="ruby-keyword kw">end</span>
689
558
  </pre>
690
559
  </div>
691
560
  </div>
692
561
  </div>
693
562
 
694
- <h3 class="section-bar">Private Instance methods</h3>
695
-
696
- <div id="method-M000210" class="method-detail">
697
- <a name="M000210"></a>
563
+ <div id="method-M000268" class="method-detail">
564
+ <a name="M000268"></a>
698
565
 
699
566
  <div class="method-heading">
700
- <a href="#M000210" class="method-signature">
701
- <span class="method-name">handle_new_page_view</span><span class="method-args">(context, snapshot=nil)</span>
567
+ <a href="#M000268" class="method-signature">
568
+ <span class="method-name">process_request</span><span class="method-args">()</span>
702
569
  </a>
703
570
  </div>
704
571
 
705
572
  <div class="method-description">
573
+ <p>
574
+ The main routine where the request is processed.
575
+ </p>
706
576
  <p><a class="source-toggle" href="#"
707
- onclick="toggleCode('M000210-source');return false;">[Source]</a></p>
708
- <div class="method-source-code" id="M000210-source">
577
+ onclick="toggleCode('M000268-source');return false;">[Source]</a></p>
578
+ <div class="method-source-code" id="M000268-source">
709
579
  <pre>
710
- <span class="ruby-comment cmt"># File lib/wee/session.rb, line 175</span>
711
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_new_page_view</span>(<span class="ruby-identifier">context</span>, <span class="ruby-identifier">snapshot</span>=<span class="ruby-keyword kw">nil</span>)
712
- <span class="ruby-identifier">new_page_id</span> = <span class="ruby-ivar">@idgen</span>.<span class="ruby-identifier">next</span>.<span class="ruby-identifier">to_s</span>
713
- <span class="ruby-identifier">new_page</span> = <span class="ruby-identifier">create_page</span>(<span class="ruby-identifier">snapshot</span> <span class="ruby-operator">||</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">snapshot</span>())
714
- <span class="ruby-ivar">@page_store</span>[<span class="ruby-identifier">new_page_id</span>] = <span class="ruby-identifier">new_page</span>
715
- <span class="ruby-ivar">@snapshot_page_id</span> = <span class="ruby-identifier">new_page_id</span>
716
- <span class="ruby-identifier">redirect_url</span> = <span class="ruby-identifier">context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">build_url</span>(<span class="ruby-identifier">context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">request_handler_id</span>, <span class="ruby-identifier">new_page_id</span>)
717
- <span class="ruby-identifier">set_response</span>(<span class="ruby-identifier">context</span>, <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">RedirectResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">redirect_url</span>))
580
+ <span class="ruby-comment cmt"># File lib/wee/session.rb, line 37</span>
581
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_request</span>
582
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">page_id</span>.<span class="ruby-identifier">nil?</span>
583
+
584
+ <span class="ruby-comment cmt"># No page_id was specified in the URL. This means that we start with a</span>
585
+ <span class="ruby-comment cmt"># fresh component and a fresh page_id, then redirect to render itself.</span>
586
+
587
+ <span class="ruby-identifier">handle_new_page</span>
588
+
589
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@page</span> = <span class="ruby-ivar">@page_store</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-ivar">@context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">page_id</span>, <span class="ruby-keyword kw">false</span>)
590
+
591
+ <span class="ruby-comment cmt"># A valid page_id was specified and the corresponding page exists.</span>
592
+
593
+ <span class="ruby-identifier">handle_existing_page</span>
594
+
595
+ <span class="ruby-keyword kw">else</span>
596
+
597
+ <span class="ruby-comment cmt"># A page_id was specified in the URL, but there's no page for it in the</span>
598
+ <span class="ruby-comment cmt"># page store. Either the page has timed out, or an invalid page_id was</span>
599
+ <span class="ruby-comment cmt"># specified. </span>
600
+
601
+ <span class="ruby-identifier">handle_invalid_page</span>
602
+
603
+ <span class="ruby-keyword kw">end</span>
718
604
  <span class="ruby-keyword kw">end</span>
719
605
  </pre>
720
606
  </div>
721
607
  </div>
722
608
  </div>
723
609
 
724
- <div id="method-M000212" class="method-detail">
725
- <a name="M000212"></a>
610
+ <div id="method-M000275" class="method-detail">
611
+ <a name="M000275"></a>
726
612
 
727
613
  <div class="method-heading">
728
- <a href="#M000212" class="method-signature">
614
+ <a href="#M000275" class="method-signature">
729
615
  <span class="method-name">respond</span><span class="method-args">(context, callbacks)</span>
730
616
  </a>
731
617
  </div>
732
618
 
733
619
  <div class="method-description">
734
620
  <p><a class="source-toggle" href="#"
735
- onclick="toggleCode('M000212-source');return false;">[Source]</a></p>
736
- <div class="method-source-code" id="M000212-source">
621
+ onclick="toggleCode('M000275-source');return false;">[Source]</a></p>
622
+ <div class="method-source-code" id="M000275-source">
737
623
  <pre>
738
- <span class="ruby-comment cmt"># File lib/wee/session.rb, line 188</span>
624
+ <span class="ruby-comment cmt"># File lib/wee/session.rb, line 130</span>
739
625
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">respond</span>(<span class="ruby-identifier">context</span>, <span class="ruby-identifier">callbacks</span>)
626
+ <span class="ruby-identifier">pre_respond_hook</span>
740
627
  <span class="ruby-identifier">set_response</span>(<span class="ruby-identifier">context</span>, <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">GenericResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'text/html'</span>, <span class="ruby-value str">''</span>))
741
-
742
- <span class="ruby-identifier">rctx</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">RenderingContext</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">context</span>.<span class="ruby-identifier">request</span>, <span class="ruby-identifier">context</span>.<span class="ruby-identifier">response</span>, <span class="ruby-identifier">callbacks</span>, <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">HtmlWriter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">context</span>.<span class="ruby-identifier">response</span>.<span class="ruby-identifier">content</span>))
743
- <span class="ruby-ivar">@root_component</span>.<span class="ruby-identifier">do_render_chain</span>(<span class="ruby-identifier">rctx</span>)
628
+ <span class="ruby-identifier">rctx</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">RenderingContext</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">context</span>, <span class="ruby-identifier">callbacks</span>, <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">HtmlWriter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">context</span>.<span class="ruby-identifier">response</span>.<span class="ruby-identifier">content</span>))
629
+ <span class="ruby-ivar">@component_runner</span>.<span class="ruby-identifier">render</span>(<span class="ruby-identifier">rctx</span>)
744
630
  <span class="ruby-keyword kw">end</span>
745
631
  </pre>
746
632
  </div>
747
633
  </div>
748
634
  </div>
749
635
 
750
- <div id="method-M000211" class="method-detail">
751
- <a name="M000211"></a>
636
+ <div id="method-M000267" class="method-detail">
637
+ <a name="M000267"></a>
752
638
 
753
639
  <div class="method-heading">
754
- <a href="#M000211" class="method-signature">
755
- <span class="method-name">set_response</span><span class="method-args">(context, response)</span>
640
+ <a href="#M000267" class="method-signature">
641
+ <span class="method-name">setup</span><span class="method-args">(&amp;block)</span>
756
642
  </a>
757
643
  </div>
758
644
 
759
645
  <div class="method-description">
760
646
  <p><a class="source-toggle" href="#"
761
- onclick="toggleCode('M000211-source');return false;">[Source]</a></p>
762
- <div class="method-source-code" id="M000211-source">
647
+ onclick="toggleCode('M000267-source');return false;">[Source]</a></p>
648
+ <div class="method-source-code" id="M000267-source">
763
649
  <pre>
764
- <span class="ruby-comment cmt"># File lib/wee/session.rb, line 184</span>
765
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_response</span>(<span class="ruby-identifier">context</span>, <span class="ruby-identifier">response</span>)
766
- <span class="ruby-identifier">context</span>.<span class="ruby-identifier">response</span> = <span class="ruby-identifier">response</span>
650
+ <span class="ruby-comment cmt"># File lib/wee/session.rb, line 23</span>
651
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
652
+ <span class="ruby-ivar">@idgen</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">SimpleIdGenerator</span>.<span class="ruby-identifier">new</span>
653
+
654
+ <span class="ruby-identifier">with_session</span> <span class="ruby-keyword kw">do</span>
655
+ <span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>
656
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;No component runner specified&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@component_runner</span>.<span class="ruby-identifier">nil?</span>
657
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;No page_store specified&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@page_store</span>.<span class="ruby-identifier">nil?</span>
658
+
659
+ <span class="ruby-ivar">@initial_snapshot</span> = <span class="ruby-ivar">@component_runner</span>.<span class="ruby-identifier">snapshot</span>
660
+ <span class="ruby-keyword kw">end</span>
767
661
  <span class="ruby-keyword kw">end</span>
768
662
  </pre>
769
663
  </div>