Permalink
Browse files

Move HTTP libs and middleware into ActionDispatch component

  • Loading branch information...
1 parent a0f2b1d commit 319ae4628f4e0058de3e40e4ca7791b17e45e70c @josh josh committed Jan 28, 2009
Showing with 134 additions and 427 deletions.
  1. +3 −29 actionpack/lib/action_controller.rb
  2. +3 −3 actionpack/lib/action_controller/base/base.rb
  3. +2 −2 actionpack/lib/action_controller/dispatch/dispatcher.rb
  4. +5 −5 actionpack/lib/action_controller/dispatch/{rack → }/middlewares.rb
  5. +0 −16 actionpack/lib/action_controller/dispatch/rack/lock.rb
  6. +0 −315 actionpack/lib/action_controller/dispatch/request_parser.rb
  7. +2 −2 actionpack/lib/action_controller/dispatch/rescue.rb
  8. +0 −3 actionpack/lib/action_controller/rack_ext.rb
  9. +1 −1 actionpack/lib/action_controller/routing/route_set.rb
  10. +1 −1 actionpack/lib/action_controller/session/management.rb
  11. +2 −2 actionpack/lib/action_controller/testing/assertions/response.rb
  12. +3 −3 actionpack/lib/action_controller/testing/integration.rb
  13. +2 −2 actionpack/lib/action_controller/testing/process.rb
  14. +64 −0 actionpack/lib/action_dispatch.rb
  15. +1 −1 actionpack/lib/{action_controller/base → action_dispatch/http}/headers.rb
  16. +1 −1 actionpack/lib/{action_controller/mime/type.rb → action_dispatch/http/mime_type.rb}
  17. 0 actionpack/lib/{action_controller/mime/default_types.rb → action_dispatch/http/mime_types.rb}
  18. +6 −6 actionpack/lib/{action_controller/dispatch → action_dispatch/http}/request.rb
  19. +1 −1 actionpack/lib/{action_controller/dispatch → action_dispatch/http}/response.rb
  20. +1 −1 actionpack/lib/{action_controller/dispatch → action_dispatch/http}/status_codes.rb
  21. +1 −1 actionpack/lib/{action_controller/dispatch/rack → action_dispatch/middleware}/failsafe.rb
  22. +1 −1 actionpack/lib/{action_controller/dispatch → action_dispatch/middleware}/params_parser.rb
  23. +1 −1 actionpack/lib/{action_controller/dispatch → action_dispatch/middleware}/rewindable_input.rb
  24. +1 −1 actionpack/lib/{action_controller → action_dispatch/middleware}/session/abstract_store.rb
  25. +1 −1 actionpack/lib/{action_controller → action_dispatch/middleware}/session/cookie_store.rb
  26. +1 −1 actionpack/lib/{action_controller → action_dispatch/middleware}/session/mem_cache_store.rb
  27. +3 −0 actionpack/lib/action_dispatch/rack.rb
  28. 0 actionpack/lib/{action_controller/rack_ext → action_dispatch/rack}/lock.rb
  29. 0 actionpack/lib/{action_controller/rack_ext → action_dispatch/rack}/multipart.rb
  30. 0 actionpack/lib/{action_controller/rack_ext → action_dispatch/rack}/parse_query.rb
  31. +1 −1 actionpack/lib/{action_controller/dispatch/rack → action_dispatch/utils}/middleware_stack.rb
  32. +1 −1 actionpack/lib/{action_controller/dispatch → action_dispatch/utils}/uploaded_file.rb
  33. +1 −1 actionpack/lib/{action_controller/dispatch → action_dispatch/utils}/url_encoded_pair_parser.rb
  34. +1 −1 actionpack/test/controller/dispatcher_test.rb
  35. +1 −1 actionpack/test/controller/header_test.rb
  36. +1 −1 actionpack/test/controller/middleware_stack_test.rb
  37. +5 −5 actionpack/test/controller/rack_test.rb
  38. +2 −2 actionpack/test/controller/render_test.rb
  39. +1 −1 actionpack/test/controller/request/multipart_params_parsing_test.rb
  40. +1 −1 actionpack/test/controller/request/url_encoded_params_parsing_test.rb
  41. +1 −1 actionpack/test/controller/rescue_test.rb
  42. +9 −9 actionpack/test/controller/session/cookie_store_test.rb
  43. +1 −1 actionpack/test/controller/session/mem_cache_store_test.rb
  44. +1 −1 activerecord/lib/active_record/session_store.rb
@@ -31,58 +31,43 @@
end
end
-gem 'rack', '>= 0.9.0'
-require 'rack'
-require 'action_controller/rack_ext'
-
require File.join(File.dirname(__FILE__), "action_pack")
module ActionController
# TODO: Review explicit to see if they will automatically be handled by
# the initilizer if they are really needed.
def self.load_all!
- [Base, CGIHandler, CgiRequest, Request, Response, Http::Headers, UrlRewriter, UrlWriter]
+ [Base, Request, Response, UrlRewriter, UrlWriter]
+ [ActionDispatch::Http::Headers]
end
autoload :Base, 'action_controller/base/base'
autoload :Benchmarking, 'action_controller/base/chained/benchmarking'
autoload :Caching, 'action_controller/caching'
autoload :Cookies, 'action_controller/base/cookies'
autoload :Dispatcher, 'action_controller/dispatch/dispatcher'
- autoload :Failsafe, 'action_controller/dispatch/rack/failsafe'
autoload :Filters, 'action_controller/base/chained/filters'
autoload :Flash, 'action_controller/base/chained/flash'
autoload :Helpers, 'action_controller/base/helpers'
autoload :HttpAuthentication, 'action_controller/base/http_authentication'
autoload :Integration, 'action_controller/testing/integration'
autoload :IntegrationTest, 'action_controller/testing/integration'
autoload :Layout, 'action_controller/base/layout'
- autoload :Lock, 'action_controller/dispatch/rack/lock'
- autoload :MiddlewareStack, 'action_controller/dispatch/rack/middleware_stack'
autoload :MimeResponds, 'action_controller/mime/responds'
- autoload :ParamsParser, 'action_controller/dispatch/params_parser'
autoload :PolymorphicRoutes, 'action_controller/routing/generation/polymorphic_routes'
autoload :RecordIdentifier, 'action_controller/record_identifier'
autoload :Redirector, 'action_controller/base/redirect'
autoload :Renderer, 'action_controller/base/render'
- autoload :Request, 'action_controller/dispatch/request'
autoload :RequestForgeryProtection, 'action_controller/base/request_forgery_protection'
- autoload :RequestParser, 'action_controller/dispatch/request_parser'
autoload :Rescue, 'action_controller/dispatch/rescue'
autoload :Resources, 'action_controller/routing/resources'
autoload :Responder, 'action_controller/base/responder'
- autoload :Response, 'action_controller/dispatch/response'
- autoload :RewindableInput, 'action_controller/dispatch/rewindable_input'
autoload :Routing, 'action_controller/routing'
autoload :SessionManagement, 'action_controller/session/management'
- autoload :StatusCodes, 'action_controller/dispatch/status_codes'
autoload :Streaming, 'action_controller/base/streaming'
autoload :TestCase, 'action_controller/testing/test_case'
autoload :TestProcess, 'action_controller/testing/process'
autoload :Translation, 'action_controller/translation'
- autoload :UploadedFile, 'action_controller/dispatch/uploaded_file'
- autoload :UploadedStringIO, 'action_controller/dispatch/uploaded_file'
- autoload :UploadedTempfile, 'action_controller/dispatch/uploaded_file'
autoload :UrlEncodedPairParser, 'action_controller/dispatch/url_encoded_pair_parser'
autoload :UrlRewriter, 'action_controller/routing/generation/url_rewriter'
autoload :UrlWriter, 'action_controller/routing/generation/url_rewriter'
@@ -96,20 +81,9 @@ module Assertions
autoload :SelectorAssertions, 'action_controller/testing/assertions/selector'
autoload :TagAssertions, 'action_controller/testing/assertions/tag'
end
-
- module Http
- autoload :Headers, 'action_controller/base/headers'
- end
-
- module Session
- autoload :AbstractStore, 'action_controller/session/abstract_store'
- autoload :CookieStore, 'action_controller/session/cookie_store'
- autoload :MemCacheStore, 'action_controller/session/mem_cache_store'
- end
end
-autoload :Mime, 'action_controller/mime/type'
-
autoload :HTML, 'action_controller/vendor/html-scanner'
+require 'action_dispatch'
require 'action_view'
@@ -232,7 +232,7 @@ class UnknownHttpMethod < ActionControllerError #:nodoc:
#
class Base
- include StatusCodes
+ include ActionDispatch::StatusCodes
cattr_reader :protected_instance_variables
# Controller specific instance variables which will not be accessible inside views.
@@ -367,8 +367,8 @@ class Base
class << self
def call(env)
# HACK: For global rescue to have access to the original request and response
- request = env["action_controller.rescue.request"] ||= Request.new(env)
- response = env["action_controller.rescue.response"] ||= Response.new
+ request = env["action_controller.rescue.request"] ||= ActionDispatch::Request.new(env)
+ response = env["action_controller.rescue.response"] ||= ActionDispatch::Response.new
process(request, response)
end
@@ -45,8 +45,8 @@ def to_prepare(identifier = nil, &block)
end
cattr_accessor :middleware
- self.middleware = MiddlewareStack.new do |middleware|
- middlewares = File.join(File.dirname(__FILE__), "rack", "middlewares.rb")
+ self.middleware = ActionDispatch::MiddlewareStack.new do |middleware|
+ middlewares = File.join(File.dirname(__FILE__), "middlewares.rb")
middleware.instance_eval(File.read(middlewares))
end
@@ -2,10 +2,10 @@
!ActionController::Base.allow_concurrency
}
-use "ActionController::Failsafe"
+use "ActionDispatch::Failsafe"
-["ActionController::Session::CookieStore",
- "ActionController::Session::MemCacheStore",
+["ActionDispatch::Session::CookieStore",
+ "ActionDispatch::Session::MemCacheStore",
"ActiveRecord::SessionStore"].each do |store|
use(store, ActionController::Base.session_options,
:if => lambda {
@@ -16,6 +16,6 @@
)
end
-use "ActionController::RewindableInput"
-use "ActionController::ParamsParser"
+use "ActionDispatch::RewindableInput"
+use "ActionDispatch::ParamsParser"
use "Rack::MethodOverride"
@@ -1,16 +0,0 @@
-module ActionController
- class Lock
- FLAG = 'rack.multithread'.freeze
-
- def initialize(app, lock = Mutex.new)
- @app, @lock = app, lock
- end
-
- def call(env)
- old, env[FLAG] = env[FLAG], false
- @lock.synchronize { @app.call(env) }
- ensure
- env[FLAG] = old
- end
- end
-end
Oops, something went wrong.

0 comments on commit 319ae46

Please sign in to comment.