Orbjson 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,57 +0,0 @@
1
- #!/usr/local/bin/ruby
2
- require 'webrick'
3
-
4
- require "orbjson"
5
- include WEBrick
6
-
7
-
8
- Socket.do_not_reverse_lookup = true
9
-
10
- $logger = Logger.new( "orbjson.log" )
11
- $logger.level = Logger::DEBUG
12
-
13
- s = HTTPServer.new( :Port => 2222,
14
- :DocumentRoot => File.dirname( __FILE__ ) )
15
-
16
- s.mount("/json-rpc", Orbjson::WEBrick_JSON_RPC )
17
-
18
-
19
- # These mounts are a ahandy way to to kill a WEBrick instance via URL,
20
- # useful mostly during debugging. Probably less useful when you've deployed
21
- # the applicaton. Consider removing these before going live.
22
- s.mount_proc( "/exit" ){|req, res| s.shutdown; exit; }
23
- s.mount_proc( "/quit" ){|req, res| s.shutdown; exit; }
24
-
25
-
26
- # You can configure the Orbjsn services list in a few ways.
27
- # Well, three, really:
28
- # 1. Pass in a path to a local YAML file; the path must begin with
29
- # 'file://'
30
- # For example: cfg = 'file://config.yaml'
31
- # Orbjson::System.init( cfg )
32
- #
33
- # 2. Pass in some YAML:
34
- # cfg = 'services/sample:
35
- # - Details'
36
- # Orbjson::System.init( cfg )
37
- #
38
- # 3. Pass in some an atual Hash objectL:
39
- # cfg = { 'services/sample' => ['Details'] }
40
- # Orbjson::System.init( cfg )
41
- #
42
- # The hash (however you express it) consists of 'require' paths mapped
43
- # to arrays of classes to instantiate.
44
-
45
-
46
- # Change this to suit your actual situation: If you use a configuration file,
47
- # # mkae sure you have the correct name, path, and contents.
48
- # This example expects to find the file config.yml in the same dir
49
- # as server.rb
50
- cfg = "file://config.yml"
51
- Orbjson::System.init( cfg )
52
-
53
-
54
- trap( "INT" ){ s.shutdown }
55
- trap( 1 ){ s.shutdown }
56
- s.start
57
-