aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/new_base/http.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2009-06-01 09:38:09 +0100
committerPratik Naik <pratiknaik@gmail.com>2009-06-01 09:38:09 +0100
commit9d60525b5fc14b4b6f3ed9ba8ea874d6e76b4f78 (patch)
tree5a711cacac76a83ad12551023da8524f94e7365b /actionpack/lib/action_controller/new_base/http.rb
parentdc7323efd34327c13d26031b68e51314c24360f6 (diff)
parent9537fd0e3a7625afe4bee75d749647ca1837195a (diff)
downloadrails-9d60525b5fc14b4b6f3ed9ba8ea874d6e76b4f78.tar.gz
rails-9d60525b5fc14b4b6f3ed9ba8ea874d6e76b4f78.tar.bz2
rails-9d60525b5fc14b4b6f3ed9ba8ea874d6e76b4f78.zip
Merge commit 'mainstream/master'
Diffstat (limited to 'actionpack/lib/action_controller/new_base/http.rb')
-rw-r--r--actionpack/lib/action_controller/new_base/http.rb80
1 files changed, 52 insertions, 28 deletions
diff --git a/actionpack/lib/action_controller/new_base/http.rb b/actionpack/lib/action_controller/new_base/http.rb
index 2525e221a6..c96aaaa865 100644
--- a/actionpack/lib/action_controller/new_base/http.rb
+++ b/actionpack/lib/action_controller/new_base/http.rb
@@ -4,9 +4,9 @@ require 'active_support/core_ext/module/delegation'
module ActionController
class Http < AbstractController::Base
abstract!
-
+
# :api: public
- attr_internal :request, :response, :params
+ attr_internal :params, :env
# :api: public
def self.controller_name
@@ -14,54 +14,78 @@ module ActionController
end
# :api: public
- def controller_name() self.class.controller_name end
+ def controller_name
+ self.class.controller_name
+ end
- # :api: public
+ # :api: public
def self.controller_path
@controller_path ||= self.name.sub(/Controller$/, '').underscore
end
-
- # :api: public
- def controller_path() self.class.controller_path end
-
- # :api: private
- def self.action_names() action_methods end
-
+
+ # :api: public
+ def controller_path
+ self.class.controller_path
+ end
+
+ # :api: private
+ def self.action_names
+ action_methods
+ end
+
# :api: private
- def action_names() action_methods end
-
+ def action_names
+ action_methods
+ end
+
# :api: plugin
def self.call(env)
controller = new
controller.call(env).to_rack
end
-
- delegate :headers, :to => "@_response"
- def params
- @_params ||= @_request.parameters
+ # The details below can be overridden to support a specific
+ # Request and Response object. The default ActionController::Base
+ # implementation includes RackConvenience, which makes a request
+ # and response object available. You might wish to control the
+ # environment and response manually for performance reasons.
+
+ attr_internal :status, :headers, :content_type
+
+ def initialize(*)
+ @_headers = {}
+ super
+ end
+
+ # Basic implements for content_type=, location=, and headers are
+ # provided to reduce the dependency on the RackConvenience module
+ # in Renderer and Redirector.
+
+ def content_type=(type)
+ headers["Content-Type"] = type.to_s
end
-
+
+ def location=(url)
+ headers["Location"] = url
+ end
+
# :api: private
def call(name, env)
- @_request = ActionDispatch::Request.new(env)
- @_response = ActionDispatch::Response.new
- @_response.request = request
+ @_env = env
process(name)
to_rack
end
-
+
+ # :api: private
+ def to_rack
+ [status, headers, response_body]
+ end
+
def self.action(name)
@actions ||= {}
@actions[name.to_s] ||= proc do |env|
new.call(name, env)
end
end
-
- # :api: private
- def to_rack
- @_response.prepare!
- @_response.to_a
- end
end
end