public
Rubygem
Description: Merb Core: All you need. None you don't.
Homepage: http://www.merbivore.com
Clone URL: git://github.com/wycats/merb-core.git
Search Repo:
No longer need the response object in Dispatcher
ezmobius (author)
Wed Feb 13 14:27:00 -0800 2008
commit  a15b2e9aa1eb31f0a3fa7b2568f3ed25968e8433
tree    f33dce37aae0bd88796d3661e93f3477a606424f
parent  ab2c368f9296531260530fc054fe89ef6c7b7d17
...
23
24
25
26
 
27
28
29
...
67
68
69
70
 
71
72
73
...
77
78
79
80
 
81
82
83
84
...
93
94
95
96
 
97
98
 
99
100
101
102
...
123
124
125
126
 
127
128
129
130
131
132
133
 
134
135
136
137
...
139
140
141
142
 
143
144
 
145
146
147
...
166
167
168
169
170
 
 
171
172
173
...
23
24
25
 
26
27
28
29
...
67
68
69
 
70
71
72
73
...
77
78
79
 
80
81
82
83
84
...
93
94
95
 
96
97
 
98
99
100
101
102
...
123
124
125
 
126
127
128
129
130
131
132
 
133
134
135
136
137
...
139
140
141
 
142
143
 
144
145
146
147
...
166
167
168
 
 
169
170
171
172
173
0
@@ -23,7 +23,7 @@
0
     # ==== Returns
0
     # Array[Merb::Controller, Symbol]::
0
     # An array containing the Merb::Controller and the action that was dispatched to.
0
- def handle(rack_env, response)
0
+ def handle(rack_env)
0
       start = Time.now
0
       request = Merb::Request.new(rack_env)
0
       Merb.logger.info("Params: #{request.params.inspect}")
0
@@ -67,7 +67,7 @@
0
 
0
       action = route_params[:action]
0
 
0
- controller = dispatch_action(klass, action, request, response)
0
+ controller = dispatch_action(klass, action, request)
0
       Merb.logger.info controller._benchmarks.inspect
0
       Merb.logger.flush
0
 
0
@@ -77,7 +77,7 @@
0
     rescue => exception
0
       Merb.logger.error(Merb.exception(exception))
0
       exception = controller_exception(exception)
0
- dispatch_exception(request, response, exception)
0
+ dispatch_exception(request, , exception)
0
     end
0
     
0
     private
0
0
@@ -93,9 +93,9 @@
0
     # ==== Returns
0
     # Array[Merb::Controller, Symbol]::
0
     # An array containing the Merb::Controller and the action that was dispatched to.
0
- def dispatch_action(klass, action, request, response, status=200)
0
+ def dispatch_action(klass, action, request, , status=200)
0
       # build controller
0
- controller = klass.new(request, response, status)
0
+ controller = klass.new(request, , status)
0
       if use_mutex
0
         @@mutex.synchronize { controller._dispatch(action) }
0
       else
0
0
@@ -123,14 +123,14 @@
0
     # An array containing the Merb::Controller and the name of the exception
0
     # that triggrered #dispatch_exception. For instance, a NotFound exception
0
     # will be "not_found".
0
- def dispatch_exception(request, response, exception)
0
+ def dispatch_exception(request, , exception)
0
       klass = ::Exceptions rescue Merb::Controller
0
       request.params[:original_params] = request.params.dup rescue {}
0
       request.params[:original_session] = request.session.dup rescue {}
0
       request.params[:original_cookies] = request.cookies.dup rescue {}
0
       request.params[:exception] = exception
0
       request.params[:action] = exception.name
0
- dispatch_action(klass, exception.name, request, response, exception.class::STATUS)
0
+ dispatch_action(klass, exception.name, request, , exception.class::STATUS)
0
     rescue => dispatch_issue
0
       dispatch_issue = controller_exception(dispatch_issue)
0
       # when no action/template exist for an exception, or an
0
0
@@ -139,9 +139,9 @@
0
       # ControllerExceptions raised from exception actions are
0
       # dispatched back into the Exceptions controller
0
       if dispatch_issue.is_a?(Merb::ControllerExceptions::NotFound)
0
- dispatch_default_exception(klass, request, response, exception)
0
+ dispatch_default_exception(klass, request, , exception)
0
       elsif dispatch_issue.is_a?(Merb::ControllerExceptions::InternalServerError)
0
- dispatch_default_exception(klass, request, response, dispatch_issue)
0
+ dispatch_default_exception(klass, request, , dispatch_issue)
0
       else
0
         exception = dispatch_issue
0
         retry
0
@@ -166,8 +166,8 @@
0
     # An array containing the Merb::Controller that was dispatched to
0
     # and the error's name. For instance, a NotFound error's name is
0
     # "not_found".
0
- def dispatch_default_exception(klass, request, response, e)
0
- controller = klass.new(request, response, e.class::STATUS)
0
+ def dispatch_default_exception(klass, request, e)
0
+ controller = klass.new(request, e.class::STATUS)
0
       if e.is_a? Merb::ControllerExceptions::Redirection
0
         controller.headers.merge!('Location' => e.message)
0
         controller.body = %{ } #fix
...
19
20
21
22
 
23
24
25
...
19
20
21
 
22
23
24
25
0
@@ -19,7 +19,7 @@
0
           serve_static(env)
0
         else # No static file, let Merb handle it
0
           begin
0
- controller = ::Merb::Dispatcher.handle(env, ::Rack::Response.new)
0
+ controller = ::Merb::Dispatcher.handle(env)
0
           rescue Object => e
0
             return [500, {"Content-Type"=>"text/html"}, e.message + "<br/>" + e.backtrace.join("<br/>")]
0
           end
...
9
10
11
12
 
13
14
15
...
9
10
11
 
12
13
14
15
0
@@ -9,7 +9,7 @@
0
 
0
   it "should handle return an Exceptions controller for a bad route request" do
0
     env = Rack::MockRequest.env_for("/notreal")
0
- Merb::Dispatcher.handle(env, StringIO.new).should be_kind_of Exceptions
0
+ Merb::Dispatcher.handle(env).should be_kind_of Exceptions
0
   end
0
 
0
 end
...
9
10
11
12
 
13
14
15
...
9
10
11
 
12
13
14
15
0
@@ -9,7 +9,7 @@
0
   before(:each) do
0
     env = Rack::MockRequest.env_for("/foo/bar/54")
0
     env['REQUEST_URI'] = "/foo/bar/54" # MockRequest doesn't set this
0
- @controller = Merb::Dispatcher.handle(env, StringIO.new)
0
+ @controller = Merb::Dispatcher.handle(env)
0
   end
0
 
0
   it "should properly set the route params" do

Comments

    No one has commented yet.