Orbjson 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +27 -4
- data/bin/orbjson +8 -2
- data/docs/getting_started_with_orbjson_short_version.pdf +0 -0
- data/docs/tutorial_code.tgz +0 -0
- data/examples/cgi/script/jsonrpc.js +1 -1
- data/examples/cgi/script/jsonrpc_async.js +260 -0
- data/examples/webrick/index.html +1 -1
- data/examples/webrick/{index.html,bak → index_async.html} +77 -69
- data/examples/webrick/script/jsonrpc.js +1 -1
- data/examples/webrick/script/jsonrpc_async.js +262 -0
- data/examples/webrick/server.rb +1 -1
- data/lib/orbjson.rb +72 -43
- data/lib/skeleton/script/jsonrpc.js +1 -1
- data/lib/skeleton/script/jsonrpc_async.js +261 -0
- data/lib/skeleton/webrick/config.yml +3 -2
- data/lib/utils.rb +29 -0
- metadata +11 -26
- data/dep/handy/script/jsonrpc.js +0 -187
- data/dep/handy/script/jsonrpc.js,bak +0 -187
- data/dep/required/ruby-json/ruby-json-1.1.1.gem +0 -0
- data/docs/todo.txt +0 -0
- data/examples/cgi/Orbjson.log +0 -66
- data/examples/cgi/index.html,bak +0 -71
- data/examples/cgi/json-rpc.rb,bak +0 -34
- data/examples/cgi/orbjson_cgi.log +0 -35
- data/examples/cgi/script/jsonrpc.js,bak +0 -187
- data/examples/cgi/services/sample.rb,bak +0 -21
- data/examples/webrick/Orbjson.log +0 -49
- data/examples/webrick/script/jsonrpc.js,bak +0 -187
- data/examples/webrick/server.rb,bak +0 -28
- data/examples/webrick/services/sample.rb,bak +0 -21
- data/lib/skeleton/cgi/json-rpc.rb,bak +0 -60
- data/lib/skeleton/script/jsonrpc.js,bak +0 -187
- data/lib/skeleton/webrick/server.rb,bak +0 -57
@@ -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
|
-
|