wee 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +286 -0
- data/Features +185 -0
- data/doc/rdoc/classes/ActionView.html +107 -0
- data/doc/rdoc/classes/ActionView/Base.html +133 -0
- data/doc/rdoc/classes/Array.html +7 -59
- data/doc/rdoc/classes/Cache/StorageCache.html +38 -38
- data/doc/rdoc/classes/Cache/Strategy/CapacityBounded.html +30 -30
- data/doc/rdoc/classes/Cache/Strategy/LFU.html +24 -24
- data/doc/rdoc/classes/Cache/Strategy/LRU.html +24 -24
- data/doc/rdoc/classes/Cache/Strategy/Unbounded.html +24 -24
- data/doc/rdoc/classes/Enumerable.html +6 -6
- data/doc/rdoc/classes/Hash.html +120 -0
- data/doc/rdoc/classes/Main.html +58 -34
- data/doc/rdoc/classes/Object.html +12 -12
- data/doc/rdoc/classes/OgScaffolder.html +165 -166
- data/doc/rdoc/classes/OgScaffolder/Editor.html +112 -112
- data/doc/rdoc/classes/String.html +7 -59
- data/doc/rdoc/classes/Struct.html +14 -14
- data/doc/rdoc/classes/Wee.html +70 -6
- data/doc/rdoc/classes/Wee/AbstractSession.html +502 -0
- data/doc/rdoc/classes/Wee/AnswerDecoration.html +11 -11
- data/doc/rdoc/classes/Wee/Application.html +139 -84
- data/doc/rdoc/classes/Wee/Brush.html +21 -18
- data/doc/rdoc/classes/Wee/Brush/AnchorTag.html +90 -17
- data/doc/rdoc/classes/Wee/Brush/CheckboxTag.html +162 -0
- data/doc/rdoc/classes/Wee/Brush/FileUploadTag.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/FormTag.html +41 -17
- data/doc/rdoc/classes/Wee/Brush/GenericEncodedTextBrush.html +12 -12
- data/doc/rdoc/classes/Wee/Brush/GenericSingleTagBrush.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/GenericTagBrush.html +112 -86
- data/doc/rdoc/classes/Wee/Brush/GenericTextBrush.html +12 -12
- data/doc/rdoc/classes/Wee/Brush/HiddenInputTag.html +160 -0
- data/doc/rdoc/classes/Wee/Brush/ImageButtonTag.html +15 -15
- data/doc/rdoc/classes/Wee/Brush/ImageTag.html +21 -21
- data/doc/rdoc/classes/Wee/Brush/InputTag.html +14 -14
- data/doc/rdoc/classes/Wee/Brush/JavascriptTag.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/Page.html +14 -14
- data/doc/rdoc/classes/Wee/Brush/RadioButtonTag.html +234 -0
- data/doc/rdoc/classes/Wee/Brush/RadioButtonTag/RadioGroup.html +207 -0
- data/doc/rdoc/classes/Wee/Brush/SelectListTag.html +124 -28
- data/doc/rdoc/classes/Wee/Brush/SelectListTag/SelectListCallback.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/SelectOptionTag.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/SubmitButtonTag.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/TableDataTag.html +14 -14
- data/doc/rdoc/classes/Wee/Brush/TableHeaderTag.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/TableRowTag.html +42 -42
- data/doc/rdoc/classes/Wee/Brush/TableTag.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/TextAreaTag.html +48 -15
- data/doc/rdoc/classes/Wee/Brush/TextInputTag.html +7 -7
- data/doc/rdoc/classes/Wee/CallbackRegistry.html +38 -38
- data/doc/rdoc/classes/Wee/CallbackStream.html +18 -18
- data/doc/rdoc/classes/Wee/CanvasMixin.html +225 -0
- data/doc/rdoc/classes/Wee/Component.html +202 -201
- data/doc/rdoc/classes/Wee/Component/OnAnswer.html +7 -7
- data/doc/rdoc/classes/Wee/ComponentDispatcher.html +289 -0
- data/doc/rdoc/classes/Wee/ComponentRunner.html +321 -0
- data/doc/rdoc/classes/Wee/Context.html +63 -3
- data/doc/rdoc/classes/Wee/Decoration.html +45 -45
- data/doc/rdoc/classes/Wee/Delegate.html +30 -30
- data/doc/rdoc/classes/Wee/DupReplaceSnapshotMixin.html +164 -0
- data/doc/rdoc/classes/Wee/ErrorResponse.html +16 -16
- data/doc/rdoc/classes/Wee/Examples.html +114 -0
- data/doc/rdoc/classes/Wee/Examples/Calculator.html +319 -0
- data/doc/rdoc/classes/Wee/Examples/Counter.html +289 -0
- data/doc/rdoc/classes/Wee/Examples/EditableCounter.html +210 -0
- data/doc/rdoc/classes/Wee/Examples/Window.html +346 -0
- data/doc/rdoc/classes/Wee/FastCGIAdaptor.html +227 -0
- data/doc/rdoc/classes/Wee/FormDecoration.html +6 -6
- data/doc/rdoc/classes/Wee/GenericResponse.html +7 -7
- data/doc/rdoc/classes/Wee/HtmlCanvasRenderer.html +1230 -0
- data/doc/rdoc/classes/Wee/HtmlWriter.html +40 -40
- data/doc/rdoc/classes/Wee/IdGenerator.html +148 -0
- data/doc/rdoc/classes/Wee/LiteralMethodCallback.html +27 -14
- data/doc/rdoc/classes/Wee/LoginDecoration.html +261 -0
- data/doc/rdoc/classes/Wee/Md5IdGenerator.html +14 -14
- data/doc/rdoc/classes/Wee/MessageBox.html +14 -14
- data/doc/rdoc/classes/Wee/Nitro.html +114 -0
- data/doc/rdoc/classes/Wee/Nitro/ControllerClassMixin.html +192 -0
- data/doc/rdoc/classes/Wee/Nitro/ControllerMixin.html +345 -0
- data/doc/rdoc/classes/Wee/Nitro/FormTag.html +155 -0
- data/doc/rdoc/classes/Wee/Nitro/HtmlCanvasRenderer.html +178 -0
- data/doc/rdoc/classes/Wee/Page.html +4 -0
- data/doc/rdoc/classes/Wee/PageDecoration.html +18 -18
- data/doc/rdoc/classes/Wee/PagelessApplication.html +13 -11
- data/doc/rdoc/classes/Wee/PagelessComponentDriver.html +296 -0
- data/doc/rdoc/classes/Wee/PagelessRequest.html +52 -21
- data/doc/rdoc/classes/Wee/PagelessSession.html +130 -91
- data/doc/rdoc/classes/Wee/Pager.html +534 -0
- data/doc/rdoc/classes/Wee/Presenter.html +482 -298
- data/doc/rdoc/classes/Wee/Rails.html +114 -0
- data/doc/rdoc/classes/Wee/Rails/ControllerClassMixin.html +192 -0
- data/doc/rdoc/classes/Wee/Rails/ControllerMixin.html +342 -0
- data/doc/rdoc/classes/Wee/Rails/FormTag.html +155 -0
- data/doc/rdoc/classes/Wee/Rails/HtmlCanvasRenderer.html +177 -0
- data/doc/rdoc/classes/Wee/RedirectResponse.html +7 -7
- data/doc/rdoc/classes/Wee/RefreshResponse.html +7 -7
- data/doc/rdoc/classes/Wee/Renderer.html +208 -0
- data/doc/rdoc/classes/Wee/RenderingContext.html +175 -3
- data/doc/rdoc/classes/Wee/Request.html +197 -46
- data/doc/rdoc/classes/Wee/RequestHandler.html +31 -31
- data/doc/rdoc/classes/Wee/Response.html +44 -43
- data/doc/rdoc/classes/Wee/Session.html +296 -402
- data/doc/rdoc/classes/Wee/SimpleIdGenerator.html +14 -14
- data/doc/rdoc/classes/Wee/Snapshot.html +19 -19
- data/doc/rdoc/classes/Wee/Utils.html +22 -22
- data/doc/rdoc/classes/Wee/Utils/LRUCache.html +6 -6
- data/doc/rdoc/classes/Wee/ValueHolder.html +19 -19
- data/doc/rdoc/classes/Wee/WEBrickAdaptor.html +72 -46
- data/doc/rdoc/classes/Wee/WrapperDecoration.html +6 -6
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/INSTALL.html +1 -1
- data/doc/rdoc/files/README.html +8 -12
- data/doc/rdoc/files/lib/cache/cache_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/abstractsession_rb.html +108 -0
- data/doc/rdoc/files/lib/wee/adaptors/fastcgi_rb.html +108 -0
- data/doc/rdoc/files/lib/wee/adaptors/nitro_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/adaptors/rails_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/adaptors/webrick_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/application_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/components/component_dispatcher_rb.html +108 -0
- data/doc/rdoc/files/lib/wee/components/form_decoration_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/components/login_decoration_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/components/messagebox_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/components/page_decoration_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/components/pager_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/components/wrapper_decoration_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/components_rb.html +4 -1
- data/doc/rdoc/files/lib/wee/continuation/core/component_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/continuation/session_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/continuation_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/core/callback_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/core/component_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/core/componentrunner_rb.html +110 -0
- data/doc/rdoc/files/lib/wee/core/context_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/core/decoration_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/core/idgen_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/core/page_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/core/presenter_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/core/renderer_rb.html +107 -0
- data/doc/rdoc/files/lib/wee/core/snapshot_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/core/valueholder_rb.html +2 -2
- data/doc/rdoc/files/lib/wee/core_ext_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/core_rb.html +7 -14
- data/doc/rdoc/files/lib/wee/databases/og/application_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/databases/og/old_scaffolder_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/databases/og/scaffolder_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/databases/og/session_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/databases/og_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/examples/calculator_rb.html +107 -0
- data/doc/rdoc/files/lib/wee/examples/counter_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/examples/editable_counter_rb.html +114 -0
- data/doc/rdoc/files/lib/wee/examples/window_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/idgen/md5_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/idgen/simple_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/page_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/pageless/application_rb.html +8 -1
- data/doc/rdoc/files/lib/wee/pageless/request_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/pageless/session_rb.html +2 -1
- data/doc/rdoc/files/lib/wee/pageless_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/renderer/html/brushes_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/renderer/html/canvas_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/renderer/html/writer_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/request_rb.html +5 -4
- data/doc/rdoc/files/lib/wee/requesthandler_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/response_rb.html +2 -1
- data/doc/rdoc/files/lib/wee/session_rb.html +2 -3
- data/doc/rdoc/files/lib/wee/skeleton/og/components/main_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/skeleton/og/conf/db_rb.html +2 -2
- data/doc/rdoc/files/lib/wee/skeleton/og/models/recipe_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/skeleton/og/run_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/skeleton/simple/components/main_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/skeleton/simple/run_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/snapshot_ext_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/template_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/utils/autoreload_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/utils/cache_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/utils/helper_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/utils_rb.html +1 -1
- data/doc/rdoc/files/lib/wee_rb.html +5 -3
- data/doc/rdoc/fr_class_index.html +34 -2
- data/doc/rdoc/fr_file_index.html +17 -1
- data/doc/rdoc/fr_method_index.html +464 -314
- data/examples/ajax/ajax.rb +1 -1
- data/examples/demo.rb +47 -0
- data/examples/{calendar.rb → demo/calendar.rb} +89 -97
- data/examples/{example.rb → demo/example.rb} +17 -97
- data/examples/dispatcher.rb +37 -0
- data/examples/draw.rb +14 -11
- data/examples/nitro/run.rb +42 -0
- data/examples/radio.rb +44 -0
- data/examples/test.rb +3 -27
- data/lib/wee.rb +15 -3
- data/lib/wee/adaptors/nitro.rb +154 -0
- data/lib/wee/adaptors/rails.rb +154 -0
- data/lib/wee/application.rb +22 -20
- data/lib/wee/components.rb +3 -0
- data/lib/wee/components/component_dispatcher.rb +46 -0
- data/lib/wee/components/login_decoration.rb +35 -0
- data/lib/wee/components/messagebox.rb +2 -2
- data/lib/wee/components/pager.rb +102 -0
- data/lib/wee/continuation/core/component.rb +13 -12
- data/lib/wee/continuation/session.rb +11 -19
- data/lib/wee/core.rb +8 -7
- data/lib/wee/core/component.rb +8 -28
- data/lib/wee/core/componentrunner.rb +73 -0
- data/lib/wee/core/context.rb +27 -0
- data/lib/wee/core/idgen.rb +5 -0
- data/lib/wee/core/page.rb +1 -0
- data/lib/wee/core/presenter.rb +10 -126
- data/lib/wee/core/renderer.rb +23 -0
- data/lib/wee/core_ext.rb +122 -0
- data/lib/wee/databases/og/scaffolder.rb +0 -1
- data/lib/wee/examples/calculator.rb +70 -0
- data/lib/wee/examples/counter.rb +33 -0
- data/lib/wee/examples/editable_counter.rb +31 -0
- data/{examples → lib/wee/examples}/window.rb +29 -23
- data/lib/wee/idgen/md5.rb +1 -1
- data/lib/wee/idgen/simple.rb +1 -1
- data/lib/wee/pageless/session.rb +2 -3
- data/lib/wee/renderer/html/brushes.rb +142 -22
- data/lib/wee/renderer/html/canvas.rb +57 -19
- data/lib/wee/response.rb +3 -2
- data/lib/wee/session.rb +10 -54
- data/lib/wee/skeleton/og/components/main.rb +5 -1
- data/lib/wee/skeleton/og/conf/db.rb +1 -1
- data/lib/wee/snapshot_ext.rb +4 -10
- data/lib/wee/template.rb +19 -5
- data/lib/wee/utils/helper.rb +2 -2
- metadata +90 -13
- data/examples/calculator.rb +0 -67
- 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="#
|
92
|
-
<a href="#
|
93
|
-
<a href="#
|
94
|
-
<a href="#
|
95
|
-
<a href="#
|
91
|
+
<a href="#M000418">alive?</a>
|
92
|
+
<a href="#M000419">handle_request</a>
|
93
|
+
<a href="#M000421">new</a>
|
94
|
+
<a href="#M000420">statistics</a>
|
95
|
+
<a href="#M000417">teminate</a>
|
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-
|
179
|
-
<a name="
|
178
|
+
<div id="method-M000421" class="method-detail">
|
179
|
+
<a name="M000421"></a>
|
180
180
|
|
181
181
|
<div class="method-heading">
|
182
|
-
<a href="#
|
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('
|
190
|
-
<div class="method-source-code" id="
|
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-
|
207
|
-
<a name="
|
206
|
+
<div id="method-M000418" class="method-detail">
|
207
|
+
<a name="M000418"></a>
|
208
208
|
|
209
209
|
<div class="method-heading">
|
210
|
-
<a href="#
|
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('
|
221
|
-
<div class="method-source-code" id="
|
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-
|
242
|
-
<a name="
|
241
|
+
<div id="method-M000419" class="method-detail">
|
242
|
+
<a name="M000419"></a>
|
243
243
|
|
244
244
|
<div class="method-heading">
|
245
|
-
<a href="#
|
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#
|
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('
|
257
|
-
<div class="method-source-code" id="
|
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-
|
270
|
-
<a name="
|
269
|
+
<div id="method-M000420" class="method-detail">
|
270
|
+
<a name="M000420"></a>
|
271
271
|
|
272
272
|
<div class="method-heading">
|
273
|
-
<a href="#
|
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('
|
281
|
-
<div class="method-source-code" id="
|
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-
|
300
|
-
<a name="
|
299
|
+
<div id="method-M000417" class="method-detail">
|
300
|
+
<a name="M000417"></a>
|
301
301
|
|
302
302
|
<div class="method-heading">
|
303
|
-
<a href="#
|
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('
|
318
|
-
<div class="method-source-code" id="
|
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="#
|
92
|
-
<a href="#
|
93
|
-
<a href="#
|
94
|
-
<a href="#
|
95
|
-
<a href="#
|
96
|
-
<a href="#
|
91
|
+
<a href="#M000292"><<</a>
|
92
|
+
<a href="#M000290">content_type</a>
|
93
|
+
<a href="#M000291">content_type=</a>
|
94
|
+
<a href="#M000288">cookies</a>
|
95
|
+
<a href="#M000287">cookies?</a>
|
96
|
+
<a href="#M000289">new</a>
|
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">{
|
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-
|
155
|
-
<a name="
|
154
|
+
<div id="method-M000289" class="method-detail">
|
155
|
+
<a name="M000289"></a>
|
156
156
|
|
157
157
|
<div class="method-heading">
|
158
|
-
<a href="#
|
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('
|
166
|
-
<div class="method-source-code" id="
|
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
|
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-
|
182
|
-
<a name="
|
182
|
+
<div id="method-M000292" class="method-detail">
|
183
|
+
<a name="M000292"></a>
|
183
184
|
|
184
185
|
<div class="method-heading">
|
185
|
-
<a href="#
|
186
|
+
<a href="#M000292" class="method-signature">
|
186
187
|
<span class="method-name"><<</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('
|
193
|
-
<div class="method-source-code" id="
|
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
|
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"><<</span>(<span class="ruby-identifier">str</span>)
|
197
198
|
<span class="ruby-ivar">@content</span> <span class="ruby-operator"><<</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-
|
205
|
-
<a name="
|
205
|
+
<div id="method-M000290" class="method-detail">
|
206
|
+
<a name="M000290"></a>
|
206
207
|
|
207
208
|
<div class="method-heading">
|
208
|
-
<a href="#
|
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('
|
216
|
-
<div class="method-source-code" id="
|
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
|
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-
|
228
|
-
<a name="
|
228
|
+
<div id="method-M000291" class="method-detail">
|
229
|
+
<a name="M000291"></a>
|
229
230
|
|
230
231
|
<div class="method-heading">
|
231
|
-
<a href="#
|
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('
|
239
|
-
<div class="method-source-code" id="
|
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
|
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-
|
251
|
-
<a name="
|
251
|
+
<div id="method-M000288" class="method-detail">
|
252
|
+
<a name="M000288"></a>
|
252
253
|
|
253
254
|
<div class="method-heading">
|
254
|
-
<a href="#
|
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('
|
262
|
-
<div class="method-source-code" id="
|
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
|
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-
|
274
|
-
<a name="
|
274
|
+
<div id="method-M000287" class="method-detail">
|
275
|
+
<a name="M000287"></a>
|
275
276
|
|
276
277
|
<div class="method-heading">
|
277
|
-
<a href="#
|
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('
|
285
|
-
<div class="method-source-code" id="
|
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
|
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="
|
73
|
-
Wee::
|
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="#
|
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="#
|
101
|
-
<a href="#
|
102
|
-
<a href="#
|
103
|
-
<a href="#
|
104
|
-
<a href="#
|
105
|
-
<a href="#
|
106
|
-
<a href="#
|
107
|
-
<a href="#
|
108
|
-
<a href="#
|
109
|
-
<a href="#
|
110
|
-
<a href="#
|
111
|
-
<a href="#
|
112
|
-
<a href="#
|
113
|
-
<a href="#
|
114
|
-
<a href="#
|
115
|
-
<a href="#
|
116
|
-
<a href="#M000215">start_request_response_loop</a>
|
100
|
+
<a href="#M000278">create_page</a>
|
101
|
+
<a href="#M000266">current_callbacks</a>
|
102
|
+
<a href="#M000273">handle_callback_phase</a>
|
103
|
+
<a href="#M000270">handle_existing_page</a>
|
104
|
+
<a href="#M000271">handle_invalid_page</a>
|
105
|
+
<a href="#M000269">handle_new_page</a>
|
106
|
+
<a href="#M000274">handle_new_page_view</a>
|
107
|
+
<a href="#M000272">handle_render_phase</a>
|
108
|
+
<a href="#M000265">new</a>
|
109
|
+
<a href="#M000279">new</a>
|
110
|
+
<a href="#M000277">post_callbacks_hook</a>
|
111
|
+
<a href="#M000276">pre_respond_hook</a>
|
112
|
+
<a href="#M000268">process_request</a>
|
113
|
+
<a href="#M000275">respond</a>
|
114
|
+
<a href="#M000267">setup</a>
|
115
|
+
<a href="#M000280">start_request_response_loop</a>
|
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">
|
136
|
+
<td class="context-item-name">component_runner</td>
|
138
137
|
<td class="context-item-value"> [RW] </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">
|
141
|
+
<td class="context-item-name">page_store</td>
|
143
142
|
<td class="context-item-value"> [RW] </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-
|
157
|
-
<a name="
|
155
|
+
<div id="method-M000265" class="method-detail">
|
156
|
+
<a name="M000265"></a>
|
158
157
|
|
159
158
|
<div class="method-heading">
|
160
|
-
<a href="#
|
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">"not in session"</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">(&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('
|
193
|
-
<div class="method-source-code" id="
|
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
|
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">&</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">"No root component specified"</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">"No page_store specified"</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
|
-
|
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">&</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-
|
223
|
-
<a name="
|
181
|
+
<div id="method-M000266" class="method-detail">
|
182
|
+
<a name="M000266"></a>
|
224
183
|
|
225
184
|
<div class="method-heading">
|
226
|
-
<a href="#
|
227
|
-
<span class="method-name">
|
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('
|
238
|
-
<div class="method-source-code" id="
|
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
|
241
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
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
|
-
|
249
|
-
|
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="#
|
253
|
-
<span class="method-name">
|
227
|
+
<a href="#M000279" class="method-signature">
|
228
|
+
<span class="method-name">new</span><span class="method-args">(&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('
|
260
|
-
<div class="method-source-code" id="
|
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
|
263
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
264
|
-
<span class="ruby-
|
265
|
-
<span class="ruby-
|
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">&</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">&</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
|
-
<
|
273
|
-
|
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="#
|
277
|
-
<span class="method-name">
|
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('
|
284
|
-
<div class="method-source-code" id="
|
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
|
287
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
288
|
-
<span class="ruby-
|
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">"invalid request"</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">></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">"session loop terminated"</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
|
-
<
|
296
|
-
|
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="#
|
300
|
-
<span class="method-name">
|
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('
|
307
|
-
<div class="method-source-code" id="
|
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
|
310
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
311
|
-
<span class="ruby-
|
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-
|
319
|
-
<a name="
|
337
|
+
<div id="method-M000273" class="method-detail">
|
338
|
+
<a name="M000273"></a>
|
320
339
|
|
321
340
|
<div class="method-heading">
|
322
|
-
<a href="#
|
323
|
-
<span class="method-name">
|
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('
|
333
|
-
<div class="method-source-code" id="
|
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
|
336
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
337
|
-
<span class="ruby-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
<span class="ruby-
|
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-
|
360
|
-
<a name="
|
380
|
+
<div id="method-M000270" class="method-detail">
|
381
|
+
<a name="M000270"></a>
|
361
382
|
|
362
383
|
<div class="method-heading">
|
363
|
-
<a href="#
|
364
|
-
<span class="method-name">
|
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('
|
371
|
-
<div class="method-source-code" id="
|
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
|
374
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
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
|
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 -> 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">></span> <span class="ruby-value">1</span>
|
413
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"Not allowed to specify more than one action callback"</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
|
-
|
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 "invalid page or page timed out" 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">"Not yet implemented"</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-
|
454
|
-
<a name="
|
411
|
+
<div id="method-M000271" class="method-detail">
|
412
|
+
<a name="M000271"></a>
|
455
413
|
|
456
414
|
<div class="method-heading">
|
457
|
-
<a href="#
|
458
|
-
<span class="method-name">
|
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('
|
469
|
-
<div class="method-source-code" id="
|
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
|
472
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
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 "invalid page or page timed out" 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">"Not yet implemented"</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-
|
480
|
-
<a name="
|
436
|
+
<div id="method-M000269" class="method-detail">
|
437
|
+
<a name="M000269"></a>
|
481
438
|
|
482
439
|
<div class="method-heading">
|
483
|
-
<a href="#
|
484
|
-
<span class="method-name">
|
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('
|
491
|
-
<div class="method-source-code" id="
|
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
|
494
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
495
|
-
<span class="ruby-
|
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
|
-
|
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"> [RW] </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="#
|
540
|
-
<span class="method-name">
|
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('
|
547
|
-
<div class="method-source-code" id="
|
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/
|
550
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
551
|
-
<span class="ruby-
|
552
|
-
|
553
|
-
<span class="ruby-ivar">@
|
554
|
-
<span class="ruby-ivar">@
|
555
|
-
|
556
|
-
<span class="ruby-identifier">
|
557
|
-
|
558
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"No root component specified"</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">"No page_store specified"</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">></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
|
-
<
|
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="#
|
580
|
-
<span class="method-name">
|
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 "owned" property for the given <tt>klass</tt>.
|
587
|
-
</p>
|
588
497
|
<p><a class="source-toggle" href="#"
|
589
|
-
onclick="toggleCode('
|
590
|
-
<div class="method-source-code" id="
|
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
|
593
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
594
|
-
<span class="ruby-
|
595
|
-
|
596
|
-
<span class="ruby-
|
597
|
-
|
598
|
-
<span class="ruby-
|
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 -> 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-
|
606
|
-
<a name="
|
519
|
+
<div id="method-M000277" class="method-detail">
|
520
|
+
<a name="M000277"></a>
|
607
521
|
|
608
522
|
<div class="method-heading">
|
609
|
-
<a href="#
|
610
|
-
<span class="method-name">
|
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('
|
620
|
-
<div class="method-source-code" id="
|
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/
|
623
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
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-
|
639
|
-
<a name="
|
541
|
+
<div id="method-M000276" class="method-detail">
|
542
|
+
<a name="M000276"></a>
|
640
543
|
|
641
544
|
<div class="method-heading">
|
642
|
-
<a href="#
|
643
|
-
<span class="method-name">
|
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('
|
650
|
-
<div class="method-source-code" id="
|
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/
|
653
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
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">"invalid request"</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">></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">"session loop terminated"</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
|
-
<
|
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="#
|
701
|
-
<span class="method-name">
|
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('
|
708
|
-
<div class="method-source-code" id="
|
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
|
711
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
712
|
-
<span class="ruby-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
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-
|
725
|
-
<a name="
|
610
|
+
<div id="method-M000275" class="method-detail">
|
611
|
+
<a name="M000275"></a>
|
726
612
|
|
727
613
|
<div class="method-heading">
|
728
|
-
<a href="#
|
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('
|
736
|
-
<div class="method-source-code" id="
|
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
|
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-
|
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-
|
751
|
-
<a name="
|
636
|
+
<div id="method-M000267" class="method-detail">
|
637
|
+
<a name="M000267"></a>
|
752
638
|
|
753
639
|
<div class="method-heading">
|
754
|
-
<a href="#
|
755
|
-
<span class="method-name">
|
640
|
+
<a href="#M000267" class="method-signature">
|
641
|
+
<span class="method-name">setup</span><span class="method-args">(&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('
|
762
|
-
<div class="method-source-code" id="
|
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
|
765
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
766
|
-
<span class="ruby-
|
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">&</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">"No component runner specified"</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">"No page_store specified"</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>
|