wee 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +0 -1
- data/Rakefile +5 -0
- data/TODO +6 -0
- data/doc/rdoc/classes/Enumerable.html +6 -6
- data/doc/rdoc/classes/Wee/AnswerDecoration.html +10 -10
- data/doc/rdoc/classes/Wee/Application.html +110 -52
- data/doc/rdoc/classes/Wee/Brush/ActionCallbackMixin.html +8 -15
- data/doc/rdoc/classes/Wee/Brush/ActionURLCallbackMixin.html +8 -19
- data/doc/rdoc/classes/Wee/Brush/AnchorTag.html +22 -22
- data/doc/rdoc/classes/Wee/Brush/FileUploadTag.html +156 -0
- data/doc/rdoc/classes/Wee/Brush/FormTag.html +50 -25
- data/doc/rdoc/classes/Wee/Brush/GenericEncodedTextBrush.html +12 -12
- data/doc/rdoc/classes/Wee/Brush/GenericTagBrush.html +36 -36
- data/doc/rdoc/classes/Wee/Brush/GenericTextBrush.html +12 -12
- data/doc/rdoc/classes/Wee/Brush/ImageButtonTag.html +16 -16
- data/doc/rdoc/classes/Wee/Brush/InputCallbackMixin.html +8 -15
- data/doc/rdoc/classes/Wee/Brush/InputTag.html +12 -12
- data/doc/rdoc/classes/Wee/Brush/Page.html +14 -14
- data/doc/rdoc/classes/Wee/Brush/SelectListTag.html +28 -28
- data/doc/rdoc/classes/Wee/Brush/SelectOptionTag.html +14 -14
- 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 +36 -36
- data/doc/rdoc/classes/Wee/Brush/TableTag.html +6 -6
- data/doc/rdoc/classes/Wee/Brush/TextAreaTag.html +28 -28
- data/doc/rdoc/classes/Wee/Brush/TextInputTag.html +7 -7
- data/doc/rdoc/classes/Wee/Brush.html +19 -19
- data/doc/rdoc/classes/Wee/CallbackRegistry.html +33 -33
- data/doc/rdoc/classes/Wee/CallbackStream.html +18 -18
- data/doc/rdoc/classes/Wee/Canvas.html +24 -24
- data/doc/rdoc/classes/Wee/Component.html +163 -138
- data/doc/rdoc/classes/Wee/Decoration.html +72 -41
- data/doc/rdoc/classes/Wee/Delegate.html +31 -31
- data/doc/rdoc/classes/Wee/ErrorResponse.html +12 -12
- data/doc/rdoc/classes/Wee/GenericResponse.html +6 -6
- data/doc/rdoc/classes/Wee/Helper.html +148 -0
- data/doc/rdoc/classes/Wee/HtmlCanvas.html +267 -166
- data/doc/rdoc/classes/Wee/HtmlWriter.html +40 -40
- data/doc/rdoc/classes/Wee/LiteralMethodCallback.html +12 -12
- data/doc/rdoc/classes/Wee/PageDecoration.html +199 -0
- data/doc/rdoc/classes/Wee/Presenter.html +69 -69
- data/doc/rdoc/classes/Wee/RedirectResponse.html +6 -6
- data/doc/rdoc/classes/Wee/RefreshResponse.html +6 -6
- data/doc/rdoc/classes/Wee/Request.html +18 -18
- data/doc/rdoc/classes/Wee/RequestHandler.html +32 -31
- data/doc/rdoc/classes/Wee/Response.html +24 -24
- data/doc/rdoc/classes/Wee/Session.html +83 -64
- data/doc/rdoc/classes/Wee/SimpleIdGenerator.html +18 -18
- data/doc/rdoc/classes/Wee/Snapshot.html +19 -19
- data/doc/rdoc/classes/Wee/Utils/LRUCache.html +6 -6
- data/doc/rdoc/classes/Wee/ValueHolder.html +18 -18
- data/doc/rdoc/classes/Wee/WEBrickAdaptor.html +66 -62
- data/doc/rdoc/classes/Wee.html +63 -2
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README.html +6 -9
- 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/page_decoration_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/components_rb.html +108 -0
- 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/decoration_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/core_rb.html +3 -3
- 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/requesthandler_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/session_rb.html +2 -1
- data/doc/rdoc/files/lib/wee/utils/autoreload_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/utils/helper_rb.html +108 -0
- data/doc/rdoc/files/lib/wee_rb.html +2 -1
- data/doc/rdoc/fr_class_index.html +3 -1
- data/doc/rdoc/fr_file_index.html +4 -0
- data/doc/rdoc/fr_method_index.html +203 -191
- data/examples/example.rb +2 -16
- data/examples/test.rb +15 -18
- data/lib/wee/adaptors/webrick.rb +3 -1
- data/lib/wee/application.rb +55 -19
- data/lib/wee/components/page_decoration.rb +14 -0
- data/lib/wee/components.rb +1 -0
- data/lib/wee/core/callback.rb +1 -1
- data/lib/wee/core/component.rb +27 -3
- data/lib/wee/core/decoration.rb +9 -0
- data/lib/wee/renderer/html/brushes.rb +21 -23
- data/lib/wee/renderer/html/canvas.rb +25 -4
- data/lib/wee/requesthandler.rb +1 -0
- data/lib/wee/session.rb +21 -1
- data/lib/wee/utils/autoreload.rb +27 -0
- data/lib/wee/utils/helper.rb +15 -0
- data/lib/wee.rb +2 -1
- metadata +203 -191
- data/test/components/page_decoration.rb +0 -7
data/README
CHANGED
data/Rakefile
CHANGED
data/TODO
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
* req-handler gc interval
|
2
|
+
|
3
|
+
* use LiteralMethod object instead of block if callback(:method_name) is given
|
4
|
+
|
5
|
+
* log requests
|
6
|
+
|
1
7
|
* call method #backtrack from backtrack_state. you don't need to call super for #backtrack (at least for direct subclasses of Component).
|
2
8
|
* call method #setup from initialize. same reason as for #backtrack.
|
3
9
|
|
@@ -86,7 +86,7 @@ for Ruby 1.8
|
|
86
86
|
<h3 class="section-bar">Methods</h3>
|
87
87
|
|
88
88
|
<div class="name-list">
|
89
|
-
<a href="#
|
89
|
+
<a href="#M000228">min_by</a>
|
90
90
|
</div>
|
91
91
|
</div>
|
92
92
|
|
@@ -108,19 +108,19 @@ for Ruby 1.8
|
|
108
108
|
<div id="methods">
|
109
109
|
<h3 class="section-bar">Public Instance methods</h3>
|
110
110
|
|
111
|
-
<div id="method-
|
112
|
-
<a name="
|
111
|
+
<div id="method-M000228" class="method-detail">
|
112
|
+
<a name="M000228"></a>
|
113
113
|
|
114
114
|
<div class="method-heading">
|
115
|
-
<a href="#
|
115
|
+
<a href="#M000228" class="method-signature">
|
116
116
|
<span class="method-name">min_by</span><span class="method-args">(&block)</span>
|
117
117
|
</a>
|
118
118
|
</div>
|
119
119
|
|
120
120
|
<div class="method-description">
|
121
121
|
<p><a class="source-toggle" href="#"
|
122
|
-
onclick="toggleCode('
|
123
|
-
<div class="method-source-code" id="
|
122
|
+
onclick="toggleCode('M000228-source');return false;">[Source]</a></p>
|
123
|
+
<div class="method-source-code" id="M000228-source">
|
124
124
|
<pre>
|
125
125
|
<span class="ruby-comment cmt"># File lib/cache/cache.rb, line 4</span>
|
126
126
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">min_by</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
@@ -84,9 +84,9 @@
|
|
84
84
|
<p>
|
85
85
|
A <a href="AnswerDecoration.html">Wee::AnswerDecoration</a> is wrapped
|
86
86
|
around a component that will call <a
|
87
|
-
href="Component.html#
|
87
|
+
href="Component.html#M000188">Component#answer</a>. This makes it possible
|
88
88
|
to use such components without the need to call them (<a
|
89
|
-
href="Component.html#
|
89
|
+
href="Component.html#M000187">Component#call</a>), e.g. as child components
|
90
90
|
of other components.
|
91
91
|
</p>
|
92
92
|
|
@@ -99,7 +99,7 @@ of other components.
|
|
99
99
|
<h3 class="section-bar">Methods</h3>
|
100
100
|
|
101
101
|
<div class="name-list">
|
102
|
-
<a href="#
|
102
|
+
<a href="#M000044">process_callbacks</a>
|
103
103
|
</div>
|
104
104
|
</div>
|
105
105
|
|
@@ -125,7 +125,7 @@ of other components.
|
|
125
125
|
<td class="context-item-desc">
|
126
126
|
When a component answers, <tt>on_answer.call(args)</tt> will be executed
|
127
127
|
(unless nil), where <tt>args</tt> are the arguments passed to <a
|
128
|
-
href="Component.html#
|
128
|
+
href="Component.html#M000188">Component#answer</a>. Note that no snapshot
|
129
129
|
of on_answer is taken, so you should avoid modifying it!
|
130
130
|
|
131
131
|
</td>
|
@@ -140,21 +140,21 @@ of on_answer is taken, so you should avoid modifying it!
|
|
140
140
|
<div id="methods">
|
141
141
|
<h3 class="section-bar">Public Instance methods</h3>
|
142
142
|
|
143
|
-
<div id="method-
|
144
|
-
<a name="
|
143
|
+
<div id="method-M000044" class="method-detail">
|
144
|
+
<a name="M000044"></a>
|
145
145
|
|
146
146
|
<div class="method-heading">
|
147
|
-
<a href="#
|
147
|
+
<a href="#M000044" class="method-signature">
|
148
148
|
<span class="method-name">process_callbacks</span><span class="method-args">(callback_stream)</span>
|
149
149
|
</a>
|
150
150
|
</div>
|
151
151
|
|
152
152
|
<div class="method-description">
|
153
153
|
<p><a class="source-toggle" href="#"
|
154
|
-
onclick="toggleCode('
|
155
|
-
<div class="method-source-code" id="
|
154
|
+
onclick="toggleCode('M000044-source');return false;">[Source]</a></p>
|
155
|
+
<div class="method-source-code" id="M000044-source">
|
156
156
|
<pre>
|
157
|
-
<span class="ruby-comment cmt"># File lib/wee/core/decoration.rb, line
|
157
|
+
<span class="ruby-comment cmt"># File lib/wee/core/decoration.rb, line 131</span>
|
158
158
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_callbacks</span>(<span class="ruby-identifier">callback_stream</span>)
|
159
159
|
<span class="ruby-identifier">args</span> = <span class="ruby-identifier">catch</span>(<span class="ruby-identifier">:wee_answer</span>) { <span class="ruby-keyword kw">super</span>; <span class="ruby-keyword kw">nil</span> }
|
160
160
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
|
@@ -98,11 +98,12 @@ the correct handler by examining the request.
|
|
98
98
|
<h3 class="section-bar">Methods</h3>
|
99
99
|
|
100
100
|
<div class="name-list">
|
101
|
-
<a href="#
|
102
|
-
<a href="#
|
103
|
-
<a href="#
|
104
|
-
<a href="#
|
105
|
-
<a href="#
|
101
|
+
<a href="#M000146">default_request_handler</a>
|
102
|
+
<a href="#M000150">garbage_collect_handlers</a>
|
103
|
+
<a href="#M000148">handle_request</a>
|
104
|
+
<a href="#M000147">new</a>
|
105
|
+
<a href="#M000151">request_handler_expired</a>
|
106
|
+
<a href="#M000149">unique_request_handler_id</a>
|
106
107
|
</div>
|
107
108
|
</div>
|
108
109
|
|
@@ -148,11 +149,11 @@ The maximum number of request handlers
|
|
148
149
|
<div id="methods">
|
149
150
|
<h3 class="section-bar">Public Class methods</h3>
|
150
151
|
|
151
|
-
<div id="method-
|
152
|
-
<a name="
|
152
|
+
<div id="method-M000147" class="method-detail">
|
153
|
+
<a name="M000147"></a>
|
153
154
|
|
154
155
|
<div class="method-heading">
|
155
|
-
<a href="#
|
156
|
+
<a href="#M000147" class="method-signature">
|
156
157
|
<span class="method-name">new</span><span class="method-args">(&block)</span>
|
157
158
|
</a>
|
158
159
|
</div>
|
@@ -169,8 +170,8 @@ Creates a new application. The block is used to initialize the attributes:
|
|
169
170
|
}
|
170
171
|
</pre>
|
171
172
|
<p><a class="source-toggle" href="#"
|
172
|
-
onclick="toggleCode('
|
173
|
-
<div class="method-source-code" id="
|
173
|
+
onclick="toggleCode('M000147-source');return false;">[Source]</a></p>
|
174
|
+
<div class="method-source-code" id="M000147-source">
|
174
175
|
<pre>
|
175
176
|
<span class="ruby-comment cmt"># File lib/wee/application.rb, line 34</span>
|
176
177
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
@@ -181,6 +182,13 @@ Creates a new application. The block is used to initialize the attributes:
|
|
181
182
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"No default request handler specified"</span>
|
182
183
|
<span class="ruby-keyword kw">end</span>
|
183
184
|
<span class="ruby-ivar">@mutex</span> = <span class="ruby-constant">Mutex</span>.<span class="ruby-identifier">new</span>
|
185
|
+
|
186
|
+
<span class="ruby-comment cmt"># start request-handler collecting thread</span>
|
187
|
+
<span class="ruby-comment cmt"># run once every minute</span>
|
188
|
+
<span class="ruby-ivar">@gc_thread</span> = <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> {
|
189
|
+
<span class="ruby-identifier">sleep</span> <span class="ruby-value">60</span>
|
190
|
+
<span class="ruby-ivar">@mutex</span>.<span class="ruby-identifier">synchronize</span> { <span class="ruby-identifier">garbage_collect_handlers</span> }
|
191
|
+
}
|
184
192
|
<span class="ruby-keyword kw">end</span>
|
185
193
|
</pre>
|
186
194
|
</div>
|
@@ -189,11 +197,11 @@ Creates a new application. The block is used to initialize the attributes:
|
|
189
197
|
|
190
198
|
<h3 class="section-bar">Public Instance methods</h3>
|
191
199
|
|
192
|
-
<div id="method-
|
193
|
-
<a name="
|
200
|
+
<div id="method-M000146" class="method-detail">
|
201
|
+
<a name="M000146"></a>
|
194
202
|
|
195
203
|
<div class="method-heading">
|
196
|
-
<a href="#
|
204
|
+
<a href="#M000146" class="method-signature">
|
197
205
|
<span class="method-name">default_request_handler</span><span class="method-args">(&block)</span>
|
198
206
|
</a>
|
199
207
|
</div>
|
@@ -204,8 +212,8 @@ Get or set the default request handler. The default request handler is used
|
|
204
212
|
if no request handler id is given in a request.
|
205
213
|
</p>
|
206
214
|
<p><a class="source-toggle" href="#"
|
207
|
-
onclick="toggleCode('
|
208
|
-
<div class="method-source-code" id="
|
215
|
+
onclick="toggleCode('M000146-source');return false;">[Source]</a></p>
|
216
|
+
<div class="method-source-code" id="M000146-source">
|
209
217
|
<pre>
|
210
218
|
<span class="ruby-comment cmt"># File lib/wee/application.rb, line 18</span>
|
211
219
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">default_request_handler</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
@@ -220,50 +228,71 @@ if no request handler id is given in a request.
|
|
220
228
|
</div>
|
221
229
|
</div>
|
222
230
|
|
223
|
-
<div id="method-
|
224
|
-
<a name="
|
231
|
+
<div id="method-M000148" class="method-detail">
|
232
|
+
<a name="M000148"></a>
|
225
233
|
|
226
234
|
<div class="method-heading">
|
227
|
-
<a href="#
|
235
|
+
<a href="#M000148" class="method-signature">
|
228
236
|
<span class="method-name">handle_request</span><span class="method-args">(context)</span>
|
229
237
|
</a>
|
230
238
|
</div>
|
231
239
|
|
232
240
|
<div class="method-description">
|
233
|
-
<p>
|
234
|
-
TODO: we have to use mutexes here NOTE that id_generator must be
|
235
|
-
thread-safe! TODO: test for max_request_handlers
|
236
|
-
</p>
|
237
241
|
<p><a class="source-toggle" href="#"
|
238
|
-
onclick="toggleCode('
|
239
|
-
<div class="method-source-code" id="
|
242
|
+
onclick="toggleCode('M000148-source');return false;">[Source]</a></p>
|
243
|
+
<div class="method-source-code" id="M000148-source">
|
240
244
|
<pre>
|
241
|
-
<span class="ruby-comment cmt"># File lib/wee/application.rb, line
|
245
|
+
<span class="ruby-comment cmt"># File lib/wee/application.rb, line 51</span>
|
242
246
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_request</span>(<span class="ruby-identifier">context</span>)
|
243
|
-
<span class="ruby-
|
244
|
-
|
245
|
-
|
247
|
+
<span class="ruby-identifier">request_handler_id</span> = <span class="ruby-identifier">context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">request_handler_id</span>
|
248
|
+
<span class="ruby-identifier">request_handler</span> = <span class="ruby-ivar">@mutex</span>.<span class="ruby-identifier">synchronize</span> { <span class="ruby-ivar">@request_handlers</span>[<span class="ruby-identifier">request_handler_id</span>] }
|
249
|
+
|
250
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">request_handler_id</span>.<span class="ruby-identifier">nil?</span>
|
246
251
|
|
247
|
-
<span class="ruby-
|
248
|
-
|
249
|
-
|
252
|
+
<span class="ruby-comment cmt"># No id was given -> check whether the maximum number of request-handlers</span>
|
253
|
+
<span class="ruby-comment cmt"># limit is reached. if not, create new id and handler</span>
|
254
|
+
|
255
|
+
<span class="ruby-ivar">@mutex</span>.<span class="ruby-identifier">synchronize</span> {
|
256
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@max_request_handlers</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@request_handlers</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">>=</span> <span class="ruby-ivar">@max_request_handlers</span>
|
257
|
+
<span class="ruby-comment cmt"># limit reached -> remove non-alive handlers...</span>
|
258
|
+
<span class="ruby-identifier">garbage_collect_handlers</span>()
|
259
|
+
|
260
|
+
<span class="ruby-comment cmt"># ...and test again</span>
|
261
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@request_handlers</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">>=</span> <span class="ruby-ivar">@max_request_handlers</span>
|
262
|
+
<span class="ruby-comment cmt"># TODO: show a custom error message</span>
|
263
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"maximum number of request-handlers reached"</span>
|
264
|
+
<span class="ruby-keyword kw">end</span>
|
265
|
+
<span class="ruby-keyword kw">end</span>
|
266
|
+
|
267
|
+
<span class="ruby-identifier">request_handler_id</span> = <span class="ruby-identifier">unique_request_handler_id</span>()
|
250
268
|
<span class="ruby-identifier">request_handler</span> = <span class="ruby-ivar">@default_request_handler</span>.<span class="ruby-identifier">call</span>
|
251
269
|
<span class="ruby-identifier">request_handler</span>.<span class="ruby-identifier">id</span> = <span class="ruby-identifier">request_handler_id</span>
|
252
270
|
<span class="ruby-identifier">request_handler</span>.<span class="ruby-identifier">application</span> = <span class="ruby-keyword kw">self</span>
|
253
271
|
<span class="ruby-ivar">@request_handlers</span>[<span class="ruby-identifier">request_handler_id</span>] = <span class="ruby-identifier">request_handler</span>
|
272
|
+
}
|
273
|
+
|
274
|
+
<span class="ruby-identifier">context</span>.<span class="ruby-identifier">response</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">context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">build_url</span>(<span class="ruby-identifier">request_handler_id</span>))
|
275
|
+
<span class="ruby-keyword kw">return</span>
|
254
276
|
|
255
|
-
|
256
|
-
<span class="ruby-keyword kw">return</span>
|
277
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">request_handler</span>.<span class="ruby-identifier">nil?</span>
|
257
278
|
|
258
|
-
<span class="ruby-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
279
|
+
<span class="ruby-comment cmt"># A false request handler id was given. This might indicate that a</span>
|
280
|
+
<span class="ruby-comment cmt"># request handler has expired. </span>
|
281
|
+
|
282
|
+
<span class="ruby-identifier">request_handler_expired</span>(<span class="ruby-identifier">context</span>)
|
283
|
+
<span class="ruby-keyword kw">return</span>
|
284
|
+
|
285
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-operator">!</span><span class="ruby-identifier">request_handler</span>.<span class="ruby-identifier">alive?</span>
|
286
|
+
|
287
|
+
<span class="ruby-comment cmt"># The request_handler is not alive anymore.</span>
|
288
|
+
|
289
|
+
<span class="ruby-identifier">request_handler_expired</span>(<span class="ruby-identifier">context</span>)
|
290
|
+
<span class="ruby-keyword kw">return</span>
|
264
291
|
|
265
|
-
<span class="ruby-identifier">request_handler</span>.<span class="ruby-identifier">handle_request</span>(<span class="ruby-identifier">context</span>)
|
266
292
|
<span class="ruby-keyword kw">end</span>
|
293
|
+
|
294
|
+
<span class="ruby-identifier">request_handler</span>.<span class="ruby-identifier">handle_request</span>(<span class="ruby-identifier">context</span>)
|
295
|
+
|
267
296
|
<span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">exn</span>
|
268
297
|
<span class="ruby-identifier">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>)
|
269
298
|
<span class="ruby-keyword kw">end</span>
|
@@ -274,21 +303,47 @@ thread-safe! TODO: test for max_request_handlers
|
|
274
303
|
|
275
304
|
<h3 class="section-bar">Private Instance methods</h3>
|
276
305
|
|
277
|
-
<div id="method-
|
278
|
-
<a name="
|
306
|
+
<div id="method-M000150" class="method-detail">
|
307
|
+
<a name="M000150"></a>
|
279
308
|
|
280
309
|
<div class="method-heading">
|
281
|
-
<a href="#
|
310
|
+
<a href="#M000150" class="method-signature">
|
311
|
+
<span class="method-name">garbage_collect_handlers</span><span class="method-args">()</span>
|
312
|
+
</a>
|
313
|
+
</div>
|
314
|
+
|
315
|
+
<div class="method-description">
|
316
|
+
<p>
|
317
|
+
MUST be called while holding @mutex
|
318
|
+
</p>
|
319
|
+
<p><a class="source-toggle" href="#"
|
320
|
+
onclick="toggleCode('M000150-source');return false;">[Source]</a></p>
|
321
|
+
<div class="method-source-code" id="M000150-source">
|
322
|
+
<pre>
|
323
|
+
<span class="ruby-comment cmt"># File lib/wee/application.rb, line 117</span>
|
324
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">garbage_collect_handlers</span>
|
325
|
+
<span class="ruby-ivar">@request_handlers</span>.<span class="ruby-identifier">delete_if</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">id</span>,<span class="ruby-identifier">rh</span><span class="ruby-operator">|</span> <span class="ruby-operator">!</span><span class="ruby-identifier">rh</span>.<span class="ruby-identifier">alive?</span> }
|
326
|
+
<span class="ruby-keyword kw">end</span>
|
327
|
+
</pre>
|
328
|
+
</div>
|
329
|
+
</div>
|
330
|
+
</div>
|
331
|
+
|
332
|
+
<div id="method-M000151" class="method-detail">
|
333
|
+
<a name="M000151"></a>
|
334
|
+
|
335
|
+
<div class="method-heading">
|
336
|
+
<a href="#M000151" class="method-signature">
|
282
337
|
<span class="method-name">request_handler_expired</span><span class="method-args">(context)</span>
|
283
338
|
</a>
|
284
339
|
</div>
|
285
340
|
|
286
341
|
<div class="method-description">
|
287
342
|
<p><a class="source-toggle" href="#"
|
288
|
-
onclick="toggleCode('
|
289
|
-
<div class="method-source-code" id="
|
343
|
+
onclick="toggleCode('M000151-source');return false;">[Source]</a></p>
|
344
|
+
<div class="method-source-code" id="M000151-source">
|
290
345
|
<pre>
|
291
|
-
<span class="ruby-comment cmt"># File lib/wee/application.rb, line
|
346
|
+
<span class="ruby-comment cmt"># File lib/wee/application.rb, line 121</span>
|
292
347
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">request_handler_expired</span>(<span class="ruby-identifier">context</span>)
|
293
348
|
<span class="ruby-identifier">context</span>.<span class="ruby-identifier">response</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">RefreshResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"Invalid or expired request handler!"</span>, <span class="ruby-identifier">context</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">application_path</span>)
|
294
349
|
<span class="ruby-keyword kw">end</span>
|
@@ -297,21 +352,24 @@ thread-safe! TODO: test for max_request_handlers
|
|
297
352
|
</div>
|
298
353
|
</div>
|
299
354
|
|
300
|
-
<div id="method-
|
301
|
-
<a name="
|
355
|
+
<div id="method-M000149" class="method-detail">
|
356
|
+
<a name="M000149"></a>
|
302
357
|
|
303
358
|
<div class="method-heading">
|
304
|
-
<a href="#
|
359
|
+
<a href="#M000149" class="method-signature">
|
305
360
|
<span class="method-name">unique_request_handler_id</span><span class="method-args">()</span>
|
306
361
|
</a>
|
307
362
|
</div>
|
308
363
|
|
309
364
|
<div class="method-description">
|
365
|
+
<p>
|
366
|
+
MUST be called while holding @mutex
|
367
|
+
</p>
|
310
368
|
<p><a class="source-toggle" href="#"
|
311
|
-
onclick="toggleCode('
|
312
|
-
<div class="method-source-code" id="
|
369
|
+
onclick="toggleCode('M000149-source');return false;">[Source]</a></p>
|
370
|
+
<div class="method-source-code" id="M000149-source">
|
313
371
|
<pre>
|
314
|
-
<span class="ruby-comment cmt"># File lib/wee/application.rb, line
|
372
|
+
<span class="ruby-comment cmt"># File lib/wee/application.rb, line 109</span>
|
315
373
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unique_request_handler_id</span>
|
316
374
|
<span class="ruby-identifier">id</span> = <span class="ruby-ivar">@id_generator</span>.<span class="ruby-identifier">next</span>.<span class="ruby-identifier">to_s</span>
|
317
375
|
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"failed to create unique request handler id"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@request_handlers</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">id</span>)
|
@@ -80,7 +80,7 @@
|
|
80
80
|
<h3 class="section-bar">Methods</h3>
|
81
81
|
|
82
82
|
<div class="name-list">
|
83
|
-
<a href="#
|
83
|
+
<a href="#M000081">callback</a>
|
84
84
|
</div>
|
85
85
|
</div>
|
86
86
|
|
@@ -88,13 +88,6 @@
|
|
88
88
|
|
89
89
|
|
90
90
|
<!-- if includes -->
|
91
|
-
<div id="includes">
|
92
|
-
<h3 class="section-bar">Included Modules</h3>
|
93
|
-
|
94
|
-
<div id="includes-list">
|
95
|
-
<span class="include-name"><a href="CallbackMixin.html">Brush::CallbackMixin</a></span>
|
96
|
-
</div>
|
97
|
-
</div>
|
98
91
|
|
99
92
|
<div id="section">
|
100
93
|
|
@@ -109,25 +102,25 @@
|
|
109
102
|
<div id="methods">
|
110
103
|
<h3 class="section-bar">Public Instance methods</h3>
|
111
104
|
|
112
|
-
<div id="method-
|
113
|
-
<a name="
|
105
|
+
<div id="method-M000081" class="method-detail">
|
106
|
+
<a name="M000081"></a>
|
114
107
|
|
115
108
|
<div class="method-heading">
|
116
|
-
<a href="#
|
109
|
+
<a href="#M000081" class="method-signature">
|
117
110
|
<span class="method-name">callback</span><span class="method-args">(symbol=nil, &block)</span>
|
118
111
|
</a>
|
119
112
|
</div>
|
120
113
|
|
121
114
|
<div class="method-description">
|
122
115
|
<p><a class="source-toggle" href="#"
|
123
|
-
onclick="toggleCode('
|
124
|
-
<div class="method-source-code" id="
|
116
|
+
onclick="toggleCode('M000081-source');return false;">[Source]</a></p>
|
117
|
+
<div class="method-source-code" id="M000081-source">
|
125
118
|
<pre>
|
126
|
-
<span class="ruby-comment cmt"># File lib/wee/renderer/html/brushes.rb, line
|
119
|
+
<span class="ruby-comment cmt"># File lib/wee/renderer/html/brushes.rb, line 165</span>
|
127
120
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">callback</span>(<span class="ruby-identifier">symbol</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
128
121
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">symbol</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">block</span>
|
129
122
|
<span class="ruby-identifier">block</span> = <span class="ruby-ivar">@canvas</span>.<span class="ruby-identifier">current_component</span>.<span class="ruby-identifier">method</span>(<span class="ruby-identifier">symbol</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block</span>
|
130
|
-
<span class="ruby-identifier">name</span>(<span class="ruby-identifier">register_callback</span>(<span class="ruby-identifier">:action</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>))
|
123
|
+
<span class="ruby-identifier">name</span>(<span class="ruby-ivar">@canvas</span>.<span class="ruby-identifier">register_callback</span>(<span class="ruby-identifier">:action</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>))
|
131
124
|
<span class="ruby-keyword kw">end</span>
|
132
125
|
</pre>
|
133
126
|
</div>
|
@@ -86,7 +86,7 @@ The callback id is listed in the URL (not as a form-data field)
|
|
86
86
|
<h3 class="section-bar">Methods</h3>
|
87
87
|
|
88
88
|
<div class="name-list">
|
89
|
-
<a href="#
|
89
|
+
<a href="#M000080">callback</a>
|
90
90
|
</div>
|
91
91
|
</div>
|
92
92
|
|
@@ -94,13 +94,6 @@ The callback id is listed in the URL (not as a form-data field)
|
|
94
94
|
|
95
95
|
|
96
96
|
<!-- if includes -->
|
97
|
-
<div id="includes">
|
98
|
-
<h3 class="section-bar">Included Modules</h3>
|
99
|
-
|
100
|
-
<div id="includes-list">
|
101
|
-
<span class="include-name"><a href="CallbackMixin.html">Brush::CallbackMixin</a></span>
|
102
|
-
</div>
|
103
|
-
</div>
|
104
97
|
|
105
98
|
<div id="section">
|
106
99
|
|
@@ -115,27 +108,23 @@ The callback id is listed in the URL (not as a form-data field)
|
|
115
108
|
<div id="methods">
|
116
109
|
<h3 class="section-bar">Public Instance methods</h3>
|
117
110
|
|
118
|
-
<div id="method-
|
119
|
-
<a name="
|
111
|
+
<div id="method-M000080" class="method-detail">
|
112
|
+
<a name="M000080"></a>
|
120
113
|
|
121
114
|
<div class="method-heading">
|
122
|
-
<a href="#
|
115
|
+
<a href="#M000080" class="method-signature">
|
123
116
|
<span class="method-name">callback</span><span class="method-args">(symbol=nil, &block)</span>
|
124
117
|
</a>
|
125
118
|
</div>
|
126
119
|
|
127
120
|
<div class="method-description">
|
128
121
|
<p><a class="source-toggle" href="#"
|
129
|
-
onclick="toggleCode('
|
130
|
-
<div class="method-source-code" id="
|
122
|
+
onclick="toggleCode('M000080-source');return false;">[Source]</a></p>
|
123
|
+
<div class="method-source-code" id="M000080-source">
|
131
124
|
<pre>
|
132
|
-
<span class="ruby-comment cmt"># File lib/wee/renderer/html/brushes.rb, line
|
125
|
+
<span class="ruby-comment cmt"># File lib/wee/renderer/html/brushes.rb, line 176</span>
|
133
126
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">callback</span>(<span class="ruby-identifier">symbol</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
134
|
-
<span class="ruby-identifier">
|
135
|
-
<span class="ruby-identifier">block</span> = <span class="ruby-ivar">@canvas</span>.<span class="ruby-identifier">current_component</span>.<span class="ruby-identifier">method</span>(<span class="ruby-identifier">symbol</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block</span>
|
136
|
-
<span class="ruby-identifier">req</span> = <span class="ruby-ivar">@canvas</span>.<span class="ruby-identifier">rendering_context</span>.<span class="ruby-identifier">request</span>
|
137
|
-
<span class="ruby-identifier">url</span> = <span class="ruby-identifier">req</span>.<span class="ruby-identifier">build_url</span>(<span class="ruby-identifier">req</span>.<span class="ruby-identifier">request_handler_id</span>, <span class="ruby-identifier">req</span>.<span class="ruby-identifier">page_id</span>, <span class="ruby-identifier">register_callback</span>(<span class="ruby-identifier">:action</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>))
|
138
|
-
<span class="ruby-identifier">__set_url</span>(<span class="ruby-identifier">url</span>)
|
127
|
+
<span class="ruby-identifier">__set_url</span>(<span class="ruby-ivar">@canvas</span>.<span class="ruby-identifier">url_for_callback</span>(<span class="ruby-identifier">symbol</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>))
|
139
128
|
<span class="ruby-keyword kw">end</span>
|
140
129
|
</pre>
|
141
130
|
</div>
|