wee 0.10.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +127 -0
- data/Rakefile +11 -32
- data/doc/rdoc/classes/Array.html +28 -24
- data/doc/rdoc/classes/Hash.html +28 -24
- data/doc/rdoc/classes/Object.html +37 -84
- data/doc/rdoc/classes/String.html +89 -21
- data/doc/rdoc/classes/Struct.html +32 -82
- data/doc/rdoc/classes/Wee.html +285 -86
- data/doc/rdoc/classes/Wee/AnswerDecoration.html +111 -48
- data/doc/rdoc/classes/Wee/{Context.html → AnswerDecoration/Answer.html} +61 -51
- data/doc/rdoc/classes/Wee/Application.html +161 -322
- data/doc/rdoc/classes/Wee/Application/SessionCache.html +162 -0
- data/doc/rdoc/classes/Wee/Brush.html +147 -62
- data/doc/rdoc/classes/{Enumerable.html → Wee/Brush/ActionInputTag.html} +68 -41
- data/doc/rdoc/classes/Wee/Brush/AnchorTag.html +150 -100
- data/doc/rdoc/classes/Wee/Brush/CheckboxTag.html +132 -46
- data/doc/rdoc/classes/Wee/Brush/FileUploadTag.html +63 -41
- data/doc/rdoc/classes/Wee/Brush/FormTag.html +184 -78
- data/doc/rdoc/classes/Wee/Brush/GenericEncodedTextBrush.html +48 -65
- data/doc/rdoc/classes/Wee/Brush/GenericSingleTagBrush.html +83 -37
- data/doc/rdoc/classes/Wee/Brush/GenericTagBrush.html +334 -310
- data/doc/rdoc/classes/Wee/Brush/GenericTextBrush.html +74 -54
- data/doc/rdoc/classes/Wee/Brush/HiddenInputTag.html +58 -43
- data/doc/rdoc/classes/Wee/Brush/ImageButtonTag.html +64 -74
- data/doc/rdoc/classes/Wee/Brush/ImageTag.html +109 -86
- data/doc/rdoc/classes/Wee/Brush/InputTag.html +205 -45
- data/doc/rdoc/classes/Wee/Brush/JavascriptTag.html +96 -34
- data/doc/rdoc/classes/Wee/Brush/Page.html +129 -67
- data/doc/rdoc/classes/Wee/{Utils/LRUCache.html → Brush/PasswordInputTag.html} +65 -38
- data/doc/rdoc/classes/Wee/Brush/RadioButtonTag.html +132 -78
- data/doc/rdoc/classes/Wee/Brush/{RadioButtonTag/RadioGroup.html → RadioGroup.html} +91 -53
- data/doc/rdoc/classes/Wee/Brush/SelectListTag.html +301 -127
- data/doc/rdoc/classes/Wee/Brush/SelectOptionTag.html +96 -33
- data/doc/rdoc/classes/Wee/Brush/SubmitButtonTag.html +59 -44
- data/doc/rdoc/classes/Wee/Brush/TableDataTag.html +94 -57
- data/doc/rdoc/classes/Wee/Brush/TableHeaderTag.html +96 -33
- data/doc/rdoc/classes/Wee/Brush/TableRowTag.html +181 -121
- data/doc/rdoc/classes/Wee/Brush/TableTag.html +94 -32
- data/doc/rdoc/classes/Wee/Brush/TextAreaTag.html +257 -71
- data/doc/rdoc/classes/Wee/Brush/TextInputTag.html +58 -43
- data/doc/rdoc/classes/Wee/CallAnswerMixin.html +289 -0
- data/doc/rdoc/classes/Wee/CallbackMixin.html +233 -0
- data/doc/rdoc/classes/Wee/CallbackRegistry.html +179 -155
- data/doc/rdoc/classes/Wee/Callbacks.html +262 -0
- data/doc/rdoc/classes/Wee/Component.html +228 -779
- data/doc/rdoc/classes/Wee/Decoration.html +144 -159
- data/doc/rdoc/classes/Wee/DecorationMixin.html +340 -0
- data/doc/rdoc/classes/Wee/Delegate.html +119 -76
- data/doc/rdoc/classes/Wee/DupReplaceSnapshotMixin.html +64 -47
- data/doc/rdoc/classes/Wee/ErrorResponse.html +59 -62
- data/doc/rdoc/classes/Wee/FormDecoration.html +51 -37
- data/doc/rdoc/classes/Wee/GenericResponse.html +60 -35
- data/doc/rdoc/classes/Wee/HtmlCanvas.html +1000 -602
- data/doc/rdoc/classes/Wee/HtmlDocument.html +288 -0
- data/doc/rdoc/classes/Wee/HtmlWriter.html +227 -126
- data/doc/rdoc/classes/Wee/IdGenerator.html +60 -31
- data/doc/rdoc/classes/Wee/IdGenerator/Secure.html +282 -0
- data/doc/rdoc/classes/Wee/{SimpleIdGenerator.html → IdGenerator/Sequential.html} +76 -49
- data/doc/rdoc/classes/Wee/JQuery.html +221 -0
- data/doc/rdoc/classes/Wee/LRUCache.html +514 -0
- data/doc/rdoc/classes/Wee/LRUCache/Item.html +158 -0
- data/doc/rdoc/classes/Wee/ObjectSnapshotMixin.html +187 -0
- data/doc/rdoc/classes/Wee/PageDecoration.html +88 -59
- data/doc/rdoc/classes/Wee/Presenter.html +124 -704
- data/doc/rdoc/classes/Wee/RedirectResponse.html +64 -33
- data/doc/rdoc/classes/Wee/RefreshResponse.html +59 -44
- data/doc/rdoc/classes/Wee/Renderer.html +234 -54
- data/doc/rdoc/classes/Wee/Request.html +151 -286
- data/doc/rdoc/classes/Wee/Response.html +29 -212
- data/doc/rdoc/classes/Wee/Session.html +585 -360
- data/doc/rdoc/classes/Wee/{StateHolder.html → Session/AbortCallbackProcessing.html} +67 -40
- data/doc/rdoc/classes/Wee/Session/MutexSerializer.html +166 -0
- data/doc/rdoc/classes/{Cache/Strategy/LFU/Item.html → Wee/Session/Page.html} +26 -27
- data/doc/rdoc/classes/Wee/Session/ThreadSerializer.html +219 -0
- data/doc/rdoc/classes/Wee/State.html +307 -0
- data/doc/rdoc/classes/{Cache/Strategy/LRU/Item.html → Wee/State/Snapshot.html} +26 -27
- data/doc/rdoc/classes/{Cache/Strategy/Unbounded/Item.html → Wee/State/SnapshotIVars.html} +26 -27
- data/doc/rdoc/classes/Wee/StructSnapshotMixin.html +183 -0
- data/doc/rdoc/classes/Wee/WrapperDecoration.html +101 -35
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README_rdoc.html +243 -0
- data/doc/rdoc/files/lib/wee/application_rb.html +22 -30
- data/doc/rdoc/files/lib/wee/{page_rb.html → call_answer_rb.html} +14 -25
- data/doc/rdoc/files/lib/wee/callback_rb.html +12 -29
- data/doc/rdoc/files/lib/wee/component_rb.html +22 -27
- data/doc/rdoc/files/lib/wee/decoration_rb.html +19 -20
- data/doc/rdoc/files/lib/wee/{idgen_rb.html → html_brushes_rb.html} +14 -25
- data/doc/rdoc/files/lib/wee/html_canvas_rb.html +15 -23
- data/doc/rdoc/files/lib/wee/{abstractsession_rb.html → html_document_rb.html} +17 -25
- data/doc/rdoc/files/lib/wee/html_writer_rb.html +15 -23
- data/doc/rdoc/files/lib/wee/{webrick_rb.html → id_generator_rb.html} +19 -25
- data/doc/rdoc/files/lib/wee/{core/page_rb.html → jquery/jquery_rb.html} +14 -25
- data/doc/rdoc/files/lib/wee/{state_registry_rb.html → jquery_rb.html} +17 -27
- data/doc/rdoc/files/lib/{cache/cache_rb.html → wee/lru_cache_rb.html} +14 -25
- data/doc/rdoc/files/lib/wee/presenter_rb.html +12 -34
- data/doc/rdoc/files/lib/wee/{holder_rb.html → renderer_rb.html} +14 -25
- data/doc/rdoc/files/lib/wee/request_rb.html +18 -32
- data/doc/rdoc/files/lib/wee/response_rb.html +17 -24
- data/doc/rdoc/files/lib/wee/session_rb.html +21 -23
- data/doc/rdoc/files/lib/wee/state_rb.html +90 -0
- data/doc/rdoc/files/lib/wee_rb.html +48 -40
- data/doc/rdoc/fr_class_index.html +111 -75
- data/doc/rdoc/fr_file_index.html +46 -76
- data/doc/rdoc/fr_method_index.html +473 -480
- data/doc/rdoc/index.html +6 -9
- data/doc/rdoc/rdoc-style.css +210 -119
- data/examples/ObjectSpaceBrowser.rb +33 -23
- data/examples/ajax.rb +71 -0
- data/examples/continuations.rb +28 -0
- data/examples/demo.rb +92 -36
- data/examples/demo/calculator.rb +63 -0
- data/examples/demo/calendar.rb +42 -55
- data/examples/demo/counter.rb +38 -0
- data/{lib/wee/examples → examples/demo}/editable_counter.rb +11 -6
- data/examples/demo/example.rb +28 -24
- data/examples/demo/file_upload.rb +19 -0
- data/{lib/wee/components → examples/demo}/messagebox.rb +3 -3
- data/examples/demo/radio.rb +33 -0
- data/{lib/wee/examples → examples/demo}/window.rb +15 -10
- data/examples/hw.rb +3 -4
- data/{lib/wee/components → examples}/pager.rb +14 -14
- data/lib/wee.rb +48 -25
- data/lib/wee/application.rb +69 -131
- data/lib/wee/call_answer.rb +118 -0
- data/lib/wee/callback.rb +88 -0
- data/lib/wee/component.rb +141 -0
- data/lib/wee/decoration.rb +242 -0
- data/lib/wee/html_brushes.rb +725 -0
- data/lib/wee/html_canvas.rb +241 -0
- data/lib/wee/html_document.rb +45 -0
- data/lib/wee/html_writer.rb +71 -0
- data/lib/wee/id_generator.rb +70 -0
- data/lib/wee/jquery.rb +1 -0
- data/lib/wee/jquery/jquery.rb +17 -0
- data/lib/wee/jquery/public/jquery-1.3.2.min.js +19 -0
- data/lib/wee/jquery/public/wee-jquery.js +19 -0
- data/lib/wee/lru_cache.rb +89 -0
- data/lib/wee/presenter.rb +43 -0
- data/lib/wee/renderer.rb +65 -0
- data/lib/wee/request.rb +37 -113
- data/lib/wee/response.rb +43 -70
- data/lib/wee/session.rb +304 -113
- data/lib/wee/state.rb +85 -0
- data/test/component_spec.rb +17 -0
- data/wee.gemspec +4 -3
- metadata +249 -452
- data/ChangeLog +0 -657
- data/INSTALL +0 -17
- data/README +0 -272
- data/TODO +0 -142
- data/benchmark/Centrino1300/result.2000.counter.action +0 -45
- data/benchmark/Centrino1300/result.2000.counter.render +0 -43
- data/benchmark/Centrino1300/result.2000.filehandler +0 -43
- data/benchmark/Centrino600/result.2000.counter.action +0 -47
- data/benchmark/Centrino600/result.2000.counter.render +0 -45
- data/benchmark/Centrino600/result.2000.filehandler +0 -43
- data/benchmark/Makefile +0 -53
- data/benchmark/counter.rb +0 -77
- data/benchmark/filehandler.rb +0 -6
- data/benchmark/report_req.rb +0 -12
- data/bin/wee +0 -100
- data/doc/rdoc/classes/ActionView.html +0 -107
- data/doc/rdoc/classes/ActionView/Base.html +0 -133
- data/doc/rdoc/classes/Cache.html +0 -126
- data/doc/rdoc/classes/Cache/StorageCache.html +0 -320
- data/doc/rdoc/classes/Cache/Strategy.html +0 -128
- data/doc/rdoc/classes/Cache/Strategy/CapacityBounded.html +0 -269
- data/doc/rdoc/classes/Cache/Strategy/LFU.html +0 -238
- data/doc/rdoc/classes/Cache/Strategy/LRU.html +0 -238
- data/doc/rdoc/classes/Cache/Strategy/Unbounded.html +0 -225
- data/doc/rdoc/classes/LiteralMethod.html +0 -196
- data/doc/rdoc/classes/Main.html +0 -289
- data/doc/rdoc/classes/OgApplication.html +0 -126
- data/doc/rdoc/classes/OgScaffolder.html +0 -827
- data/doc/rdoc/classes/OgScaffolder/Editor.html +0 -565
- data/doc/rdoc/classes/OgSession.html +0 -172
- data/doc/rdoc/classes/Recipe.html +0 -113
- data/doc/rdoc/classes/Wee/AbstractSession.html +0 -502
- data/doc/rdoc/classes/Wee/Brush/ActionCallbackMixin.html +0 -148
- data/doc/rdoc/classes/Wee/Brush/ActionMixin.html +0 -146
- data/doc/rdoc/classes/Wee/Brush/ActionURLCallbackMixin.html +0 -154
- data/doc/rdoc/classes/Wee/Brush/AssignMixin.html +0 -141
- data/doc/rdoc/classes/Wee/Brush/CallbackMixin.html +0 -141
- data/doc/rdoc/classes/Wee/Brush/InputCallbackMixin.html +0 -148
- data/doc/rdoc/classes/Wee/Brush/SelectListTag/SelectListCallback.html +0 -158
- data/doc/rdoc/classes/Wee/Brush/ToCallback.html +0 -146
- data/doc/rdoc/classes/Wee/Callback.html +0 -231
- data/doc/rdoc/classes/Wee/CallbackStream.html +0 -227
- data/doc/rdoc/classes/Wee/Canvas.html +0 -235
- data/doc/rdoc/classes/Wee/CanvasMixin.html +0 -225
- data/doc/rdoc/classes/Wee/Component/OnAnswer.html +0 -153
- data/doc/rdoc/classes/Wee/ComponentDispatcher.html +0 -289
- data/doc/rdoc/classes/Wee/ComponentRunner.html +0 -321
- data/doc/rdoc/classes/Wee/ErrorPage.html +0 -175
- data/doc/rdoc/classes/Wee/Examples.html +0 -114
- data/doc/rdoc/classes/Wee/Examples/Calculator.html +0 -319
- data/doc/rdoc/classes/Wee/Examples/Counter.html +0 -289
- data/doc/rdoc/classes/Wee/Examples/EditableCounter.html +0 -210
- data/doc/rdoc/classes/Wee/Examples/Window.html +0 -346
- data/doc/rdoc/classes/Wee/FastCGIAdaptor.html +0 -227
- data/doc/rdoc/classes/Wee/Helper.html +0 -148
- data/doc/rdoc/classes/Wee/HtmlCanvasRenderer.html +0 -1230
- data/doc/rdoc/classes/Wee/LiteralMethodCallback.html +0 -198
- data/doc/rdoc/classes/Wee/LoginDecoration.html +0 -261
- data/doc/rdoc/classes/Wee/Md5IdGenerator.html +0 -181
- data/doc/rdoc/classes/Wee/MessageBox.html +0 -180
- data/doc/rdoc/classes/Wee/MethodCallback.html +0 -193
- data/doc/rdoc/classes/Wee/Nitro.html +0 -114
- data/doc/rdoc/classes/Wee/Nitro/ControllerClassMixin.html +0 -192
- data/doc/rdoc/classes/Wee/Nitro/ControllerMixin.html +0 -345
- data/doc/rdoc/classes/Wee/Nitro/FormTag.html +0 -155
- data/doc/rdoc/classes/Wee/Nitro/HtmlCanvasRenderer.html +0 -178
- data/doc/rdoc/classes/Wee/Page.html +0 -115
- data/doc/rdoc/classes/Wee/PagelessApplication.html +0 -154
- data/doc/rdoc/classes/Wee/PagelessComponentDriver.html +0 -296
- data/doc/rdoc/classes/Wee/PagelessRequest.html +0 -208
- data/doc/rdoc/classes/Wee/PagelessSession.html +0 -359
- data/doc/rdoc/classes/Wee/Pager.html +0 -534
- data/doc/rdoc/classes/Wee/Rails.html +0 -114
- data/doc/rdoc/classes/Wee/Rails/ControllerClassMixin.html +0 -192
- data/doc/rdoc/classes/Wee/Rails/ControllerMixin.html +0 -342
- data/doc/rdoc/classes/Wee/Rails/FormTag.html +0 -155
- data/doc/rdoc/classes/Wee/Rails/HtmlCanvasRenderer.html +0 -177
- data/doc/rdoc/classes/Wee/RenderingContext.html +0 -283
- data/doc/rdoc/classes/Wee/RequestHandler.html +0 -341
- data/doc/rdoc/classes/Wee/Snapshot.html +0 -211
- data/doc/rdoc/classes/Wee/StateRegistry.html +0 -434
- data/doc/rdoc/classes/Wee/StateRegistry/Snapshot.html +0 -320
- data/doc/rdoc/classes/Wee/StateRegistry/WithObject.html +0 -153
- data/doc/rdoc/classes/Wee/Utils.html +0 -300
- data/doc/rdoc/classes/Wee/ValueHolder.html +0 -220
- data/doc/rdoc/classes/Wee/WEBrickAdaptor.html +0 -368
- data/doc/rdoc/files/INSTALL.html +0 -130
- data/doc/rdoc/files/README.html +0 -471
- data/doc/rdoc/files/lib/wee/adaptors/fastcgi_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/adaptors/nitro_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/adaptors/rails_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/adaptors/webrick_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/component_ext_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/components/component_dispatcher_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/components/form_decoration_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/components/login_decoration_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/components/messagebox_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/components/page_decoration_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/components/pager_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/components/wrapper_decoration_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/components_rb.html +0 -114
- data/doc/rdoc/files/lib/wee/context_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/continuation/core/component_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/continuation/session_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/continuation_rb.html +0 -116
- data/doc/rdoc/files/lib/wee/core/callback_rb.html +0 -115
- data/doc/rdoc/files/lib/wee/core/component_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/core/componentrunner_rb.html +0 -110
- data/doc/rdoc/files/lib/wee/core/context_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/core/decoration_rb.html +0 -133
- data/doc/rdoc/files/lib/wee/core/idgen_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/core/presenter_rb.html +0 -112
- data/doc/rdoc/files/lib/wee/core/renderer_rb.html +0 -107
- data/doc/rdoc/files/lib/wee/core/snapshot_rb.html +0 -113
- data/doc/rdoc/files/lib/wee/core/valueholder_rb.html +0 -110
- data/doc/rdoc/files/lib/wee/core_ext_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/core_rb.html +0 -124
- data/doc/rdoc/files/lib/wee/databases/og/application_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/databases/og/old_scaffolder_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/databases/og/scaffolder_rb.html +0 -115
- data/doc/rdoc/files/lib/wee/databases/og/session_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/databases/og_rb.html +0 -111
- data/doc/rdoc/files/lib/wee/examples/calculator_rb.html +0 -107
- data/doc/rdoc/files/lib/wee/examples/counter_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/examples/editable_counter_rb.html +0 -114
- data/doc/rdoc/files/lib/wee/examples/window_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/idgen/md5_rb.html +0 -115
- data/doc/rdoc/files/lib/wee/idgen/simple_rb.html +0 -107
- data/doc/rdoc/files/lib/wee/pageless/application_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/pageless/request_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/pageless/session_rb.html +0 -109
- data/doc/rdoc/files/lib/wee/pageless_rb.html +0 -110
- data/doc/rdoc/files/lib/wee/renderer/html/brushes_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/renderer/html/canvas_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/renderer/html/writer_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/rendering/html/brushes_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/rendering/html/canvas_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/rendering/html/writer_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/requesthandler_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/skeleton/og/components/main_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/skeleton/og/conf/db_rb.html +0 -114
- data/doc/rdoc/files/lib/wee/skeleton/og/models/recipe_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/skeleton/og/run_rb.html +0 -115
- data/doc/rdoc/files/lib/wee/skeleton/simple/components/main_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/skeleton/simple/run_rb.html +0 -111
- data/doc/rdoc/files/lib/wee/snapshot_ext_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/snapshot_rb.html +0 -107
- data/doc/rdoc/files/lib/wee/stuff_rb.html +0 -144
- data/doc/rdoc/files/lib/wee/template_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/utils/autoreload_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/utils/cache_rb.html +0 -108
- data/doc/rdoc/files/lib/wee/utils/helper_rb.html +0 -101
- data/doc/rdoc/files/lib/wee/utils_rb.html +0 -110
- data/examples/ajax/ajax.js +0 -444
- data/examples/ajax/ajax.rb +0 -31
- data/examples/cc.rb +0 -74
- data/examples/dispatcher.rb +0 -37
- data/examples/draw.rb +0 -94
- data/examples/live-update.rb +0 -45
- data/examples/nitro/run.rb +0 -42
- data/examples/og-test.rb +0 -60
- data/examples/radio.rb +0 -44
- data/examples/test.rb +0 -39
- data/install.rb +0 -14
- data/lib/cache/cache.rb +0 -167
- data/lib/wee/abstractsession.rb +0 -96
- data/lib/wee/adaptors/fastcgi.rb +0 -76
- data/lib/wee/adaptors/nitro.rb +0 -155
- data/lib/wee/adaptors/rails.rb +0 -154
- data/lib/wee/adaptors/webrick.rb +0 -89
- data/lib/wee/components.rb +0 -7
- data/lib/wee/components/component_dispatcher.rb +0 -46
- data/lib/wee/components/form_decoration.rb +0 -7
- data/lib/wee/components/login_decoration.rb +0 -35
- data/lib/wee/components/page_decoration.rb +0 -14
- data/lib/wee/components/wrapper_decoration.rb +0 -7
- data/lib/wee/continuation.rb +0 -5
- data/lib/wee/continuation/core/component.rb +0 -56
- data/lib/wee/continuation/session.rb +0 -64
- data/lib/wee/core.rb +0 -16
- data/lib/wee/core/callback.rb +0 -121
- data/lib/wee/core/component.rb +0 -356
- data/lib/wee/core/componentrunner.rb +0 -73
- data/lib/wee/core/context.rb +0 -27
- data/lib/wee/core/decoration.rb +0 -138
- data/lib/wee/core/idgen.rb +0 -5
- data/lib/wee/core/page.rb +0 -1
- data/lib/wee/core/presenter.rb +0 -100
- data/lib/wee/core/renderer.rb +0 -23
- data/lib/wee/core/snapshot.rb +0 -21
- data/lib/wee/core/valueholder.rb +0 -19
- data/lib/wee/core_ext.rb +0 -122
- data/lib/wee/databases/og.rb +0 -4
- data/lib/wee/databases/og/application.rb +0 -3
- data/lib/wee/databases/og/old_scaffolder.rb +0 -98
- data/lib/wee/databases/og/scaffolder.rb +0 -255
- data/lib/wee/databases/og/session.rb +0 -9
- data/lib/wee/examples/calculator.rb +0 -70
- data/lib/wee/examples/counter.rb +0 -33
- data/lib/wee/idgen/md5.rb +0 -21
- data/lib/wee/idgen/sequential.rb +0 -11
- data/lib/wee/pageless.rb +0 -3
- data/lib/wee/pageless/application.rb +0 -13
- data/lib/wee/pageless/request.rb +0 -27
- data/lib/wee/pageless/session.rb +0 -74
- data/lib/wee/renderer/html/brushes.rb +0 -667
- data/lib/wee/renderer/html/canvas.rb +0 -265
- data/lib/wee/renderer/html/writer.rb +0 -80
- data/lib/wee/requesthandler.rb +0 -81
- data/lib/wee/skeleton/og/README +0 -38
- data/lib/wee/skeleton/og/components/main.rb +0 -20
- data/lib/wee/skeleton/og/conf/db.rb +0 -8
- data/lib/wee/skeleton/og/models/recipe.rb +0 -5
- data/lib/wee/skeleton/og/run.rb +0 -23
- data/lib/wee/skeleton/simple/README +0 -32
- data/lib/wee/skeleton/simple/components/main.rb +0 -25
- data/lib/wee/skeleton/simple/run.rb +0 -12
- data/lib/wee/snapshot_ext.rb +0 -41
- data/lib/wee/template.rb +0 -42
- data/lib/wee/utils.rb +0 -5
- data/lib/wee/utils/autoreload.rb +0 -56
- data/lib/wee/utils/cache.rb +0 -7
- data/lib/wee/utils/helper.rb +0 -51
@@ -1,12 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
6
3
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
4
|
<head>
|
8
|
-
<title>Class: Wee::Response</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=
|
5
|
+
<title>Class: Wee::Response [RDoc Documentation]</title>
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
10
7
|
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
8
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
9
|
<script type="text/javascript">
|
@@ -25,7 +22,7 @@
|
|
25
22
|
return false;
|
26
23
|
|
27
24
|
elemStyle = elem.style;
|
28
|
-
|
25
|
+
|
29
26
|
if ( elemStyle.display != "block" ) {
|
30
27
|
elemStyle.display = "block"
|
31
28
|
} else {
|
@@ -34,10 +31,10 @@
|
|
34
31
|
|
35
32
|
return true;
|
36
33
|
}
|
37
|
-
|
34
|
+
|
38
35
|
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }
|
40
|
-
|
36
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }<\/style>" )
|
37
|
+
|
41
38
|
// ]]>
|
42
39
|
</script>
|
43
40
|
|
@@ -45,7 +42,6 @@
|
|
45
42
|
<body>
|
46
43
|
|
47
44
|
|
48
|
-
|
49
45
|
<div id="classHeader">
|
50
46
|
<table class="header-table">
|
51
47
|
<tr class="top-aligned-row">
|
@@ -55,255 +51,76 @@
|
|
55
51
|
<tr class="top-aligned-row">
|
56
52
|
<td><strong>In:</strong></td>
|
57
53
|
<td>
|
54
|
+
|
55
|
+
|
58
56
|
<a href="../../files/lib/wee/response_rb.html">
|
57
|
+
|
59
58
|
lib/wee/response.rb
|
59
|
+
|
60
60
|
</a>
|
61
|
+
|
62
|
+
|
61
63
|
<br />
|
64
|
+
|
62
65
|
</td>
|
63
66
|
</tr>
|
64
67
|
|
68
|
+
|
65
69
|
<tr class="top-aligned-row">
|
66
70
|
<td><strong>Parent:</strong></td>
|
67
71
|
<td>
|
68
|
-
|
69
|
-
|
70
|
-
|
72
|
+
|
73
|
+
Rack::Response
|
74
|
+
|
71
75
|
</td>
|
72
76
|
</tr>
|
77
|
+
|
73
78
|
</table>
|
74
79
|
</div>
|
75
80
|
<!-- banner header -->
|
76
81
|
|
77
82
|
<div id="bodyContent">
|
78
83
|
|
79
|
-
|
80
|
-
|
81
84
|
<div id="contextContent">
|
82
85
|
|
83
|
-
|
84
|
-
|
85
86
|
</div>
|
86
87
|
|
87
|
-
<div id="method-list">
|
88
|
-
<h3 class="section-bar">Methods</h3>
|
89
|
-
|
90
|
-
<div class="name-list">
|
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
|
-
</div>
|
98
|
-
</div>
|
99
88
|
|
100
89
|
</div>
|
101
90
|
|
102
|
-
|
103
91
|
<!-- if includes -->
|
104
92
|
|
105
93
|
<div id="section">
|
106
94
|
|
107
|
-
|
108
|
-
|
109
|
-
<h3 class="section-bar">Constants</h3>
|
95
|
+
<div id="aliases-list">
|
96
|
+
<h3 class="section-bar">External Aliases</h3>
|
110
97
|
|
111
98
|
<div class="name-list">
|
112
|
-
|
113
|
-
<tr class="top-aligned-row context-row">
|
114
|
-
<td class="context-item-name">DEFAULT_HEADER</td>
|
115
|
-
<td>=</td>
|
116
|
-
<td class="context-item-value">{}.freeze</td>
|
117
|
-
</tr>
|
118
|
-
</table>
|
119
|
-
</div>
|
120
|
-
</div>
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
<div id="attribute-list">
|
125
|
-
<h3 class="section-bar">Attributes</h3>
|
99
|
+
<table summary="aliases">
|
126
100
|
|
127
|
-
<div class="name-list">
|
128
|
-
<table>
|
129
|
-
<tr class="top-aligned-row context-row">
|
130
|
-
<td class="context-item-name">content</td>
|
131
|
-
<td class="context-item-value"> [RW] </td>
|
132
|
-
<td class="context-item-desc"></td>
|
133
|
-
</tr>
|
134
101
|
<tr class="top-aligned-row context-row">
|
135
|
-
<td class="context-item-name">
|
136
|
-
<td
|
137
|
-
<td class="context-item-
|
138
|
-
</tr>
|
139
|
-
<tr class="top-aligned-row context-row">
|
140
|
-
<td class="context-item-name">status</td>
|
141
|
-
<td class="context-item-value"> [RW] </td>
|
142
|
-
<td class="context-item-desc"></td>
|
102
|
+
<td class="context-item-name">write</td>
|
103
|
+
<td>-></td>
|
104
|
+
<td class="context-item-value"><<</td>
|
143
105
|
</tr>
|
106
|
+
|
144
107
|
</table>
|
145
108
|
</div>
|
146
109
|
</div>
|
147
|
-
|
148
110
|
|
149
111
|
|
150
|
-
<!-- if method_list -->
|
151
|
-
<div id="methods">
|
152
|
-
<h3 class="section-bar">Public Class methods</h3>
|
153
|
-
|
154
|
-
<div id="method-M000289" class="method-detail">
|
155
|
-
<a name="M000289"></a>
|
156
|
-
|
157
|
-
<div class="method-heading">
|
158
|
-
<a href="#M000289" class="method-signature">
|
159
|
-
<span class="method-name">new</span><span class="method-args">(mime_type = 'text/html', content='')</span>
|
160
|
-
</a>
|
161
|
-
</div>
|
162
|
-
|
163
|
-
<div class="method-description">
|
164
|
-
<p><a class="source-toggle" href="#"
|
165
|
-
onclick="toggleCode('M000289-source');return false;">[Source]</a></p>
|
166
|
-
<div class="method-source-code" id="M000289-source">
|
167
|
-
<pre>
|
168
|
-
<span class="ruby-comment cmt"># File lib/wee/response.rb, line 18</span>
|
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
|
-
<span class="ruby-ivar">@status</span> = <span class="ruby-value">200</span>
|
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>
|
173
|
-
<span class="ruby-ivar">@content</span> = <span class="ruby-identifier">content</span>
|
174
|
-
<span class="ruby-keyword kw">end</span>
|
175
|
-
</pre>
|
176
|
-
</div>
|
177
|
-
</div>
|
178
|
-
</div>
|
179
|
-
|
180
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
181
|
-
|
182
|
-
<div id="method-M000292" class="method-detail">
|
183
|
-
<a name="M000292"></a>
|
184
|
-
|
185
|
-
<div class="method-heading">
|
186
|
-
<a href="#M000292" class="method-signature">
|
187
|
-
<span class="method-name"><<</span><span class="method-args">(str)</span>
|
188
|
-
</a>
|
189
|
-
</div>
|
190
|
-
|
191
|
-
<div class="method-description">
|
192
|
-
<p><a class="source-toggle" href="#"
|
193
|
-
onclick="toggleCode('M000292-source');return false;">[Source]</a></p>
|
194
|
-
<div class="method-source-code" id="M000292-source">
|
195
|
-
<pre>
|
196
|
-
<span class="ruby-comment cmt"># File lib/wee/response.rb, line 33</span>
|
197
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-operator"><<</span>(<span class="ruby-identifier">str</span>)
|
198
|
-
<span class="ruby-ivar">@content</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">str</span>
|
199
|
-
<span class="ruby-keyword kw">end</span>
|
200
|
-
</pre>
|
201
|
-
</div>
|
202
|
-
</div>
|
203
|
-
</div>
|
204
112
|
|
205
|
-
<div id="method-M000290" class="method-detail">
|
206
|
-
<a name="M000290"></a>
|
207
|
-
|
208
|
-
<div class="method-heading">
|
209
|
-
<a href="#M000290" class="method-signature">
|
210
|
-
<span class="method-name">content_type</span><span class="method-args">()</span>
|
211
|
-
</a>
|
212
|
-
</div>
|
213
|
-
|
214
|
-
<div class="method-description">
|
215
|
-
<p><a class="source-toggle" href="#"
|
216
|
-
onclick="toggleCode('M000290-source');return false;">[Source]</a></p>
|
217
|
-
<div class="method-source-code" id="M000290-source">
|
218
|
-
<pre>
|
219
|
-
<span class="ruby-comment cmt"># File lib/wee/response.rb, line 25</span>
|
220
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content_type</span>
|
221
|
-
<span class="ruby-ivar">@header</span>[<span class="ruby-value str">'Content-Type'</span>]
|
222
|
-
<span class="ruby-keyword kw">end</span>
|
223
|
-
</pre>
|
224
|
-
</div>
|
225
|
-
</div>
|
226
|
-
</div>
|
227
|
-
|
228
|
-
<div id="method-M000291" class="method-detail">
|
229
|
-
<a name="M000291"></a>
|
230
|
-
|
231
|
-
<div class="method-heading">
|
232
|
-
<a href="#M000291" class="method-signature">
|
233
|
-
<span class="method-name">content_type=</span><span class="method-args">(mime_type)</span>
|
234
|
-
</a>
|
235
|
-
</div>
|
236
|
-
|
237
|
-
<div class="method-description">
|
238
|
-
<p><a class="source-toggle" href="#"
|
239
|
-
onclick="toggleCode('M000291-source');return false;">[Source]</a></p>
|
240
|
-
<div class="method-source-code" id="M000291-source">
|
241
|
-
<pre>
|
242
|
-
<span class="ruby-comment cmt"># File lib/wee/response.rb, line 29</span>
|
243
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content_type=</span>(<span class="ruby-identifier">mime_type</span>)
|
244
|
-
<span class="ruby-ivar">@header</span>[<span class="ruby-value str">'Content-Type'</span>] = <span class="ruby-identifier">mime_type</span>
|
245
|
-
<span class="ruby-keyword kw">end</span>
|
246
|
-
</pre>
|
247
|
-
</div>
|
248
|
-
</div>
|
249
|
-
</div>
|
250
113
|
|
251
|
-
|
252
|
-
<a name="M000288"></a>
|
253
|
-
|
254
|
-
<div class="method-heading">
|
255
|
-
<a href="#M000288" class="method-signature">
|
256
|
-
<span class="method-name">cookies</span><span class="method-args">()</span>
|
257
|
-
</a>
|
258
|
-
</div>
|
259
|
-
|
260
|
-
<div class="method-description">
|
261
|
-
<p><a class="source-toggle" href="#"
|
262
|
-
onclick="toggleCode('M000288-source');return false;">[Source]</a></p>
|
263
|
-
<div class="method-source-code" id="M000288-source">
|
264
|
-
<pre>
|
265
|
-
<span class="ruby-comment cmt"># File lib/wee/response.rb, line 14</span>
|
266
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cookies</span>
|
267
|
-
<span class="ruby-ivar">@cookies</span> <span class="ruby-operator">||=</span> []
|
268
|
-
<span class="ruby-keyword kw">end</span>
|
269
|
-
</pre>
|
270
|
-
</div>
|
271
|
-
</div>
|
272
|
-
</div>
|
273
|
-
|
274
|
-
<div id="method-M000287" class="method-detail">
|
275
|
-
<a name="M000287"></a>
|
276
|
-
|
277
|
-
<div class="method-heading">
|
278
|
-
<a href="#M000287" class="method-signature">
|
279
|
-
<span class="method-name">cookies?</span><span class="method-args">()</span>
|
280
|
-
</a>
|
281
|
-
</div>
|
282
|
-
|
283
|
-
<div class="method-description">
|
284
|
-
<p><a class="source-toggle" href="#"
|
285
|
-
onclick="toggleCode('M000287-source');return false;">[Source]</a></p>
|
286
|
-
<div class="method-source-code" id="M000287-source">
|
287
|
-
<pre>
|
288
|
-
<span class="ruby-comment cmt"># File lib/wee/response.rb, line 10</span>
|
289
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cookies?</span>
|
290
|
-
<span class="ruby-ivar">@cookies</span>
|
291
|
-
<span class="ruby-keyword kw">end</span>
|
292
|
-
</pre>
|
293
|
-
</div>
|
294
|
-
</div>
|
295
|
-
</div>
|
114
|
+
<!-- if method_list -->
|
296
115
|
|
297
116
|
|
298
|
-
</div>
|
299
117
|
|
300
118
|
|
301
119
|
</div>
|
302
120
|
|
303
|
-
|
304
121
|
<div id="validator-badges">
|
305
122
|
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
306
123
|
</div>
|
307
124
|
|
308
125
|
</body>
|
309
|
-
</html>
|
126
|
+
</html>
|
@@ -1,12 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
6
3
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
4
|
<head>
|
8
|
-
<title>Class: Wee::Session</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=
|
5
|
+
<title>Class: Wee::Session [RDoc Documentation]</title>
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
10
7
|
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
8
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
9
|
<script type="text/javascript">
|
@@ -25,7 +22,7 @@
|
|
25
22
|
return false;
|
26
23
|
|
27
24
|
elemStyle = elem.style;
|
28
|
-
|
25
|
+
|
29
26
|
if ( elemStyle.display != "block" ) {
|
30
27
|
elemStyle.display = "block"
|
31
28
|
} else {
|
@@ -34,10 +31,10 @@
|
|
34
31
|
|
35
32
|
return true;
|
36
33
|
}
|
37
|
-
|
34
|
+
|
38
35
|
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }
|
40
|
-
|
36
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }<\/style>" )
|
37
|
+
|
41
38
|
// ]]>
|
42
39
|
</script>
|
43
40
|
|
@@ -45,7 +42,6 @@
|
|
45
42
|
<body>
|
46
43
|
|
47
44
|
|
48
|
-
|
49
45
|
<div id="classHeader">
|
50
46
|
<table class="header-table">
|
51
47
|
<tr class="top-aligned-row">
|
@@ -55,75 +51,98 @@
|
|
55
51
|
<tr class="top-aligned-row">
|
56
52
|
<td><strong>In:</strong></td>
|
57
53
|
<td>
|
54
|
+
|
55
|
+
|
58
56
|
<a href="../../files/lib/wee/session_rb.html">
|
57
|
+
|
59
58
|
lib/wee/session.rb
|
59
|
+
|
60
60
|
</a>
|
61
|
+
|
62
|
+
|
61
63
|
<br />
|
62
|
-
|
63
|
-
lib/wee/continuation/session.rb
|
64
|
-
</a>
|
65
|
-
<br />
|
64
|
+
|
66
65
|
</td>
|
67
66
|
</tr>
|
68
67
|
|
68
|
+
|
69
69
|
<tr class="top-aligned-row">
|
70
70
|
<td><strong>Parent:</strong></td>
|
71
71
|
<td>
|
72
|
-
|
73
|
-
|
72
|
+
|
73
|
+
<a href="../Object.html">
|
74
|
+
|
75
|
+
Object
|
76
|
+
|
74
77
|
</a>
|
78
|
+
|
75
79
|
</td>
|
76
80
|
</tr>
|
81
|
+
|
77
82
|
</table>
|
78
83
|
</div>
|
79
84
|
<!-- banner header -->
|
80
85
|
|
81
86
|
<div id="bodyContent">
|
82
87
|
|
83
|
-
|
84
|
-
|
85
88
|
<div id="contextContent">
|
86
89
|
|
87
|
-
|
88
|
-
|
89
|
-
<div id="contents-list">
|
90
|
-
<h3 class="section-bar">Contents</h3>
|
91
|
-
<ul>
|
92
|
-
<li><a href="#SEC00015">Request processing/handling</a></li>
|
93
|
-
</ul>
|
94
90
|
</div>
|
95
91
|
|
92
|
+
|
96
93
|
<div id="method-list">
|
97
94
|
<h3 class="section-bar">Methods</h3>
|
98
95
|
|
99
96
|
<div class="name-list">
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
97
|
+
|
98
|
+
<a href="#M000033">action</a>
|
99
|
+
|
100
|
+
<a href="#M000022">alive?</a>
|
101
|
+
|
102
|
+
<a href="#M000028">awake</a>
|
103
|
+
|
104
|
+
<a href="#M000026">call</a>
|
105
|
+
|
106
|
+
<a href="#M000025">current</a>
|
107
|
+
|
108
|
+
<a href="#M000023">dead?</a>
|
109
|
+
|
110
|
+
<a href="#M000030">handle</a>
|
111
|
+
|
112
|
+
<a href="#M000020">new</a>
|
113
|
+
|
114
|
+
<a href="#M000032">render</a>
|
115
|
+
|
116
|
+
<a href="#M000031">render_ajax_proc</a>
|
117
|
+
|
118
|
+
<a href="#M000027">send_response</a>
|
119
|
+
|
120
|
+
<a href="#M000029">sleep</a>
|
121
|
+
|
122
|
+
<a href="#M000024">statistics</a>
|
123
|
+
|
124
|
+
<a href="#M000034">take_snapshot</a>
|
125
|
+
|
126
|
+
<a href="#M000021">terminate</a>
|
127
|
+
|
116
128
|
</div>
|
117
129
|
</div>
|
118
130
|
|
119
131
|
</div>
|
120
132
|
|
121
|
-
|
122
133
|
<!-- if includes -->
|
123
134
|
|
124
135
|
<div id="section">
|
125
136
|
|
137
|
+
<div id="class-list">
|
138
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
126
139
|
|
140
|
+
Class <a href="Session/AbortCallbackProcessing.html" class="link">Wee::Session::AbortCallbackProcessing</a><br />
|
141
|
+
Class <a href="Session/MutexSerializer.html" class="link">Wee::Session::MutexSerializer</a><br />
|
142
|
+
Class <a href="Session/Page.html" class="link">Wee::Session::Page</a><br />
|
143
|
+
Class <a href="Session/ThreadSerializer.html" class="link">Wee::Session::ThreadSerializer</a><br />
|
144
|
+
|
145
|
+
</div>
|
127
146
|
|
128
147
|
|
129
148
|
|
@@ -132,548 +151,754 @@
|
|
132
151
|
|
133
152
|
<div class="name-list">
|
134
153
|
<table>
|
154
|
+
|
155
|
+
<tr class="top-aligned-row context-row">
|
156
|
+
<td class="context-item-name">application</td>
|
157
|
+
|
158
|
+
<td class="context-item-value"> [RW] </td>
|
159
|
+
|
160
|
+
<td class="context-item-desc">
|
161
|
+
Points to the <a href="Application.html">Wee::Application</a> object this
|
162
|
+
session belongs to.
|
163
|
+
|
164
|
+
</td>
|
165
|
+
</tr>
|
166
|
+
|
167
|
+
<tr class="top-aligned-row context-row">
|
168
|
+
<td class="context-item-name">expire_after</td>
|
169
|
+
|
170
|
+
<td class="context-item-value"> [RW] </td>
|
171
|
+
|
172
|
+
<td class="context-item-desc">
|
173
|
+
Expire the session after this number of seconds of inactivity. If this
|
174
|
+
value is <tt>nil</tt>, the <a href="Session.html">Session</a> will never
|
175
|
+
expire due to inactivity. (but still may expire for example due to
|
176
|
+
<em>max_lifetime</em>).
|
177
|
+
|
178
|
+
<p>
|
179
|
+
Default: <tt>1800</tt> seconds (30 minutes)
|
180
|
+
</p>
|
181
|
+
</td>
|
182
|
+
</tr>
|
183
|
+
|
135
184
|
<tr class="top-aligned-row context-row">
|
136
|
-
<td class="context-item-name">
|
185
|
+
<td class="context-item-name">id</td>
|
186
|
+
|
187
|
+
<td class="context-item-value"> [RW] </td>
|
188
|
+
|
189
|
+
<td class="context-item-desc">
|
190
|
+
The (application-wide) unique id of this session.
|
191
|
+
|
192
|
+
</td>
|
193
|
+
</tr>
|
194
|
+
|
195
|
+
<tr class="top-aligned-row context-row">
|
196
|
+
<td class="context-item-name">max_lifetime</td>
|
197
|
+
|
137
198
|
<td class="context-item-value"> [RW] </td>
|
138
|
-
|
199
|
+
|
200
|
+
<td class="context-item-desc">
|
201
|
+
The maximum lifetime of this session in seconds. A value of <tt>nil</tt>
|
202
|
+
means infinite lifetime.
|
203
|
+
|
204
|
+
<p>
|
205
|
+
Default: <tt>nil</tt> (infinite lifetime)
|
206
|
+
</p>
|
207
|
+
</td>
|
139
208
|
</tr>
|
209
|
+
|
140
210
|
<tr class="top-aligned-row context-row">
|
141
|
-
<td class="context-item-name">
|
211
|
+
<td class="context-item-name">max_requests</td>
|
212
|
+
|
142
213
|
<td class="context-item-value"> [RW] </td>
|
143
|
-
|
214
|
+
|
215
|
+
<td class="context-item-desc">
|
216
|
+
The maximum number of requests this session is allowed to serve. A value of
|
217
|
+
<tt>nil</tt> means no limitation.
|
218
|
+
|
219
|
+
<p>
|
220
|
+
Default: <tt>nil</tt> (infinite number of requests)
|
221
|
+
</p>
|
222
|
+
</td>
|
144
223
|
</tr>
|
224
|
+
|
145
225
|
</table>
|
146
226
|
</div>
|
147
227
|
</div>
|
148
|
-
|
149
228
|
|
150
229
|
|
151
230
|
<!-- if method_list -->
|
231
|
+
|
152
232
|
<div id="methods">
|
233
|
+
|
153
234
|
<h3 class="section-bar">Public Class methods</h3>
|
154
235
|
|
155
|
-
|
156
|
-
|
236
|
+
|
237
|
+
<div id="method-M000025" class="method-detail">
|
238
|
+
<a name="M000025"></a>
|
157
239
|
|
158
240
|
<div class="method-heading">
|
159
|
-
|
160
|
-
<
|
241
|
+
|
242
|
+
<a href="#M000025" class="method-signature">
|
243
|
+
|
244
|
+
<span class="method-name">current</span><span class="method-args">()</span>
|
245
|
+
|
161
246
|
</a>
|
247
|
+
|
162
248
|
</div>
|
163
|
-
|
249
|
+
|
164
250
|
<div class="method-description">
|
251
|
+
|
252
|
+
<p>
|
253
|
+
Returns the current session (thread-local).
|
254
|
+
</p>
|
255
|
+
|
165
256
|
<p><a class="source-toggle" href="#"
|
166
|
-
onclick="toggleCode('
|
167
|
-
<div class="method-source-code" id="
|
257
|
+
onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
|
258
|
+
<div class="method-source-code" id="M000025-source">
|
168
259
|
<pre>
|
169
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
170
|
-
|
171
|
-
|
172
|
-
<span class="ruby-
|
173
|
-
<span class="ruby-keyword kw">end</span>
|
260
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 159</span>
|
261
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">current</span>
|
262
|
+
<span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-identifier">:wee_session</span>] <span class="ruby-operator">||</span> (<span class="ruby-identifier">raise</span> <span class="ruby-value str">"Not in session"</span>)
|
263
|
+
<span class="ruby-keyword kw">end</span>
|
174
264
|
</pre>
|
175
265
|
</div>
|
266
|
+
|
176
267
|
</div>
|
177
268
|
</div>
|
178
269
|
|
179
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
180
270
|
|
181
|
-
<div id="method-
|
182
|
-
<a name="
|
271
|
+
<div id="method-M000020" class="method-detail">
|
272
|
+
<a name="M000020"></a>
|
183
273
|
|
184
274
|
<div class="method-heading">
|
185
|
-
|
186
|
-
<
|
275
|
+
|
276
|
+
<a href="#M000020" class="method-signature">
|
277
|
+
|
278
|
+
<span class="method-name">new</span><span class="method-args">(root_component, serializer=nil, page_cache_capacity=20)</span>
|
279
|
+
|
187
280
|
</a>
|
281
|
+
|
188
282
|
</div>
|
189
|
-
|
283
|
+
|
190
284
|
<div class="method-description">
|
285
|
+
|
286
|
+
<p>
|
287
|
+
Creates a new session.
|
288
|
+
</p>
|
289
|
+
|
191
290
|
<p><a class="source-toggle" href="#"
|
192
|
-
onclick="toggleCode('
|
193
|
-
<div class="method-source-code" id="
|
291
|
+
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
292
|
+
<div class="method-source-code" id="M000020-source">
|
194
293
|
<pre>
|
195
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
196
|
-
|
197
|
-
|
198
|
-
|
294
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 95</span>
|
295
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">root_component</span>, <span class="ruby-identifier">serializer</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">page_cache_capacity</span>=<span class="ruby-value">20</span>)
|
296
|
+
<span class="ruby-ivar">@root_component</span> = <span class="ruby-identifier">root_component</span>
|
297
|
+
<span class="ruby-ivar">@page_cache</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">LRUCache</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">page_cache_capacity</span>)
|
298
|
+
<span class="ruby-ivar">@page_ids</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">IdGenerator</span><span class="ruby-operator">::</span><span class="ruby-constant">Sequential</span>.<span class="ruby-identifier">new</span>
|
299
|
+
<span class="ruby-ivar">@current_page</span> = <span class="ruby-keyword kw">nil</span>
|
300
|
+
|
301
|
+
<span class="ruby-ivar">@running</span> = <span class="ruby-keyword kw">true</span>
|
302
|
+
|
303
|
+
<span class="ruby-ivar">@expire_after</span> = <span class="ruby-value">30</span><span class="ruby-operator">*</span><span class="ruby-value">60</span>
|
304
|
+
<span class="ruby-ivar">@max_lifetime</span> = <span class="ruby-keyword kw">nil</span>
|
305
|
+
<span class="ruby-ivar">@max_requests</span> = <span class="ruby-keyword kw">nil</span>
|
306
|
+
|
307
|
+
<span class="ruby-ivar">@last_access</span> = <span class="ruby-ivar">@creation_time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
308
|
+
<span class="ruby-ivar">@request_count</span> = <span class="ruby-value">0</span>
|
309
|
+
|
310
|
+
<span class="ruby-ivar">@serializer</span> = <span class="ruby-identifier">serializer</span> <span class="ruby-operator">||</span> <span class="ruby-constant">MutexSerializer</span>.<span class="ruby-identifier">new</span>
|
311
|
+
<span class="ruby-keyword kw">end</span>
|
199
312
|
</pre>
|
200
313
|
</div>
|
314
|
+
|
201
315
|
</div>
|
202
316
|
</div>
|
203
317
|
|
204
318
|
|
205
|
-
|
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
|
-
|
319
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
214
320
|
|
215
321
|
|
216
|
-
|
322
|
+
<div id="method-M000022" class="method-detail">
|
323
|
+
<a name="M000022"></a>
|
217
324
|
|
325
|
+
<div class="method-heading">
|
218
326
|
|
219
|
-
|
220
|
-
<div id="methods">
|
221
|
-
<h3 class="section-bar">Public Class methods</h3>
|
327
|
+
<a href="#M000022" class="method-signature">
|
222
328
|
|
223
|
-
|
224
|
-
<a name="M000279"></a>
|
329
|
+
<span class="method-name">alive?</span><span class="method-args">()</span>
|
225
330
|
|
226
|
-
<div class="method-heading">
|
227
|
-
<a href="#M000279" class="method-signature">
|
228
|
-
<span class="method-name">new</span><span class="method-args">(&block)</span>
|
229
331
|
</a>
|
332
|
+
|
230
333
|
</div>
|
231
|
-
|
334
|
+
|
232
335
|
<div class="method-description">
|
336
|
+
|
337
|
+
<p>
|
338
|
+
Queries whether the session is still alive.
|
339
|
+
</p>
|
340
|
+
|
233
341
|
<p><a class="source-toggle" href="#"
|
234
|
-
onclick="toggleCode('
|
235
|
-
<div class="method-source-code" id="
|
342
|
+
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
343
|
+
<div class="method-source-code" id="M000022-source">
|
236
344
|
<pre>
|
237
|
-
<span class="ruby-comment cmt"># File lib/wee/
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
345
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 126</span>
|
346
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">alive?</span>
|
347
|
+
<span class="ruby-identifier">now</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
348
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@running</span>
|
349
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@expire_after</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">now</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@last_access</span> <span class="ruby-operator">></span> <span class="ruby-ivar">@expire_after</span>
|
350
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@max_lifetime</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">now</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@creation_time</span> <span class="ruby-operator">></span> <span class="ruby-ivar">@max_lifetime</span>
|
351
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@max_requests</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@request_count</span> <span class="ruby-operator">>=</span> <span class="ruby-ivar">@max_requests</span>
|
352
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
353
|
+
<span class="ruby-keyword kw">end</span>
|
244
354
|
</pre>
|
245
355
|
</div>
|
356
|
+
|
246
357
|
</div>
|
247
358
|
</div>
|
248
359
|
|
249
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
250
360
|
|
251
|
-
<div id="method-
|
252
|
-
<a name="
|
361
|
+
<div id="method-M000026" class="method-detail">
|
362
|
+
<a name="M000026"></a>
|
253
363
|
|
254
364
|
<div class="method-heading">
|
255
|
-
|
256
|
-
<
|
365
|
+
|
366
|
+
<a href="#M000026" class="method-signature">
|
367
|
+
|
368
|
+
<span class="method-name">call</span><span class="method-args">(env)</span>
|
369
|
+
|
257
370
|
</a>
|
371
|
+
|
258
372
|
</div>
|
259
|
-
|
260
|
-
<div class="method-description">
|
261
|
-
<p><a class="source-toggle" href="#"
|
262
|
-
onclick="toggleCode('M000280-source');return false;">[Source]</a></p>
|
263
|
-
<div class="method-source-code" id="M000280-source">
|
264
|
-
<pre>
|
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
373
|
|
285
|
-
<
|
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>
|
374
|
+
<div class="method-description">
|
287
375
|
|
288
|
-
|
376
|
+
<p>
|
377
|
+
Handles a web request.
|
378
|
+
</p>
|
289
379
|
|
380
|
+
<p><a class="source-toggle" href="#"
|
381
|
+
onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
|
382
|
+
<div class="method-source-code" id="M000026-source">
|
383
|
+
<pre>
|
384
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 166</span>
|
385
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
|
386
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">'wee.session'</span>]
|
387
|
+
<span class="ruby-comment cmt"># we are already serialized</span>
|
388
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">env</span>[<span class="ruby-value str">'wee.session'</span>] <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">self</span>
|
290
389
|
<span class="ruby-keyword kw">begin</span>
|
390
|
+
<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>
|
391
|
+
<span class="ruby-ivar">@request_count</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
392
|
+
<span class="ruby-ivar">@last_access</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
291
393
|
<span class="ruby-identifier">awake</span>
|
292
|
-
<span class="ruby-identifier">
|
394
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-identifier">handle</span>(<span class="ruby-identifier">env</span>)
|
293
395
|
<span class="ruby-identifier">sleep</span>
|
294
|
-
|
295
|
-
|
396
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
|
397
|
+
<span class="ruby-keyword kw">ensure</span>
|
398
|
+
<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>
|
296
399
|
<span class="ruby-keyword kw">end</span>
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
400
|
+
<span class="ruby-keyword kw">else</span>
|
401
|
+
<span class="ruby-identifier">env</span>[<span class="ruby-value str">'wee.session'</span>] = <span class="ruby-keyword kw">self</span>
|
402
|
+
<span class="ruby-ivar">@serializer</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
|
403
|
+
<span class="ruby-keyword kw">end</span>
|
404
|
+
<span class="ruby-keyword kw">end</span>
|
302
405
|
</pre>
|
303
406
|
</div>
|
407
|
+
|
304
408
|
</div>
|
305
409
|
</div>
|
306
410
|
|
307
|
-
<h3 class="section-bar">Protected Instance methods</h3>
|
308
411
|
|
309
|
-
<div id="method-
|
310
|
-
<a name="
|
412
|
+
<div id="method-M000023" class="method-detail">
|
413
|
+
<a name="M000023"></a>
|
311
414
|
|
312
415
|
<div class="method-heading">
|
313
|
-
|
314
|
-
<
|
416
|
+
|
417
|
+
<a href="#M000023" class="method-signature">
|
418
|
+
|
419
|
+
<span class="method-name">dead?</span><span class="method-args">()</span>
|
420
|
+
|
315
421
|
</a>
|
422
|
+
|
316
423
|
</div>
|
317
|
-
|
424
|
+
|
318
425
|
<div class="method-description">
|
426
|
+
|
319
427
|
<p>
|
320
|
-
|
321
|
-
snapshot assigned.
|
428
|
+
Queries whether the session is dead.
|
322
429
|
</p>
|
323
|
-
<p><a class="source-toggle" href="#"
|
324
|
-
onclick="toggleCode('M000278-source');return false;">[Source]</a></p>
|
325
|
-
<div class="method-source-code" id="M000278-source">
|
326
|
-
<pre>
|
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>))
|
331
|
-
<span class="ruby-keyword kw">end</span>
|
332
|
-
</pre>
|
333
|
-
</div>
|
334
|
-
</div>
|
335
|
-
</div>
|
336
430
|
|
337
|
-
<div id="method-M000273" class="method-detail">
|
338
|
-
<a name="M000273"></a>
|
339
|
-
|
340
|
-
<div class="method-heading">
|
341
|
-
<a href="#M000273" class="method-signature">
|
342
|
-
<span class="method-name">handle_callback_phase</span><span class="method-args">()</span>
|
343
|
-
</a>
|
344
|
-
</div>
|
345
|
-
|
346
|
-
<div class="method-description">
|
347
431
|
<p><a class="source-toggle" href="#"
|
348
|
-
onclick="toggleCode('
|
349
|
-
<div class="method-source-code" id="
|
432
|
+
onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
|
433
|
+
<div class="method-source-code" id="M000023-source">
|
350
434
|
<pre>
|
351
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
352
|
-
|
353
|
-
|
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>)
|
435
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 138</span>
|
436
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dead?</span>
|
437
|
+
<span class="ruby-keyword kw">not</span> <span class="ruby-identifier">alive?</span>
|
373
438
|
<span class="ruby-keyword kw">end</span>
|
374
|
-
<span class="ruby-keyword kw">end</span>
|
375
439
|
</pre>
|
376
440
|
</div>
|
441
|
+
|
377
442
|
</div>
|
378
443
|
</div>
|
379
444
|
|
380
|
-
|
381
|
-
|
445
|
+
|
446
|
+
<div id="method-M000031" class="method-detail">
|
447
|
+
<a name="M000031"></a>
|
382
448
|
|
383
449
|
<div class="method-heading">
|
384
|
-
|
385
|
-
<
|
450
|
+
|
451
|
+
<a href="#M000031" class="method-signature">
|
452
|
+
|
453
|
+
<span class="method-name">render_ajax_proc</span><span class="method-args">(block, component)</span>
|
454
|
+
|
386
455
|
</a>
|
456
|
+
|
387
457
|
</div>
|
388
|
-
|
458
|
+
|
389
459
|
<div class="method-description">
|
460
|
+
|
390
461
|
<p><a class="source-toggle" href="#"
|
391
|
-
onclick="toggleCode('
|
392
|
-
<div class="method-source-code" id="
|
462
|
+
onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
|
463
|
+
<div class="method-source-code" id="M000031-source">
|
393
464
|
<pre>
|
394
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
395
|
-
|
396
|
-
|
465
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 252</span>
|
466
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render_ajax_proc</span>(<span class="ruby-identifier">block</span>, <span class="ruby-identifier">component</span>)
|
467
|
+
<span class="ruby-identifier">proc</span> {
|
468
|
+
<span class="ruby-identifier">r</span> = <span class="ruby-identifier">component</span>.<span class="ruby-identifier">renderer_class</span>.<span class="ruby-identifier">new</span>
|
469
|
+
<span class="ruby-identifier">r</span>.<span class="ruby-identifier">session</span> = <span class="ruby-keyword kw">self</span>
|
470
|
+
<span class="ruby-identifier">r</span>.<span class="ruby-identifier">request</span> = <span class="ruby-ivar">@request</span>
|
471
|
+
<span class="ruby-identifier">r</span>.<span class="ruby-identifier">response</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">Response</span>.<span class="ruby-identifier">new</span>
|
472
|
+
<span class="ruby-identifier">r</span>.<span class="ruby-identifier">document</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">HtmlDocument</span>.<span class="ruby-identifier">new</span>
|
473
|
+
<span class="ruby-identifier">r</span>.<span class="ruby-identifier">callbacks</span> = <span class="ruby-ivar">@page</span>.<span class="ruby-identifier">callbacks</span>
|
474
|
+
<span class="ruby-identifier">r</span>.<span class="ruby-identifier">current_component</span> = <span class="ruby-identifier">component</span>
|
397
475
|
|
398
|
-
|
476
|
+
<span class="ruby-keyword kw">begin</span>
|
477
|
+
<span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">r</span>)
|
478
|
+
<span class="ruby-keyword kw">ensure</span>
|
479
|
+
<span class="ruby-identifier">r</span>.<span class="ruby-identifier">close</span>
|
480
|
+
<span class="ruby-keyword kw">end</span>
|
399
481
|
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
<span class="ruby-identifier">handle_callback_phase</span>
|
482
|
+
<span class="ruby-identifier">r</span>.<span class="ruby-identifier">response</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">document</span>.<span class="ruby-identifier">to_s</span>
|
483
|
+
<span class="ruby-identifier">send_response</span>(<span class="ruby-identifier">r</span>.<span class="ruby-identifier">response</span>)
|
484
|
+
}
|
404
485
|
<span class="ruby-keyword kw">end</span>
|
405
|
-
<span class="ruby-keyword kw">end</span>
|
406
486
|
</pre>
|
407
487
|
</div>
|
488
|
+
|
408
489
|
</div>
|
409
490
|
</div>
|
410
491
|
|
411
|
-
|
412
|
-
|
492
|
+
|
493
|
+
<div id="method-M000027" class="method-detail">
|
494
|
+
<a name="M000027"></a>
|
413
495
|
|
414
496
|
<div class="method-heading">
|
415
|
-
<a href="#M000271" class="method-signature">
|
416
|
-
<span class="method-name">handle_invalid_page</span><span class="method-args">()</span>
|
417
|
-
</a>
|
418
|
-
</div>
|
419
|
-
|
420
|
-
<div class="method-description">
|
421
|
-
<p><a class="source-toggle" href="#"
|
422
|
-
onclick="toggleCode('M000271-source');return false;">[Source]</a></p>
|
423
|
-
<div class="method-source-code" id="M000271-source">
|
424
|
-
<pre>
|
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>
|
430
|
-
<span class="ruby-keyword kw">end</span>
|
431
|
-
</pre>
|
432
|
-
</div>
|
433
|
-
</div>
|
434
|
-
</div>
|
435
497
|
|
436
|
-
|
437
|
-
|
498
|
+
<a href="#M000027" class="method-signature">
|
499
|
+
|
500
|
+
<span class="method-name">send_response</span><span class="method-args">(response)</span>
|
438
501
|
|
439
|
-
<div class="method-heading">
|
440
|
-
<a href="#M000269" class="method-signature">
|
441
|
-
<span class="method-name">handle_new_page</span><span class="method-args">()</span>
|
442
502
|
</a>
|
503
|
+
|
443
504
|
</div>
|
444
|
-
|
505
|
+
|
445
506
|
<div class="method-description">
|
507
|
+
|
508
|
+
<p>
|
509
|
+
Send a premature response
|
510
|
+
</p>
|
511
|
+
|
446
512
|
<p><a class="source-toggle" href="#"
|
447
|
-
onclick="toggleCode('
|
448
|
-
<div class="method-source-code" id="
|
513
|
+
onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
|
514
|
+
<div class="method-source-code" id="M000027-source">
|
449
515
|
<pre>
|
450
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
451
|
-
|
452
|
-
|
453
|
-
|
516
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 190</span>
|
517
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_response</span>(<span class="ruby-identifier">response</span>)
|
518
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">AbortCallbackProcessing</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">response</span>)
|
519
|
+
<span class="ruby-keyword kw">end</span>
|
454
520
|
</pre>
|
455
521
|
</div>
|
522
|
+
|
456
523
|
</div>
|
457
524
|
</div>
|
458
525
|
|
459
|
-
|
460
|
-
|
526
|
+
|
527
|
+
<div id="method-M000024" class="method-detail">
|
528
|
+
<a name="M000024"></a>
|
461
529
|
|
462
530
|
<div class="method-heading">
|
463
|
-
|
464
|
-
<
|
531
|
+
|
532
|
+
<a href="#M000024" class="method-signature">
|
533
|
+
|
534
|
+
<span class="method-name">statistics</span><span class="method-args">()</span>
|
535
|
+
|
465
536
|
</a>
|
537
|
+
|
466
538
|
</div>
|
467
|
-
|
539
|
+
|
468
540
|
<div class="method-description">
|
541
|
+
|
542
|
+
<p>
|
543
|
+
Returns some statistics
|
544
|
+
</p>
|
545
|
+
|
469
546
|
<p><a class="source-toggle" href="#"
|
470
|
-
onclick="toggleCode('
|
471
|
-
<div class="method-source-code" id="
|
547
|
+
onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
|
548
|
+
<div class="method-source-code" id="M000024-source">
|
472
549
|
<pre>
|
473
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
550
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 145</span>
|
551
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">statistics</span>
|
552
|
+
<span class="ruby-identifier">now</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
553
|
+
{
|
554
|
+
<span class="ruby-identifier">:last_access</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@last_access</span>, <span class="ruby-comment cmt"># The time when this session was last accessed</span>
|
555
|
+
<span class="ruby-identifier">:inactivity</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">now</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@last_access</span>, <span class="ruby-comment cmt"># The number of seconds of inactivity</span>
|
556
|
+
<span class="ruby-identifier">:creation_time</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@creation_time</span>, <span class="ruby-comment cmt"># The time at which this session was created </span>
|
557
|
+
<span class="ruby-identifier">:lifetime</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">now</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@creation_time</span>, <span class="ruby-comment cmt"># The lifetime of this session in seconds</span>
|
558
|
+
<span class="ruby-identifier">:request_count</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@request_count</span> <span class="ruby-comment cmt"># The number of requests served by this session</span>
|
559
|
+
}
|
560
|
+
<span class="ruby-keyword kw">end</span>
|
482
561
|
</pre>
|
483
562
|
</div>
|
563
|
+
|
484
564
|
</div>
|
485
565
|
</div>
|
486
566
|
|
487
|
-
|
488
|
-
|
567
|
+
|
568
|
+
<div id="method-M000021" class="method-detail">
|
569
|
+
<a name="M000021"></a>
|
489
570
|
|
490
571
|
<div class="method-heading">
|
491
|
-
|
492
|
-
<
|
572
|
+
|
573
|
+
<a href="#M000021" class="method-signature">
|
574
|
+
|
575
|
+
<span class="method-name">terminate</span><span class="method-args">()</span>
|
576
|
+
|
493
577
|
</a>
|
578
|
+
|
494
579
|
</div>
|
495
|
-
|
580
|
+
|
496
581
|
<div class="method-description">
|
582
|
+
|
583
|
+
<p>
|
584
|
+
Terminates the session.
|
585
|
+
</p>
|
586
|
+
<p>
|
587
|
+
This will usually not immediatly terminate the session from running, but
|
588
|
+
further requests will not be answered.
|
589
|
+
</p>
|
590
|
+
|
497
591
|
<p><a class="source-toggle" href="#"
|
498
|
-
onclick="toggleCode('
|
499
|
-
<div class="method-source-code" id="
|
592
|
+
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
593
|
+
<div class="method-source-code" id="M000021-source">
|
500
594
|
<pre>
|
501
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
502
|
-
|
503
|
-
|
504
|
-
<span class="ruby-
|
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>
|
513
|
-
<span class="ruby-keyword kw">end</span>
|
595
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 119</span>
|
596
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">terminate</span>
|
597
|
+
<span class="ruby-ivar">@running</span> = <span class="ruby-keyword kw">false</span>
|
598
|
+
<span class="ruby-keyword kw">end</span>
|
514
599
|
</pre>
|
515
600
|
</div>
|
601
|
+
|
516
602
|
</div>
|
517
603
|
</div>
|
518
604
|
|
519
|
-
|
520
|
-
|
605
|
+
|
606
|
+
<h3 class="section-bar">Protected Instance methods</h3>
|
607
|
+
|
608
|
+
|
609
|
+
<div id="method-M000033" class="method-detail">
|
610
|
+
<a name="M000033"></a>
|
521
611
|
|
522
612
|
<div class="method-heading">
|
523
|
-
|
524
|
-
<
|
613
|
+
|
614
|
+
<a href="#M000033" class="method-signature">
|
615
|
+
|
616
|
+
<span class="method-name">action</span><span class="method-args">(request, page)</span>
|
617
|
+
|
525
618
|
</a>
|
619
|
+
|
526
620
|
</div>
|
527
|
-
|
621
|
+
|
528
622
|
<div class="method-description">
|
623
|
+
|
529
624
|
<p><a class="source-toggle" href="#"
|
530
|
-
onclick="toggleCode('
|
531
|
-
<div class="method-source-code" id="
|
625
|
+
onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
|
626
|
+
<div class="method-source-code" id="M000033-source">
|
532
627
|
<pre>
|
533
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
534
|
-
|
535
|
-
|
628
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 295</span>
|
629
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">action</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">page</span>)
|
630
|
+
<span class="ruby-ivar">@current_page</span> = <span class="ruby-keyword kw">nil</span>
|
631
|
+
|
632
|
+
<span class="ruby-keyword kw">begin</span>
|
633
|
+
<span class="ruby-ivar">@page</span> = <span class="ruby-identifier">page</span> <span class="ruby-comment cmt"># CONTINUATIONS!</span>
|
634
|
+
<span class="ruby-identifier">page</span>.<span class="ruby-identifier">callbacks</span>.<span class="ruby-identifier">with_triggered</span>(<span class="ruby-identifier">request</span>.<span class="ruby-identifier">fields</span>) <span class="ruby-keyword kw">do</span>
|
635
|
+
<span class="ruby-ivar">@root_component</span>.<span class="ruby-identifier">decoration</span>.<span class="ruby-identifier">process_callbacks</span>(<span class="ruby-identifier">page</span>.<span class="ruby-identifier">callbacks</span>)
|
636
|
+
<span class="ruby-keyword kw">end</span>
|
637
|
+
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">AbortCallbackProcessing</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">abort</span>
|
638
|
+
<span class="ruby-identifier">page</span> = <span class="ruby-ivar">@page</span> <span class="ruby-comment cmt"># CONTINUATIONS!</span>
|
639
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">abort</span>.<span class="ruby-identifier">response</span>
|
640
|
+
<span class="ruby-comment cmt">#</span>
|
641
|
+
<span class="ruby-comment cmt"># replace the state of the current page</span>
|
642
|
+
<span class="ruby-comment cmt">#</span>
|
643
|
+
<span class="ruby-ivar">@current_page</span> = <span class="ruby-identifier">page</span>
|
644
|
+
<span class="ruby-identifier">page</span>.<span class="ruby-identifier">state</span> = <span class="ruby-identifier">take_snapshot</span>()
|
645
|
+
<span class="ruby-ivar">@page_cache</span>[<span class="ruby-identifier">page</span>.<span class="ruby-identifier">id</span>] = <span class="ruby-identifier">page</span>
|
646
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">abort</span>.<span class="ruby-identifier">response</span>
|
647
|
+
<span class="ruby-keyword kw">else</span>
|
648
|
+
<span class="ruby-comment cmt"># pass on - this is a premature response from Component#call</span>
|
649
|
+
<span class="ruby-keyword kw">end</span>
|
650
|
+
<span class="ruby-keyword kw">end</span>
|
651
|
+
<span class="ruby-identifier">request</span> = <span class="ruby-ivar">@request</span> <span class="ruby-comment cmt"># CONTINUATIONS!</span>
|
652
|
+
|
653
|
+
<span class="ruby-comment cmt">#</span>
|
654
|
+
<span class="ruby-comment cmt"># create new page (state)</span>
|
655
|
+
<span class="ruby-comment cmt">#</span>
|
656
|
+
<span class="ruby-identifier">new_page</span> = <span class="ruby-constant">Page</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@page_ids</span>.<span class="ruby-identifier">next</span>, <span class="ruby-identifier">take_snapshot</span>(), <span class="ruby-keyword kw">nil</span>)
|
657
|
+
<span class="ruby-ivar">@page_cache</span>[<span class="ruby-identifier">new_page</span>.<span class="ruby-identifier">id</span>] = <span class="ruby-identifier">new_page</span>
|
658
|
+
<span class="ruby-ivar">@current_page</span> = <span class="ruby-identifier">new_page</span>
|
659
|
+
|
660
|
+
<span class="ruby-identifier">url</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</span>.<span class="ruby-identifier">id</span>)
|
661
|
+
<span class="ruby-keyword kw">return</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">url</span>)
|
662
|
+
<span class="ruby-keyword kw">end</span>
|
536
663
|
</pre>
|
537
664
|
</div>
|
665
|
+
|
538
666
|
</div>
|
539
667
|
</div>
|
540
668
|
|
541
|
-
|
542
|
-
|
669
|
+
|
670
|
+
<div id="method-M000028" class="method-detail">
|
671
|
+
<a name="M000028"></a>
|
543
672
|
|
544
673
|
<div class="method-heading">
|
545
|
-
|
546
|
-
<
|
674
|
+
|
675
|
+
<a href="#M000028" class="method-signature">
|
676
|
+
|
677
|
+
<span class="method-name">awake</span><span class="method-args">()</span>
|
678
|
+
|
547
679
|
</a>
|
680
|
+
|
548
681
|
</div>
|
549
|
-
|
682
|
+
|
550
683
|
<div class="method-description">
|
684
|
+
|
685
|
+
<p>
|
686
|
+
Is called before <em>process_request</em> is invoked.
|
687
|
+
</p>
|
688
|
+
<p>
|
689
|
+
Can be used e.g. to setup a database connection.
|
690
|
+
</p>
|
691
|
+
|
551
692
|
<p><a class="source-toggle" href="#"
|
552
|
-
onclick="toggleCode('
|
553
|
-
<div class="method-source-code" id="
|
693
|
+
onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
|
694
|
+
<div class="method-source-code" id="M000028-source">
|
554
695
|
<pre>
|
555
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
556
|
-
|
557
|
-
|
696
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 201</span>
|
697
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">awake</span>
|
698
|
+
<span class="ruby-keyword kw">end</span>
|
558
699
|
</pre>
|
559
700
|
</div>
|
701
|
+
|
560
702
|
</div>
|
561
703
|
</div>
|
562
704
|
|
563
|
-
|
564
|
-
|
705
|
+
|
706
|
+
<div id="method-M000030" class="method-detail">
|
707
|
+
<a name="M000030"></a>
|
565
708
|
|
566
709
|
<div class="method-heading">
|
567
|
-
|
568
|
-
<
|
710
|
+
|
711
|
+
<a href="#M000030" class="method-signature">
|
712
|
+
|
713
|
+
<span class="method-name">handle</span><span class="method-args">(env)</span>
|
714
|
+
|
569
715
|
</a>
|
716
|
+
|
570
717
|
</div>
|
571
|
-
|
718
|
+
|
572
719
|
<div class="method-description">
|
720
|
+
|
573
721
|
<p>
|
574
722
|
The main routine where the request is processed.
|
575
723
|
</p>
|
724
|
+
|
576
725
|
<p><a class="source-toggle" href="#"
|
577
|
-
onclick="toggleCode('
|
578
|
-
<div class="method-source-code" id="
|
726
|
+
onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
|
727
|
+
<div class="method-source-code" id="M000030-source">
|
579
728
|
<pre>
|
580
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
581
|
-
|
582
|
-
|
729
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 215</span>
|
730
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle</span>(<span class="ruby-identifier">env</span>)
|
731
|
+
<span class="ruby-identifier">request</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">env</span>)
|
732
|
+
<span class="ruby-ivar">@request</span> = <span class="ruby-identifier">request</span> <span class="ruby-comment cmt"># CONTINUATIONS!</span>
|
733
|
+
<span class="ruby-identifier">page</span> = <span class="ruby-ivar">@page_cache</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">request</span>.<span class="ruby-identifier">page_id</span>)
|
734
|
+
|
735
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">page</span>
|
736
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">page</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@current_page</span>
|
737
|
+
<span class="ruby-ivar">@current_page</span> = <span class="ruby-keyword kw">nil</span>
|
738
|
+
<span class="ruby-identifier">page</span>.<span class="ruby-identifier">state</span>.<span class="ruby-identifier">restore</span>
|
739
|
+
<span class="ruby-ivar">@current_page</span> = <span class="ruby-identifier">page</span>
|
740
|
+
<span class="ruby-keyword kw">end</span>
|
741
|
+
|
742
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">render?</span>
|
743
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">render</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">page</span>).<span class="ruby-identifier">finish</span>
|
744
|
+
<span class="ruby-keyword kw">else</span> <span class="ruby-comment cmt"># request.action?</span>
|
745
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">action</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">page</span>).<span class="ruby-identifier">finish</span>
|
746
|
+
<span class="ruby-keyword kw">end</span>
|
747
|
+
<span class="ruby-keyword kw">else</span>
|
748
|
+
<span class="ruby-comment cmt">#</span>
|
749
|
+
<span class="ruby-comment cmt"># either no or invalid page_id specified. reset to initial state (or</span>
|
750
|
+
<span class="ruby-comment cmt"># create initial state if no such exists yet)</span>
|
751
|
+
<span class="ruby-comment cmt">#</span>
|
752
|
+
<span class="ruby-ivar">@initial_state</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">take_snapshot</span>()
|
753
|
+
<span class="ruby-identifier">new_page</span> = <span class="ruby-constant">Page</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@page_ids</span>.<span class="ruby-identifier">next</span>, <span class="ruby-ivar">@initial_state</span>, <span class="ruby-keyword kw">nil</span>)
|
754
|
+
<span class="ruby-ivar">@page_cache</span>[<span class="ruby-identifier">new_page</span>.<span class="ruby-identifier">id</span>] = <span class="ruby-identifier">new_page</span>
|
755
|
+
|
756
|
+
<span class="ruby-identifier">url</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</span>.<span class="ruby-identifier">id</span>)
|
757
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">page_id</span>
|
758
|
+
<span class="ruby-keyword kw">return</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 page"</span>, <span class="ruby-identifier">url</span>).<span class="ruby-identifier">finish</span>
|
759
|
+
<span class="ruby-keyword kw">else</span>
|
760
|
+
<span class="ruby-keyword kw">return</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">url</span>).<span class="ruby-identifier">finish</span>
|
761
|
+
<span class="ruby-keyword kw">end</span>
|
762
|
+
<span class="ruby-keyword kw">end</span>
|
763
|
+
<span class="ruby-keyword kw">ensure</span>
|
764
|
+
<span class="ruby-ivar">@request</span> = <span class="ruby-keyword kw">nil</span>
|
765
|
+
<span class="ruby-keyword kw">end</span>
|
766
|
+
</pre>
|
767
|
+
</div>
|
583
768
|
|
584
|
-
|
585
|
-
|
769
|
+
</div>
|
770
|
+
</div>
|
586
771
|
|
587
|
-
<span class="ruby-identifier">handle_new_page</span>
|
588
772
|
|
589
|
-
|
773
|
+
<div id="method-M000032" class="method-detail">
|
774
|
+
<a name="M000032"></a>
|
590
775
|
|
591
|
-
|
776
|
+
<div class="method-heading">
|
592
777
|
|
593
|
-
|
778
|
+
<a href="#M000032" class="method-signature">
|
594
779
|
|
595
|
-
|
780
|
+
<span class="method-name">render</span><span class="method-args">(request, page)</span>
|
781
|
+
|
782
|
+
</a>
|
596
783
|
|
597
|
-
|
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>
|
784
|
+
</div>
|
600
785
|
|
601
|
-
|
786
|
+
<div class="method-description">
|
602
787
|
|
788
|
+
<p><a class="source-toggle" href="#"
|
789
|
+
onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
|
790
|
+
<div class="method-source-code" id="M000032-source">
|
791
|
+
<pre>
|
792
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 275</span>
|
793
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">page</span>)
|
794
|
+
<span class="ruby-identifier">r</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">Renderer</span>.<span class="ruby-identifier">new</span>
|
795
|
+
<span class="ruby-identifier">r</span>.<span class="ruby-identifier">session</span> = <span class="ruby-keyword kw">self</span>
|
796
|
+
<span class="ruby-identifier">r</span>.<span class="ruby-identifier">request</span> = <span class="ruby-identifier">request</span>
|
797
|
+
<span class="ruby-identifier">r</span>.<span class="ruby-identifier">response</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">GenericResponse</span>.<span class="ruby-identifier">new</span>
|
798
|
+
<span class="ruby-identifier">r</span>.<span class="ruby-identifier">document</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">HtmlDocument</span>.<span class="ruby-identifier">new</span>
|
799
|
+
<span class="ruby-identifier">r</span>.<span class="ruby-identifier">callbacks</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">Callbacks</span>.<span class="ruby-identifier">new</span>
|
800
|
+
|
801
|
+
<span class="ruby-keyword kw">begin</span>
|
802
|
+
<span class="ruby-ivar">@root_component</span>.<span class="ruby-identifier">decoration</span>.<span class="ruby-identifier">render_on</span>(<span class="ruby-identifier">r</span>)
|
803
|
+
<span class="ruby-keyword kw">ensure</span>
|
804
|
+
<span class="ruby-identifier">r</span>.<span class="ruby-identifier">close</span>
|
805
|
+
<span class="ruby-keyword kw">end</span>
|
806
|
+
|
807
|
+
<span class="ruby-identifier">r</span>.<span class="ruby-identifier">response</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">document</span>.<span class="ruby-identifier">to_s</span>
|
808
|
+
|
809
|
+
<span class="ruby-identifier">page</span>.<span class="ruby-identifier">callbacks</span> = <span class="ruby-identifier">r</span>.<span class="ruby-identifier">callbacks</span>
|
810
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">response</span>
|
603
811
|
<span class="ruby-keyword kw">end</span>
|
604
|
-
<span class="ruby-keyword kw">end</span>
|
605
812
|
</pre>
|
606
813
|
</div>
|
814
|
+
|
607
815
|
</div>
|
608
816
|
</div>
|
609
817
|
|
610
|
-
|
611
|
-
|
818
|
+
|
819
|
+
<div id="method-M000029" class="method-detail">
|
820
|
+
<a name="M000029"></a>
|
612
821
|
|
613
822
|
<div class="method-heading">
|
614
|
-
|
615
|
-
<
|
823
|
+
|
824
|
+
<a href="#M000029" class="method-signature">
|
825
|
+
|
826
|
+
<span class="method-name">sleep</span><span class="method-args">()</span>
|
827
|
+
|
616
828
|
</a>
|
829
|
+
|
617
830
|
</div>
|
618
|
-
|
831
|
+
|
619
832
|
<div class="method-description">
|
833
|
+
|
834
|
+
<p>
|
835
|
+
Is called after <em>process_request</em> is run.
|
836
|
+
</p>
|
837
|
+
<p>
|
838
|
+
Can be used e.g. to release a database connection.
|
839
|
+
</p>
|
840
|
+
|
620
841
|
<p><a class="source-toggle" href="#"
|
621
|
-
onclick="toggleCode('
|
622
|
-
<div class="method-source-code" id="
|
842
|
+
onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
|
843
|
+
<div class="method-source-code" id="M000029-source">
|
623
844
|
<pre>
|
624
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
625
|
-
|
626
|
-
<span class="ruby-
|
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>))
|
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>)
|
630
|
-
<span class="ruby-keyword kw">end</span>
|
845
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 209</span>
|
846
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sleep</span>
|
847
|
+
<span class="ruby-keyword kw">end</span>
|
631
848
|
</pre>
|
632
849
|
</div>
|
850
|
+
|
633
851
|
</div>
|
634
852
|
</div>
|
635
853
|
|
636
|
-
|
637
|
-
|
854
|
+
|
855
|
+
<div id="method-M000034" class="method-detail">
|
856
|
+
<a name="M000034"></a>
|
638
857
|
|
639
858
|
<div class="method-heading">
|
640
|
-
|
641
|
-
<
|
859
|
+
|
860
|
+
<a href="#M000034" class="method-signature">
|
861
|
+
|
862
|
+
<span class="method-name">take_snapshot</span><span class="method-args">()</span>
|
863
|
+
|
642
864
|
</a>
|
865
|
+
|
643
866
|
</div>
|
644
|
-
|
867
|
+
|
645
868
|
<div class="method-description">
|
869
|
+
|
870
|
+
<p>
|
871
|
+
This method takes a snapshot from the current state of the root component
|
872
|
+
and returns it.
|
873
|
+
</p>
|
874
|
+
|
646
875
|
<p><a class="source-toggle" href="#"
|
647
|
-
onclick="toggleCode('
|
648
|
-
<div class="method-source-code" id="
|
876
|
+
onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
|
877
|
+
<div class="method-source-code" id="M000034-source">
|
649
878
|
<pre>
|
650
|
-
<span class="ruby-comment cmt"># File lib/wee/session.rb, line
|
651
|
-
|
652
|
-
|
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>
|
879
|
+
<span class="ruby-comment cmt"># File lib/wee/session.rb, line 334</span>
|
880
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">take_snapshot</span>
|
881
|
+
<span class="ruby-ivar">@root_component</span>.<span class="ruby-identifier">decoration</span>.<span class="ruby-identifier">backtrack</span>(<span class="ruby-identifier">state</span> = <span class="ruby-constant">Wee</span><span class="ruby-operator">::</span><span class="ruby-constant">State</span>.<span class="ruby-identifier">new</span>)
|
882
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">state</span>.<span class="ruby-identifier">freeze</span>
|
660
883
|
<span class="ruby-keyword kw">end</span>
|
661
|
-
<span class="ruby-keyword kw">end</span>
|
662
884
|
</pre>
|
663
885
|
</div>
|
886
|
+
|
664
887
|
</div>
|
665
888
|
</div>
|
666
889
|
|
667
890
|
|
891
|
+
|
668
892
|
</div>
|
669
893
|
|
670
894
|
|
671
|
-
</div>
|
672
895
|
|
673
896
|
|
897
|
+
</div>
|
898
|
+
|
674
899
|
<div id="validator-badges">
|
675
900
|
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
676
901
|
</div>
|
677
902
|
|
678
903
|
</body>
|
679
|
-
</html>
|
904
|
+
</html>
|