action_dispatch.rb 3.1 KB
Newer Older
1
#--
J
Jon Moss 已提交
2
# Copyright (c) 2004-2017 David Heinemeier Hansson
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++

24 25 26
require "active_support"
require "active_support/rails"
require "active_support/core_ext/module/attribute_accessors"
27

28 29
require "action_pack"
require "rack"
30

J
Joshua Peek 已提交
31
module Rack
32
  autoload :Test, "rack/test"
J
Joshua Peek 已提交
33
end
34

35
module ActionDispatch
C
Carlhuda 已提交
36
  extend ActiveSupport::Autoload
37

38 39 40
  class IllegalStateError < StandardError
  end

41
  eager_autoload do
42
    autoload_under "http" do
43 44 45
      autoload :Request
      autoload :Response
    end
J
Joshua Peek 已提交
46
  end
J
Joshua Peek 已提交
47

48
  autoload_under "middleware" do
49
    autoload :RequestId
J
Joshua Peek 已提交
50
    autoload :Callbacks
J
Joshua Peek 已提交
51
    autoload :Cookies
52
    autoload :DebugExceptions
53
    autoload :DebugLocks
54
    autoload :ExceptionWrapper
55
    autoload :Executor
J
Joshua Peek 已提交
56
    autoload :Flash
57
    autoload :PublicExceptions
58
    autoload :Reloader
C
Carlhuda 已提交
59
    autoload :RemoteIp
J
Joshua Peek 已提交
60
    autoload :ShowExceptions
61
    autoload :SSL
J
Joshua Peek 已提交
62 63
    autoload :Static
  end
J
Joshua Peek 已提交
64

65
  autoload :Journey
66
  autoload :MiddlewareStack, "action_dispatch/middleware/stack"
J
Joshua Peek 已提交
67
  autoload :Routing
68

J
Joshua Peek 已提交
69
  module Http
70 71 72 73 74 75
    extend ActiveSupport::Autoload

    autoload :Cache
    autoload :Headers
    autoload :MimeNegotiation
    autoload :Parameters
76
    autoload :ParameterFilter
77
    autoload :Upload
78
    autoload :UploadedFile, "action_dispatch/http/upload"
79
    autoload :URL
J
Joshua Peek 已提交
80
  end
81

J
Joshua Peek 已提交
82
  module Session
83 84 85 86
    autoload :AbstractStore,     "action_dispatch/middleware/session/abstract_store"
    autoload :CookieStore,       "action_dispatch/middleware/session/cookie_store"
    autoload :MemCacheStore,     "action_dispatch/middleware/session/mem_cache_store"
    autoload :CacheStore,        "action_dispatch/middleware/session/cache_store"
J
Joshua Peek 已提交
87
  end
C
Carlhuda 已提交
88

89 90
  mattr_accessor :test_app

91
  autoload_under "testing" do
J
Joshua Peek 已提交
92 93
    autoload :Assertions
    autoload :Integration
94
    autoload :IntegrationTest, "action_dispatch/testing/integration"
J
Joshua Peek 已提交
95 96 97
    autoload :TestProcess
    autoload :TestRequest
    autoload :TestResponse
98
    autoload :AssertionResponse
99 100 101
  end
end

102
autoload :Mime, "action_dispatch/http/mime_type"
103 104 105

ActiveSupport.on_load(:action_view) do
  ActionView::Base.default_formats ||= Mime::SET.symbols
106
  ActionView::Template::Types.delegate_to Mime
107
end