Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
1f727005
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1f727005
编写于
9月 26, 2009
作者:
J
Joshua Peek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move default middleware stack into initializer
上级
71b33ec4
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
22 addition
and
40 deletion
+22
-40
actionpack/lib/action_controller/dispatch/dispatcher.rb
actionpack/lib/action_controller/dispatch/dispatcher.rb
+1
-4
actionpack/lib/action_controller/dispatch/middlewares.rb
actionpack/lib/action_controller/dispatch/middlewares.rb
+0
-16
actionpack/test/abstract_unit.rb
actionpack/test/abstract_unit.rb
+7
-6
actionpack/test/controller/dispatcher_test.rb
actionpack/test/controller/dispatcher_test.rb
+0
-4
actionpack/test/dispatch/session/cookie_store_test.rb
actionpack/test/dispatch/session/cookie_store_test.rb
+0
-3
railties/lib/rails/console_app.rb
railties/lib/rails/console_app.rb
+1
-1
railties/lib/rails/initializer.rb
railties/lib/rails/initializer.rb
+13
-1
railties/test/console_app_test.rb
railties/test/console_app_test.rb
+0
-5
未找到文件。
actionpack/lib/action_controller/dispatch/dispatcher.rb
浏览文件 @
1f727005
...
...
@@ -11,10 +11,7 @@ class Dispatcher
self
.
router
=
Routing
::
Routes
cattr_accessor
:middleware
self
.
middleware
=
ActionDispatch
::
MiddlewareStack
.
new
do
|
middleware
|
middlewares
=
File
.
join
(
File
.
dirname
(
__FILE__
),
"middlewares.rb"
)
middleware
.
instance_eval
(
File
.
read
(
middlewares
),
middlewares
,
1
)
end
self
.
middleware
=
ActionDispatch
::
MiddlewareStack
.
new
class
<<
self
def
define_dispatcher_callbacks
(
cache_classes
)
...
...
actionpack/lib/action_controller/dispatch/middlewares.rb
已删除
100644 → 0
浏览文件 @
71b33ec4
use
"Rack::Lock"
,
:if
=>
lambda
{
!
ActionController
::
Base
.
allow_concurrency
}
use
"ActionDispatch::ShowExceptions"
,
lambda
{
ActionController
::
Base
.
consider_all_requests_local
}
use
"ActionDispatch::Callbacks"
,
lambda
{
ActionController
::
Dispatcher
.
prepare_each_request
}
# TODO: Redirect global exceptions somewhere?
# use "ActionDispatch::Rescue"
use
lambda
{
ActionController
::
Base
.
session_store
},
lambda
{
ActionController
::
Base
.
session_options
}
use
"ActionDispatch::ParamsParser"
use
"Rack::MethodOverride"
use
"Rack::Head"
actionpack/test/abstract_unit.rb
浏览文件 @
1f727005
...
...
@@ -52,6 +52,13 @@
FIXTURE_LOAD_PATH
=
File
.
join
(
File
.
dirname
(
__FILE__
),
'fixtures'
)
ActionController
::
Dispatcher
.
middleware
=
ActionDispatch
::
MiddlewareStack
.
new
do
|
middleware
|
middleware
.
use
"ActionDispatch::ShowExceptions"
middleware
.
use
"ActionDispatch::Callbacks"
middleware
.
use
"ActionDispatch::ParamsParser"
middleware
.
use
"Rack::Head"
end
module
ActionView
class
TestCase
setup
do
...
...
@@ -114,12 +121,6 @@ class ::ApplicationController < ActionController::Base
end
module
ActionController
Base
.
session
=
{
:key
=>
'_testing_session'
,
:secret
=>
'8273f16463985e2b3747dc25e30f2528'
}
Base
.
session_store
=
nil
class
<<
Routing
def
possible_controllers
@@possible_controllers
||=
[]
...
...
actionpack/test/controller/dispatcher_test.rb
浏览文件 @
1f727005
...
...
@@ -83,10 +83,6 @@ def test_to_prepare_with_identifier_replaces
def
dispatch
(
cache_classes
=
true
)
ActionController
::
Dispatcher
.
prepare_each_request
=
false
Dispatcher
.
define_dispatcher_callbacks
(
cache_classes
)
Dispatcher
.
middleware
=
ActionDispatch
::
MiddlewareStack
.
new
do
|
middleware
|
middlewares
=
File
.
expand_path
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"../../lib/action_controller/dispatch/middlewares.rb"
))
middleware
.
instance_eval
(
File
.
read
(
middlewares
))
end
@dispatcher
||=
Dispatcher
.
new
@dispatcher
.
call
({
'rack.input'
=>
StringIO
.
new
(
''
),
'action_dispatch.show_exceptions'
=>
false
})
...
...
actionpack/test/dispatch/session/cookie_store_test.rb
浏览文件 @
1f727005
...
...
@@ -5,9 +5,6 @@ class CookieStoreTest < ActionController::IntegrationTest
SessionKey
=
'_myapp_session'
SessionSecret
=
'b3c631c314c0bbca50c1b2843150fe33'
# Make sure Session middleware doesnt get included in the middleware stack
ActionController
::
Base
.
session_store
=
nil
Verifier
=
ActiveSupport
::
MessageVerifier
.
new
(
SessionSecret
,
'SHA1'
)
SignedBar
=
Verifier
.
generate
(
:foo
=>
"bar"
,
:session_id
=>
ActiveSupport
::
SecureRandom
.
hex
(
16
))
...
...
railties/lib/rails/console_app.rb
浏览文件 @
1f727005
...
...
@@ -25,7 +25,7 @@ def new_session
#reloads the environment
def
reload!
puts
"Reloading..."
Action
Controller
::
Dispatcher
.
new
Action
Dispatch
::
Callbacks
.
new
(
lambda
{},
true
)
ActionController
::
Dispatcher
.
router
.
reload
true
end
railties/lib/rails/initializer.rb
浏览文件 @
1f727005
...
...
@@ -272,7 +272,19 @@ def self.run(initializer = nil, config = nil)
# Include middleware to serve up static assets
Initializer
.
default
.
add
:initialize_static_server
do
if
configuration
.
frameworks
.
include?
(
:action_controller
)
&&
configuration
.
serve_static_assets
configuration
.
middleware
.
insert
(
0
,
ActionDispatch
::
Static
,
Rails
.
public_path
)
configuration
.
middleware
.
use
(
ActionDispatch
::
Static
,
Rails
.
public_path
)
end
end
Initializer
.
default
.
add
:initialize_middleware_stack
do
if
configuration
.
frameworks
.
include?
(
:action_controller
)
configuration
.
middleware
.
use
(
::
Rack
::
Lock
)
unless
ActionController
::
Base
.
allow_concurrency
configuration
.
middleware
.
use
(
ActionDispatch
::
ShowExceptions
,
ActionController
::
Base
.
consider_all_requests_local
)
configuration
.
middleware
.
use
(
ActionDispatch
::
Callbacks
,
ActionController
::
Dispatcher
.
prepare_each_request
)
configuration
.
middleware
.
use
(
lambda
{
ActionController
::
Base
.
session_store
},
lambda
{
ActionController
::
Base
.
session_options
})
configuration
.
middleware
.
use
(
ActionDispatch
::
ParamsParser
)
configuration
.
middleware
.
use
(
::
Rack
::
MethodOverride
)
configuration
.
middleware
.
use
(
::
Rack
::
Head
)
end
end
...
...
railties/test/console_app_test.rb
浏览文件 @
1f727005
...
...
@@ -2,11 +2,6 @@
require
'action_controller'
# console_app uses 'action_controller/integration'
unless
defined?
ApplicationController
class
ApplicationController
<
ActionController
::
Base
;
end
ActionController
::
Base
.
session_store
=
nil
end
require
'rails/dispatcher'
require
'rails/console_app'
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录