| Class | Merb::Rack::Application |
| In: |
merb-core/lib/merb-core/rack/application.rb
|
| Parent: | Object |
The main rack application call method. This is the entry point from rack (and the webserver) to your application.
| env<Hash>: | A rack request of parameters. |
| <Array>: | A rack response of [status<Integer>, headers<Hash>, body<String, Stream>] |
:api: private
# File merb-core/lib/merb-core/rack/application.rb, line 15
15: def call(env)
16: begin
17: rack_response = ::Merb::Dispatcher.handle(Merb::Request.new(env))
18: rescue Object => e
19: return [500, {Merb::Const::CONTENT_TYPE => Merb::Const::TEXT_SLASH_HTML}, e.message + Merb::Const::BREAK_TAG + e.backtrace.join(Merb::Const::BREAK_TAG)]
20: end
21: Merb.logger.info Merb::Const::DOUBLE_NEWLINE
22: Merb.logger.flush
23:
24: # unless controller.headers[Merb::Const::DATE]
25: # require "time"
26: # controller.headers[Merb::Const::DATE] = Time.now.rfc2822.to_s
27: # end
28: rack_response
29: end
Determines whether this request is a "deferred_action", usually a long request. Rack uses this method to detemine whether to use an evented request or a deferred request in evented rack handlers.
| env<Hash>: | The rack request |
| Boolean: | True if the request should be deferred. |
:api: private
# File merb-core/lib/merb-core/rack/application.rb, line 43
43: def deferred?(env)
44: path = env[Merb::Const::PATH_INFO] ? env[Merb::Const::PATH_INFO].chomp(Merb::Const::SLASH) : Merb::Const::EMPTY_STRING
45: if path =~ Merb.deferred_actions
46: Merb.logger.info! "Deferring Request: #{path}"
47: true
48: else
49: false
50: end
51: end