Class: Waves::Dispatchers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/dispatchers/base.rb

Overview

Waves::Dispatchers::Base provides the basic request processing structure. All other Waves dispatchers should inherit from it. It creates a Waves request, determines whether to enclose the request processing in a mutex, benchmarks it, logs it, and handles common exceptions and redirects. Derived classes need only process the request within the safe method, which must take a Waves::Request and return a Waves::Response.

Direct Known Subclasses

Default

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object

As with any Rack application, a Waves dispatcher must provide a call method that takes an env parameter.



31
32
33
34
35
36
37
# File 'lib/dispatchers/base.rb', line 31

def call( env )
  if Waves.config.synchronize?
    Waves::Application.instance.synchronize { _call( env ) }
  else
    _call( env )
  end
end

#deferred?(env) ⇒ Boolean

Called by event driven servers like thin and ebb. Returns true if the server should run the request in a separate thread, as determined by Configurations::Mapping#threaded?

Returns:

  • (Boolean)


42
43
44
# File 'lib/dispatchers/base.rb', line 42

def deferred?( env )
  Waves::Application.instance.mapping.threaded?( env )
end