Class: Wee::PagelessSession
- Inherits:
-
Session
- Object
- RequestHandler
- AbstractSession
- Session
- Wee::PagelessSession
- Defined in:
- lib/wee/pageless/session.rb
Overview
A session class, which does not have a page-store and as such cannot backtrack.
Instance Attribute Summary collapse
-
#callbacks ⇒ Object
(also: #current_callbacks)
Returns the value of attribute callbacks.
Attributes inherited from Session
#component_runner, #page_store
Attributes inherited from RequestHandler
#application, #expire_after, #id, #max_lifetime, #max_requests
Instance Method Summary collapse
- #handle_callback_phase ⇒ Object
- #handle_existing_page ⇒ Object
- #handle_render_phase ⇒ Object
-
#process_request ⇒ Object
The main routine where the request is processed.
- #setup(&block) ⇒ Object
Methods inherited from Session
#initialize, #start_request_response_loop
Methods inherited from AbstractSession
current, #current_context, #get_property, #handle_request, #initialize, #properties, #properties=
Methods inherited from RequestHandler
#alive?, #handle_request, #initialize, #statistics, #teminate
Constructor Details
This class inherits a constructor from Wee::Session
Instance Attribute Details
#callbacks ⇒ Object Also known as: current_callbacks
Returns the value of attribute callbacks.
10 11 12 |
# File 'lib/wee/pageless/session.rb', line 10 def callbacks @callbacks end |
Instance Method Details
#handle_callback_phase ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/wee/pageless/session.rb', line 42 def handle_callback_phase # Actions/inputs were specified. # # We process the request and invoke actions/inputs. Then we generate a # new page view. callback_stream = Wee::CallbackStream.new(self.callbacks, @context.request.fields) send_response = @component_runner.process_callbacks(callback_stream) post_callbacks_hook() if send_response set_response(@context, send_response) # @context.response = send_response else handle_new_page_view(@context) end end |
#handle_existing_page ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/wee/pageless/session.rb', line 26 def handle_existing_page p @context.request.fields if $DEBUG if @context.request.render? handle_render_phase else handle_callback_phase end end |
#handle_render_phase ⇒ Object
36 37 38 39 40 |
# File 'lib/wee/pageless/session.rb', line 36 def handle_render_phase new_callbacks = Wee::CallbackRegistry.new(Wee::SimpleIdGenerator.new) respond(@context, new_callbacks) # render self.callbacks = new_callbacks end |
#process_request ⇒ Object
The main routine where the request is processed.
22 23 24 |
# File 'lib/wee/pageless/session.rb', line 22 def process_request handle_existing_page end |
#setup(&block) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/wee/pageless/session.rb', line 13 def setup(&block) with_session do block.call(self) if block raise ArgumentError, "No component runner specified" if @component_runner.nil? end end |