diff options
author | Joshua Peek <josh@joshpeek.com> | 2008-12-01 13:48:47 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-12-01 13:49:34 -0600 |
commit | 06ed8e451198b2296d8b2752741e259b4f995081 (patch) | |
tree | 9e7733152cb317178ea95bfbe423e98e252a98c3 /actionpack/lib/action_controller/dispatcher.rb | |
parent | 3c07a8828ede3d41000513af29c293ae2e2a49d4 (diff) | |
download | rails-06ed8e451198b2296d8b2752741e259b4f995081.tar.gz rails-06ed8e451198b2296d8b2752741e259b4f995081.tar.bz2 rails-06ed8e451198b2296d8b2752741e259b4f995081.zip |
Add internal middleware stack to Dispatcher
config.middleware.use Rack::Cache
Diffstat (limited to 'actionpack/lib/action_controller/dispatcher.rb')
-rw-r--r-- | actionpack/lib/action_controller/dispatcher.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/dispatcher.rb b/actionpack/lib/action_controller/dispatcher.rb index 6e4aba2280..4f400c4681 100644 --- a/actionpack/lib/action_controller/dispatcher.rb +++ b/actionpack/lib/action_controller/dispatcher.rb @@ -85,6 +85,9 @@ module ActionController end end + cattr_accessor :middleware + self.middleware = MiddlewareStack.new + cattr_accessor :error_file_path self.error_file_path = Rails.public_path if defined?(Rails.public_path) @@ -93,6 +96,7 @@ module ActionController def initialize(output = $stdout, request = nil, response = nil) @output, @request, @response = output, request, response + @app = @@middleware.build(lambda { |env| self._call(env) }) end def dispatch_unlocked @@ -127,6 +131,10 @@ module ActionController end def call(env) + @app.call(env) + end + + def _call(env) @request = RackRequest.new(env) @response = RackResponse.new(@request) dispatch |