Class: XMLRPC::Server

Inherits:
WEBrickServlet show all
Defined in:
lib/xmlrpc/server.rb

Constant Summary

Constants inherited from BasicServer

BasicServer::ERR_MC_EXPECTED_STRUCT, BasicServer::ERR_MC_MISSING_METHNAME, BasicServer::ERR_MC_MISSING_PARAMS, BasicServer::ERR_MC_RECURSIVE_CALL, BasicServer::ERR_MC_WRONG_PARAM, BasicServer::ERR_MC_WRONG_PARAM_PARAMS, BasicServer::ERR_METHOD_MISSING, BasicServer::ERR_UNCAUGHT_EXCEPTION

Instance Method Summary collapse

Methods inherited from WEBrickServlet

#get_instance, #get_valid_ip, #require_path_info?, #service, #set_valid_ip

Methods inherited from BasicServer

#add_handler, #add_introspection, #add_multicall, #get_default_handler, #get_service_hook, #process, #set_default_handler, #set_service_hook

Methods included from ParseContentType

#parse_content_type

Methods included from ParserWriterChooseMixin

#set_parser, #set_writer

Constructor Details

#initialize(port = 8080, host = "127.0.0.1",, maxConnections = 4, stdlog = $stdout, audit = true, debug = true, *a) ⇒ Server

Returns a new instance of Server.



634
635
636
637
638
639
640
# File 'lib/xmlrpc/server.rb', line 634

def initialize(port=8080, host="127.0.0.1", maxConnections=4, stdlog=$stdout, audit=true, debug=true, *a)
  super(*a)
  require 'webrick'
  @server = WEBrick::HTTPServer.new(:Port => port, :BindAddress => host, :MaxClients => maxConnections, 
                                    :Logger => WEBrick::Log.new(stdlog))
  @server.mount("/", self)
end

Instance Method Details

#serveObject



642
643
644
645
646
647
648
649
650
651
# File 'lib/xmlrpc/server.rb', line 642

def serve
  if RUBY_PLATFORM =~ /mingw|mswin32/
    signals = [1]
  else
    signals = %w[INT TERM HUP]
  end
  signals.each { |signal| trap(signal) { @server.shutdown } }

  @server.start
end

#shutdownObject



653
654
655
# File 'lib/xmlrpc/server.rb', line 653

def shutdown
  @server.shutdown
end