action_dispatch.rb 3.5 KB
Newer Older
1
#--
2
# Copyright (c) 2004-2012 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
require 'active_support'
25
require 'active_support/rails'
26
require 'active_support/core_ext/module/attribute_accessors'
27

28
require 'action_pack'
J
Joshua Peek 已提交
29
require 'rack'
30

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

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

38 39 40
  class IllegalStateError < StandardError
  end

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

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

J
Joshua Peek 已提交
66 67
  autoload :MiddlewareStack, 'action_dispatch/middleware/stack'
  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 :FilterParameters
78
    autoload :FilterRedirect
79 80 81
    autoload :Upload
    autoload :UploadedFile, 'action_dispatch/http/upload'
    autoload :URL
J
Joshua Peek 已提交
82
  end
83

J
Joshua Peek 已提交
84
  module Session
85 86 87 88 89 90
    autoload :AbstractStore,                           'action_dispatch/middleware/session/abstract_store'
    autoload :CookieStore,                             'action_dispatch/middleware/session/cookie_store'
    autoload :EncryptedCookieStore,                    'action_dispatch/middleware/session/cookie_store'
    autoload :UpgradeSignatureToEncryptionCookieStore, '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 已提交
91
  end
C
Carlhuda 已提交
92

93 94
  mattr_accessor :test_app

J
Joshua Peek 已提交
95 96 97
  autoload_under 'testing' do
    autoload :Assertions
    autoload :Integration
98
    autoload :IntegrationTest, 'action_dispatch/testing/integration'
J
Joshua Peek 已提交
99 100 101 102
    autoload :PerformanceTest
    autoload :TestProcess
    autoload :TestRequest
    autoload :TestResponse
103 104 105 106
  end
end

autoload :Mime, 'action_dispatch/http/mime_type'
107 108 109

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