aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeon Breedt <bitserf@gmail.com>2005-05-07 23:49:45 +0000
committerLeon Breedt <bitserf@gmail.com>2005-05-07 23:49:45 +0000
commit884fd4792d33032ffa88e08d17a9cf14b733c078 (patch)
tree11cbafe560b2d43b0f7c1470426685ce58ae5d27
parent47a7084b94b8cd0dfc43e0b8f1775eef31c5170d (diff)
downloadrails-884fd4792d33032ffa88e08d17a9cf14b733c078.tar.gz
rails-884fd4792d33032ffa88e08d17a9cf14b733c078.tar.bz2
rails-884fd4792d33032ffa88e08d17a9cf14b733c078.zip
support using invocation filters in :direct controllers as well, for
consistency. action pack filters don't necessarily include enough information about the request since they occur before AWS actually sees the request and unpacks it. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1294 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionwebservice/CHANGELOG2
-rw-r--r--actionwebservice/lib/action_web_service.rb1
-rw-r--r--actionwebservice/lib/action_web_service/dispatcher/abstract.rb12
-rw-r--r--actionwebservice/test/invocation_test.rb2
4 files changed, 12 insertions, 5 deletions
diff --git a/actionwebservice/CHANGELOG b/actionwebservice/CHANGELOG
index 699a675fc5..da5d32bcc8 100644
--- a/actionwebservice/CHANGELOG
+++ b/actionwebservice/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Allow invocation filters in :direct controllers as well, as they have access to more information regarding the web service request than ActionPack filters
+
* Add support for a :base64 signature type #1272 [Shugo Maeda]
* Fix that boolean fields were not rendered correctly in scaffolding
diff --git a/actionwebservice/lib/action_web_service.rb b/actionwebservice/lib/action_web_service.rb
index 566a286a25..874518e0b1 100644
--- a/actionwebservice/lib/action_web_service.rb
+++ b/actionwebservice/lib/action_web_service.rb
@@ -59,6 +59,7 @@ ActionController::Base.class_eval do
include ActionWebService::Container::Direct
include ActionWebService::Container::Delegated
include ActionWebService::Container::ActionController
+ include ActionWebService::Invocation
include ActionWebService::Dispatcher
include ActionWebService::Dispatcher::ActionController
include ActionWebService::Scaffolding
diff --git a/actionwebservice/lib/action_web_service/dispatcher/abstract.rb b/actionwebservice/lib/action_web_service/dispatcher/abstract.rb
index e60f30a05b..9f2f474ffb 100644
--- a/actionwebservice/lib/action_web_service/dispatcher/abstract.rb
+++ b/actionwebservice/lib/action_web_service/dispatcher/abstract.rb
@@ -28,16 +28,20 @@ module ActionWebService # :nodoc:
@method_params = invocation.method_ordered_params
arity = method(invocation.api_method.name).arity rescue 0
if arity < 0 || arity > 0
- return_value = self.__send__(invocation.api_method.name, *@method_params)
+ params = @method_params
else
- return_value = self.__send__(invocation.api_method.name)
+ params = []
end
- web_service_create_response(invocation.protocol, invocation.protocol_options, invocation.api, invocation.api_method, return_value)
+ web_service_filtered_invoke(invocation, params)
end
def web_service_delegated_invoke(invocation)
+ web_service_filtered_invoke(invocation, invocation.method_ordered_params)
+ end
+
+ def web_service_filtered_invoke(invocation, params)
cancellation_reason = nil
- return_value = invocation.service.perform_invocation(invocation.api_method.name, invocation.method_ordered_params) do |x|
+ return_value = invocation.service.perform_invocation(invocation.api_method.name, params) do |x|
cancellation_reason = x
end
if cancellation_reason
diff --git a/actionwebservice/test/invocation_test.rb b/actionwebservice/test/invocation_test.rb
index 22752fefaf..3ef22fafeb 100644
--- a/actionwebservice/test/invocation_test.rb
+++ b/actionwebservice/test/invocation_test.rb
@@ -26,7 +26,7 @@ module InvocationTest
InterceptorClass = Interceptor.new
- class Service < ActionWebService::Base
+ class Service < ActionController::Base
web_service_api API
before_invocation :intercept_before, :except => [:no_before]