Sha256: baf0537b3192ab9fcf5df634ddb391322e19562b3d18f6c229239e3af7a7ab3b
Contents?: true
Size: 1.6 KB
Versions: 2
Compression:
Stored size: 1.6 KB
Contents
#!/usr/local/bin/ruby require 'webrick' require "orbjson" include WEBrick Socket.do_not_reverse_lookup = true $logger = Logger.new( "orbjson.log" ) $logger.level = Logger::DEBUG s = HTTPServer.new( :Port => 2222, :DocumentRoot => File.dirname( __FILE__ ) ) s.mount("/json-rpc", Orbjson::WEBrick_JSON_RPC ) # These mounts are a handy way to to kill a WEBrick instance via a URL call, # useful mostly during debugging. Probably less useful when you've deployed # the applicaton. Consider removing these before going live. s.mount_proc( "/exit" ){|req, res| s.shutdown; exit; } s.mount_proc( "/quit" ){|req, res| s.shutdown; exit; } # You can configure the Orbjsn services list in a few ways. # Well, three, really: # 1. Pass in a path to a local YAML file; the path must begin with # 'file://' # For example: cfg = 'file://config.yaml' # Orbjson::System.init( cfg ) # # 2. Pass in some YAML: # cfg = 'services/sample: # - Details' # Orbjson::System.init( cfg ) # # 3. Pass in some an axtual Hash object: # cfg = { 'services/sample' => ['Details'] } # Orbjson::System.init( cfg ) # # The hash (however you express it) consists of 'require' paths mapped # to arrays of classes to instantiate. # Change this to suit your actual situation: If you use a configuration file, # # make sure you have the correct name, path, and contents. # This example expects to find the file 'config.yml' in the same dir # as server.rb cfg = "file://config.yml" Orbjson::System.init( cfg ) trap( "INT" ){ s.shutdown } trap( 1 ){ s.shutdown } s.start
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
Orbjson-0.0.3 | lib/skeleton/webrick/server.rb |
Orbjson-0.0.4 | lib/skeleton/webrick/server.rb |