TeX and CSS tweaks.

Sync with latest Instiki Trunk
(Updates Rails to 1.2.2)
This commit is contained in:
Jacques Distler 2007-02-09 02:04:31 -06:00
parent 0ac586ee25
commit c358389f25
443 changed files with 24218 additions and 9823 deletions

View file

@ -16,7 +16,7 @@ module ActionWebService # :nodoc:
class Base
# Action WebService API subclasses should be reloaded by the dispatcher in Rails
# when Dependencies.mechanism = :load.
include Reloadable::Subclasses
include Reloadable::Deprecated
# Whether to transform the public API method names into camel-cased names
class_inheritable_option :inflect_names, true

View file

@ -12,7 +12,7 @@ module ActionWebService # :nodoc:
# web_service_api PersonAPI
#
# def find_person(criteria)
# Person.find_all [...]
# Person.find(:all) [...]
# end
#
# def delete_person(id)
@ -33,7 +33,7 @@ module ActionWebService # :nodoc:
class Base
# Action WebService subclasses should be reloaded by the dispatcher in Rails
# when Dependencies.mechanism = :load.
include Reloadable::Subclasses
include Reloadable::Deprecated
# Whether to report exceptions back to the caller in the protocol's exception
# format

View file

@ -96,14 +96,14 @@ module ActionWebService # :nodoc:
when :float
Float(value)
when :time
value = "#{value['2']}/#{value['3']}/#{value['1']} #{value['4']}:#{value['5']}:#{value['6']}" if value.kind_of?(Hash)
Time.parse(value.to_s)
value = "%s/%s/%s %s:%s:%s" % value.values_at(*%w[2 3 1 4 5 6]) if value.kind_of?(Hash)
value.kind_of?(Time) ? value : Time.parse(value.to_s)
when :date
value = "#{value['2']}/#{value['3']}/#{value['1']}" if value.kind_of?(Hash)
Date.parse(value.to_s)
value = "%s/%s/%s" % value.values_at(*%w[2 3 1]) if value.kind_of?(Hash)
value.kind_of?(Date) ? value : Date.parse(value.to_s)
when :datetime
value = "#{value['2']}/#{value['3']}/#{value['1']} #{value['4']}:#{value['5']}:#{value['6']}" if value.kind_of?(Hash)
DateTime.parse(value.to_s)
value = "%s/%s/%s %s:%s:%s" % value.values_at(*%w[2 3 1 4 5 6]) if value.kind_of?(Hash)
value.kind_of?(DateTime) ? value : DateTime.parse(value.to_s)
end
end

View file

@ -16,6 +16,8 @@ module ActionWebService # :nodoc:
# persons = soap_client.find_all
#
class Soap < Base
# provides access to the underlying soap driver
attr_reader :driver
# Creates a new web service client using the SOAP RPC protocol.
#

View file

@ -1,13 +1,11 @@
module ActionWebService # :nodoc:
module Container # :nodoc:
module ActionController # :nodoc:
def self.append_features(base) # :nodoc:
def self.included(base) # :nodoc:
class << base
include ClassMethods
alias_method :inherited_without_api, :inherited
alias_method :inherited, :inherited_with_api
alias_method :web_service_api_without_require, :web_service_api
alias_method :web_service_api, :web_service_api_with_require
alias_method_chain :inherited, :api
alias_method_chain :web_service_api, :require
end
end

View file

@ -4,8 +4,7 @@ module ActionWebService # :nodoc:
class ContainerError < ActionWebServiceError # :nodoc:
end
def self.append_features(base) # :nodoc:
super
def self.included(base) # :nodoc:
base.extend(ClassMethods)
base.send(:include, ActionWebService::Container::Delegated::InstanceMethods)
end

View file

@ -4,8 +4,7 @@ module ActionWebService # :nodoc:
class ContainerError < ActionWebServiceError # :nodoc:
end
def self.append_features(base) # :nodoc:
super
def self.included(base) # :nodoc:
base.extend(ClassMethods)
end

View file

@ -5,8 +5,7 @@ module ActionWebService # :nodoc:
class DispatcherError < ActionWebService::ActionWebServiceError # :nodoc:
end
def self.append_features(base) # :nodoc:
super
def self.included(base) # :nodoc:
base.class_inheritable_option(:web_service_dispatching_mode, :direct)
base.class_inheritable_option(:web_service_exception_reporting, true)
base.send(:include, ActionWebService::Dispatcher::InstanceMethods)
@ -63,7 +62,7 @@ module ActionWebService # :nodoc:
responses = []
invocations.each do |invocation|
if invocation.is_a?(Hash)
responses << invocation
responses << [invocation, nil]
next
end
begin
@ -75,15 +74,18 @@ module ActionWebService # :nodoc:
end
api_method = invocation.api_method
if invocation.api.has_api_method?(api_method.name)
response_type = (api_method.returns ? api_method.returns[0] : nil)
return_value = api_method.cast_returns(return_value)
else
response_type = ActionWebService::SignatureTypes.canonical_signature_entry(return_value.class, 0)
end
responses << [return_value]
responses << [return_value, response_type]
rescue Exception => e
responses << { 'faultCode' => 3, 'faultString' => e.message }
responses << [{ 'faultCode' => 3, 'faultString' => e.message }, nil]
end
end
invocation = invocations[0]
invocation.protocol.encode_response('system.multicall', responses, nil, invocation.protocol_options)
invocation.protocol.encode_multicall_response(responses, invocation.protocol_options)
end
def web_service_invocation(request, level = 0)

View file

@ -4,12 +4,10 @@ require 'builder/xmlmarkup'
module ActionWebService # :nodoc:
module Dispatcher # :nodoc:
module ActionController # :nodoc:
def self.append_features(base) # :nodoc:
super
def self.included(base) # :nodoc:
class << base
include ClassMethods
alias_method :inherited_without_action_controller, :inherited
alias_method :inherited, :inherited_with_action_controller
alias_method_chain :inherited, :action_controller
end
base.class_eval do
alias_method :web_service_direct_invoke_without_controller, :web_service_direct_invoke
@ -39,6 +37,10 @@ module ActionWebService # :nodoc:
module InstanceMethods # :nodoc:
private
def dispatch_web_service_request
if request.get?
render_text('GET not supported', '500 GET not supported')
return
end
exception = nil
begin
ws_request = discover_web_service_request(request)
@ -104,13 +106,7 @@ module ActionWebService # :nodoc:
invocation.method_named_params.each do |name, value|
params[name] = value
end
params['action'] = invocation.api_method.name.to_s
if before_action == false
raise(DispatcherError, "Method filtered")
end
return_value = web_service_direct_invoke_without_controller(invocation)
after_action
return_value
web_service_direct_invoke_without_controller(invocation)
end
def log_request(ws_request, body)
@ -165,7 +161,7 @@ module ActionWebService # :nodoc:
private
def base_uri
host = request.env['HTTP_HOST'] || request.env['SERVER_NAME'] || 'localhost'
host = request.host_with_port
relative_url_root = request.relative_url_root
scheme = request.ssl? ? 'https' : 'http'
'%s://%s%s/%s/' % [scheme, host, relative_url_root, self.class.controller_path]

View file

@ -3,8 +3,7 @@ module ActionWebService # :nodoc:
class InvocationError < ActionWebService::ActionWebServiceError # :nodoc:
end
def self.append_features(base) # :nodoc:
super
def self.included(base) # :nodoc:
base.extend(ClassMethods)
base.send(:include, ActionWebService::Invocation::InstanceMethods)
end
@ -125,11 +124,9 @@ module ActionWebService # :nodoc:
end
module InstanceMethods # :nodoc:
def self.append_features(base)
super
def self.included(base)
base.class_eval do
alias_method :perform_invocation_without_interception, :perform_invocation
alias_method :perform_invocation, :perform_invocation_with_interception
alias_method_chain :perform_invocation, :interception
end
end

View file

@ -58,6 +58,19 @@ module ActionWebService # :nodoc:
Response.new(raw_response, 'text/xml', return_value)
end
def encode_multicall_response(responses, protocol_options={})
result = responses.map do |return_value, return_type|
if return_value && return_type
return_value = value_to_xmlrpc_wire_format(return_value, return_type)
return_value = [return_value] unless return_value.nil?
end
return_value = false if return_value.nil?
return_value
end
raw_response = XMLRPC::Marshal.dump_response(result)
Response.new(raw_response, 'text/xml', result)
end
def protocol_client(api, protocol_name, endpoint_uri, options={})
return nil unless protocol_name == :xmlrpc
ActionWebService::Client::XmlRpc.new(api, endpoint_uri, options)

View file

@ -6,8 +6,7 @@ module ActionWebService
class ScaffoldingError < ActionWebServiceError # :nodoc:
end
def self.append_features(base)
super
def self.included(base)
base.extend(ClassMethods)
end
@ -40,7 +39,7 @@ module ActionWebService
# can then be used as the entry point for invoking API methods from a web browser.
def web_service_scaffold(action_name)
add_template_helper(Helpers)
module_eval <<-"end_eval", __FILE__, __LINE__
module_eval <<-"end_eval", __FILE__, __LINE__ + 1
def #{action_name}
if request.method == :get
setup_invocation_assigns
@ -77,12 +76,12 @@ module ActionWebService
@method_request_xml = @protocol.encode_request(method_name, params, @scaffold_method.expects)
new_request = @protocol.encode_action_pack_request(@scaffold_service.name, @scaffold_method.public_name, @method_request_xml)
prepare_request(new_request, @scaffold_service.name, @scaffold_method.public_name)
@request = new_request
self.request = new_request
if @scaffold_container.dispatching_mode != :direct
request.parameters['action'] = @scaffold_service.name
end
dispatch_web_service_request
@method_response_xml = @response.body
@method_response_xml = response.body
method_name, obj = @protocol.decode_response(@method_response_xml)
return if handle_invocation_exception(obj)
@method_return_value = @scaffold_method.cast_returns(obj)
@ -128,7 +127,7 @@ module ActionWebService
def reset_invocation_response
erase_render_results
@response.headers = ::ActionController::AbstractResponse::DEFAULT_HEADERS.merge("cookie" => [])
response.headers = ::ActionController::AbstractResponse::DEFAULT_HEADERS.merge("cookie" => [])
end
def public_method_name(service_name, method_name)

View file

@ -21,7 +21,7 @@ module ActionWebService
class Struct
# Action WebService Struct subclasses should be reloaded by the dispatcher in Rails
# when Dependencies.mechanism = :load.
include Reloadable::Subclasses
include Reloadable::Deprecated
# If a Hash is given as argument to an ActionWebService::Struct constructor,
# it can contain initial values for the structure member.

View file

@ -1,12 +1,12 @@
<h4>Method Invocation Details for <em><%= @scaffold_service %>#<%= @scaffold_method.public_name %></em></h4>
<%= form_tag :action => @scaffold_action_name + '_submit' %>
<% form_tag(:action => @scaffold_action_name + '_submit') do -%>
<%= hidden_field_tag "service", @scaffold_service.name %>
<%= hidden_field_tag "method", @scaffold_method.public_name %>
<p>
<label for="protocol">Protocol:</label><br />
<%= select_tag 'protocol', options_for_select([['SOAP', 'soap'], ['XML-RPC', 'xmlrpc']], @params['protocol']) %>
<%= select_tag 'protocol', options_for_select([['SOAP', 'soap'], ['XML-RPC', 'xmlrpc']], params['protocol']) %>
</p>
<% if @scaffold_method.expects %>
@ -22,7 +22,7 @@
<% end %>
<%= submit_tag "Invoke" %>
<%= end_form_tag %>
<% end -%>
<p>
<%= link_to "Back", :action => @scaffold_action_name %>

View file

@ -52,7 +52,7 @@ module Test # :nodoc:
end
protocol.register_api(api)
method = api.api_methods[api_method_name.to_sym]
raise ArgumentError, "wrong number of arguments for rpc call (#{args.length} for #{method.expects.length})" unless args.length == method.expects.length
raise ArgumentError, "wrong number of arguments for rpc call (#{args.length} for #{method.expects.length})" if method && method.expects && args.length != method.expects.length
protocol.encode_request(public_method_name(service_name, api_method_name), args.dup, method.expects)
end

View file

@ -1,8 +1,8 @@
module ActionWebService
module VERSION #:nodoc:
MAJOR = 1
MINOR = 1
TINY = 6
MINOR = 2
TINY = 2
STRING = [MAJOR, MINOR, TINY].join('.')
end