Orbjson 0.0.1
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 +8 -0
- data/bin/orbjson +81 -0
- data/dep/handy/script/jsonrpc.js +187 -0
- data/dep/required/ruby-json/ruby-json-1.1.1.gem +0 -0
- data/docs/todo.txt +0 -0
- data/examples/cgi/Orbjson.log +66 -0
- data/examples/cgi/httpd.conf +12 -0
- data/examples/cgi/index.html +71 -0
- data/examples/cgi/json-rpc.rb +34 -0
- data/examples/cgi/orbjson_cgi.log +35 -0
- data/examples/cgi/script/jsonrpc.js +187 -0
- data/examples/cgi/services/sample.rb +21 -0
- data/examples/cgi/yellow_crossfade_01.gif +0 -0
- data/examples/webrick/config.yml +2 -0
- data/examples/webrick/index.html +69 -0
- data/examples/webrick/script/jsonrpc.js +187 -0
- data/examples/webrick/server.rb +28 -0
- data/examples/webrick/services/sample.rb +21 -0
- data/examples/webrick/yellow_crossfade_01.gif +0 -0
- data/lib/orbjson.rb +250 -0
- data/lib/skeleton/cgi/json-rpc.rb +60 -0
- data/lib/skeleton/script/jsonrpc.js +187 -0
- data/lib/skeleton/webrick/config.yml +2 -0
- data/lib/skeleton/webrick/server.rb +57 -0
- metadata +95 -0
data/README
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
README for Roy Orbjson , the JSON-RPC/Ruby ORB
|
2
|
+
|
3
|
+
Orbjson is a JSON-RPC ORB library that allows Web applications
|
4
|
+
to respond to JSON-RPC requests (including, but not limited to,
|
5
|
+
the XmlHttpRequest object), executing Ruby code on the server
|
6
|
+
but sending back JSON-serialized objects to the client.
|
7
|
+
|
8
|
+
|
data/bin/orbjson
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'orbjson'
|
4
|
+
require 'ftools'
|
5
|
+
|
6
|
+
SKEL_DIR = File.join( Orbjson::LibPath, 'skeleton')
|
7
|
+
|
8
|
+
|
9
|
+
def usage
|
10
|
+
puts <<-USAGE
|
11
|
+
|
12
|
+
NAME
|
13
|
+
orbjson - creates a new Orbjson application
|
14
|
+
|
15
|
+
SYNOPSIS
|
16
|
+
orbjson create-cgi [full path]
|
17
|
+
orbjson create-webrick [full path]
|
18
|
+
|
19
|
+
DESCRIPTION
|
20
|
+
This will create some basic files to get you started fleshing out
|
21
|
+
your Orbjson server application.
|
22
|
+
|
23
|
+
create-cgi creates a simple Ruby file to execute a CGI call and process
|
24
|
+
JSON-RPC calls
|
25
|
+
|
26
|
+
create-webrick creates a Ruby WEBrick server script and servlet to
|
27
|
+
process JSON-RPC calls
|
28
|
+
|
29
|
+
|
30
|
+
EXAMPLE
|
31
|
+
|
32
|
+
orbjson create-cgi ~/my-orbjson-project
|
33
|
+
|
34
|
+
This will generate a new Orbjson CGI application in the ~/my-orbjson-project
|
35
|
+
folder.
|
36
|
+
USAGE
|
37
|
+
exit 1
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
def run
|
42
|
+
case command = ARGV[0] || usage()
|
43
|
+
when 'create-cgi'
|
44
|
+
path = ARGV[1] || usage()
|
45
|
+
path = File.expand_path(path)
|
46
|
+
|
47
|
+
if File.exists?(path)
|
48
|
+
STDERR.puts "ERROR: Path #{ path } already exists! Aborting!"
|
49
|
+
exit 1
|
50
|
+
end
|
51
|
+
|
52
|
+
src = File.join(SKEL_DIR, 'cgi')
|
53
|
+
File.makedirs path
|
54
|
+
File.makedirs File.join(path, 'script')
|
55
|
+
File.copy File.join( src, 'json-rpc.rb' ), path, true
|
56
|
+
File.copy File.join( SKEL_DIR, 'script', 'jsonrpc.js' ), File.join( path, 'script'), true
|
57
|
+
|
58
|
+
when 'create-webrick'
|
59
|
+
path = ARGV[1] || usage()
|
60
|
+
path = File.expand_path(path)
|
61
|
+
|
62
|
+
if File.exists?(path)
|
63
|
+
STDERR.puts "ERROR: Path #{ path } already exists! Aborting!"
|
64
|
+
exit 1
|
65
|
+
end
|
66
|
+
|
67
|
+
src = File.join(SKEL_DIR, 'webrick')
|
68
|
+
File.makedirs path
|
69
|
+
File.makedirs File.join(path, 'script')
|
70
|
+
File.copy File.join( src, 'server.rb' ), path, true
|
71
|
+
File.copy File.join( src, 'config.yml' ), path, true
|
72
|
+
File.copy File.join( SKEL_DIR, 'script', 'jsonrpc.js' ), File.join( path, 'script'), true
|
73
|
+
else
|
74
|
+
usage()
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
run
|
79
|
+
|
80
|
+
# This script is based on Michael Neumann's Wee creator script.
|
81
|
+
# Nice work, Mike!
|
@@ -0,0 +1,187 @@
|
|
1
|
+
/*
|
2
|
+
* JSON-RPC JavaScript client
|
3
|
+
*
|
4
|
+
* $Id: jsonrpc.js,v 1.1.1.1 2005/02/28 03:06:30 jamesgbritt Exp $
|
5
|
+
*
|
6
|
+
* Copyright (c) 2003-2004 Jan-Klaas Kollhof
|
7
|
+
* Copyright (c) 2005 Michael Clark, Metaparadigm Pte Ltd
|
8
|
+
*
|
9
|
+
* This code is based on Jan-Klaas' JavaScript o lait library (jsolait).
|
10
|
+
*
|
11
|
+
* This library is free software; you can redistribute it and/or
|
12
|
+
* modify it under the terms of the GNU Lesser General Public (LGPL)
|
13
|
+
* License as published by the Free Software Foundation; either
|
14
|
+
* version 2.1 of the License, or (at your option) any later version.
|
15
|
+
*
|
16
|
+
* This library is distributed in the hope that it will be useful,
|
17
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
19
|
+
* Lesser General Public License for more details: http://www.gnu.org/
|
20
|
+
*
|
21
|
+
*/
|
22
|
+
|
23
|
+
// TODO: Add async
|
24
|
+
// TODO: Add HTTP auth (user, password)
|
25
|
+
|
26
|
+
Object.prototype.toJSON = function Object_toJSON() {
|
27
|
+
var v = [];
|
28
|
+
for(attr in this) {
|
29
|
+
if(this[attr] == null) v.push("\"" + attr + "\": null");
|
30
|
+
else if(typeof this[attr] == "function"); // skip
|
31
|
+
else v.push("\"" + attr + "\": " + this[attr].toJSON());
|
32
|
+
}
|
33
|
+
return "{" + v.join(", ") + "}";
|
34
|
+
}
|
35
|
+
|
36
|
+
String.prototype.toJSON = function String_toJSON() {
|
37
|
+
return "\"" + this.replace(/([\"\\])/g, "\\$1") + "\"";
|
38
|
+
}
|
39
|
+
|
40
|
+
Number.prototype.toJSON = function Number_toJSON() {
|
41
|
+
return this.toString();
|
42
|
+
}
|
43
|
+
|
44
|
+
Boolean.prototype.toJSON = function Boolean_toJSON() {
|
45
|
+
return this.toString();
|
46
|
+
}
|
47
|
+
|
48
|
+
Date.prototype.toJSON = function Date_toJSON() {
|
49
|
+
this.valueOf().toString();
|
50
|
+
}
|
51
|
+
|
52
|
+
Array.prototype.toJSON = function Array_toJSON() {
|
53
|
+
var v = [];
|
54
|
+
for(var i=0; i<this.length; i++) {
|
55
|
+
if(this[i] == null) v.push("null");
|
56
|
+
else v.push(this[i].toJSON());
|
57
|
+
}
|
58
|
+
return "[" + v.join(", ") + "]";
|
59
|
+
}
|
60
|
+
|
61
|
+
JSONRpcClient = function JSONRpcClient_ctor(serverURL, objectID) {
|
62
|
+
this.serverURL = serverURL;
|
63
|
+
this.objectID = objectID;
|
64
|
+
|
65
|
+
// Lazy initialization of the XMLHttpRequest singleton
|
66
|
+
if(!JSONRpcClient.http)
|
67
|
+
JSONRpcClient.http = JSONRpcClient.getHTTPRequest();
|
68
|
+
|
69
|
+
// Add standard methods
|
70
|
+
this.addMethods(["system.listMethods"]);
|
71
|
+
|
72
|
+
// Query the methods on the server and add them to this object
|
73
|
+
var m = this.sendRequest("system.listMethods", []);
|
74
|
+
this.addMethods(m);
|
75
|
+
}
|
76
|
+
|
77
|
+
JSONRpcClient.Exception = function JSONRpcClient_Exception_ctor(code, msg) {
|
78
|
+
this.code = code;
|
79
|
+
this.msg = msg;
|
80
|
+
}
|
81
|
+
|
82
|
+
JSONRpcClient.Exception.prototype.toString =
|
83
|
+
function JSONRpcClient_Exception_toString(code, msg) {
|
84
|
+
return "JSONRpcClientException: " + this.msg;
|
85
|
+
}
|
86
|
+
|
87
|
+
JSONRpcClient.Method =
|
88
|
+
function JSONRpcClient_Method_ctor(client, methodName) {
|
89
|
+
var fn=function() {
|
90
|
+
var args = [];
|
91
|
+
for(var i=0;i<arguments.length;i++) {
|
92
|
+
args.push(arguments[i]);
|
93
|
+
}
|
94
|
+
return fn.client.sendRequest.call(fn.client, fn.methodName, args);
|
95
|
+
}
|
96
|
+
fn.client = client;
|
97
|
+
fn.methodName = methodName;
|
98
|
+
return fn;
|
99
|
+
}
|
100
|
+
|
101
|
+
JSONRpcClient.prototype.addMethods =
|
102
|
+
function JSONRpcClient_addMethods(methodNames) {
|
103
|
+
for(var i=0; i<methodNames.length; i++) {
|
104
|
+
var obj = this;
|
105
|
+
var names = methodNames[i].split(".");
|
106
|
+
for(var n=0; n<names.length-1; n++){
|
107
|
+
var name = names[n];
|
108
|
+
if(obj[name]){
|
109
|
+
obj = obj[name];
|
110
|
+
}
|
111
|
+
else {
|
112
|
+
obj[name] = new Object();
|
113
|
+
obj = obj[name];
|
114
|
+
}
|
115
|
+
}
|
116
|
+
var name = names[names.length-1];
|
117
|
+
if(!obj[name]){
|
118
|
+
var method = new JSONRpcClient.Method(this, methodNames[i]);
|
119
|
+
obj[name] = method;
|
120
|
+
}
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
JSONRpcClient.prototype.sendRequest =
|
125
|
+
function JSONRpcClient_sendRequest(methodName, args) {
|
126
|
+
// Make request object
|
127
|
+
var obj = {"method" : methodName, "params" : args};
|
128
|
+
if (this.objectID) obj.objectID = this.objectID;
|
129
|
+
|
130
|
+
// Marshall the request object to a JSON string
|
131
|
+
var req_data = obj.toJSON();
|
132
|
+
|
133
|
+
// Send the request
|
134
|
+
JSONRpcClient.http.open("POST", this.serverURL, false); // no async
|
135
|
+
// setRequestHeader is missing in Opera 8 Beta
|
136
|
+
try {
|
137
|
+
JSONRpcClient.http.setRequestHeader("Content-type", "text/plain");
|
138
|
+
}
|
139
|
+
catch(e) {}
|
140
|
+
JSONRpcClient.http.send(req_data);
|
141
|
+
|
142
|
+
// Unmarshall the response
|
143
|
+
// DEBUG
|
144
|
+
try {
|
145
|
+
eval("var obj = " + JSONRpcClient.http.responseText);
|
146
|
+
}
|
147
|
+
catch(e) {
|
148
|
+
alert( e )
|
149
|
+
alert( JSONRpcClient.http.responseText )
|
150
|
+
obj.err = e.toString()
|
151
|
+
}
|
152
|
+
if( obj.error) {
|
153
|
+
alert( JSONRpcClient.http.responseText )
|
154
|
+
throw new JSONRpcClient.Exception(obj.error.code, obj.error.msg);
|
155
|
+
}
|
156
|
+
var res = obj.result;
|
157
|
+
|
158
|
+
// Handle CallableProxy
|
159
|
+
if(res && res.objectID && res.JSONRPCType == "CallableReference")
|
160
|
+
return new JSONRpcClient(this.serverURL, res.objectID);
|
161
|
+
|
162
|
+
return res;
|
163
|
+
}
|
164
|
+
|
165
|
+
JSONRpcClient.getHTTPRequest = function JSONRpcClient_getHTTPRequest() {
|
166
|
+
try { // to get the mozilla httprequest object
|
167
|
+
return new XMLHttpRequest();
|
168
|
+
}
|
169
|
+
catch(e) {}
|
170
|
+
|
171
|
+
try { // to get MS HTTP request object
|
172
|
+
return new ActiveXObject("Msxml2.XMLHTTP.4.0");
|
173
|
+
}
|
174
|
+
catch(e) {}
|
175
|
+
|
176
|
+
try { // to get MS HTTP request object
|
177
|
+
return new ActiveXObject("Msxml2.XMLHTTP");
|
178
|
+
}
|
179
|
+
catch(e) {}
|
180
|
+
|
181
|
+
try {// to get the old MS HTTP request object
|
182
|
+
return new ActiveXObject("microsoft.XMLHTTP");
|
183
|
+
}
|
184
|
+
catch(e) {}
|
185
|
+
|
186
|
+
throw new JSONRpcClient.Exception(0, "Can't create XMLHttpRequest object");
|
187
|
+
}
|
Binary file
|
data/docs/todo.txt
ADDED
File without changes
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# Logfile created on Sun Feb 27 14:21:31 US Mountain Standard Time 2005 by logger.rb/1.5.2.4
|
2
|
+
E, [2005-02-27T14:23:55.456000 #1664] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Logs
|
3
|
+
E, [2005-02-27T14:23:55.456000 #1664] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Definition_context_factory
|
4
|
+
E, [2005-02-27T14:23:55.456000 #1664] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Log_for
|
5
|
+
E, [2005-02-27T14:23:55.456000 #1664] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Namespace_impl_factory
|
6
|
+
E, [2005-02-27T14:23:55.456000 #1664] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Service_models
|
7
|
+
E, [2005-02-27T14:23:55.456000 #1664] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Interceptor_impl_factory
|
8
|
+
E, [2005-02-27T14:23:55.456000 #1664] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Pipeline_elements
|
9
|
+
E, [2005-02-27T14:23:55.466000 #1664] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Logging_interceptor
|
10
|
+
E, [2005-02-27T14:25:10.253000 #1984] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Logs
|
11
|
+
E, [2005-02-27T14:25:10.253000 #1984] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Definition_context_factory
|
12
|
+
E, [2005-02-27T14:25:10.253000 #1984] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Log_for
|
13
|
+
E, [2005-02-27T14:25:10.253000 #1984] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Namespace_impl_factory
|
14
|
+
E, [2005-02-27T14:25:10.253000 #1984] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Service_models
|
15
|
+
E, [2005-02-27T14:25:10.253000 #1984] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Interceptor_impl_factory
|
16
|
+
E, [2005-02-27T14:25:10.253000 #1984] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Pipeline_elements
|
17
|
+
E, [2005-02-27T14:25:10.263000 #1984] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Logging_interceptor
|
18
|
+
E, [2005-02-27T14:27:13.460000 #1396] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Logs
|
19
|
+
E, [2005-02-27T14:27:13.470000 #1396] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Definition_context_factory
|
20
|
+
E, [2005-02-27T14:27:13.480000 #1396] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Log_for
|
21
|
+
E, [2005-02-27T14:27:13.480000 #1396] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Namespace_impl_factory
|
22
|
+
E, [2005-02-27T14:27:13.480000 #1396] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Service_models
|
23
|
+
E, [2005-02-27T14:27:13.480000 #1396] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Interceptor_impl_factory
|
24
|
+
E, [2005-02-27T14:27:13.480000 #1396] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Pipeline_elements
|
25
|
+
E, [2005-02-27T14:27:13.480000 #1396] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Logging_interceptor
|
26
|
+
E, [2005-02-27T14:28:39.083000 #124] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Logs
|
27
|
+
E, [2005-02-27T14:28:39.183000 #124] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Definition_context_factory
|
28
|
+
E, [2005-02-27T14:28:39.183000 #124] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Log_for
|
29
|
+
E, [2005-02-27T14:28:39.183000 #124] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Namespace_impl_factory
|
30
|
+
E, [2005-02-27T14:28:39.183000 #124] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Service_models
|
31
|
+
E, [2005-02-27T14:28:39.183000 #124] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Interceptor_impl_factory
|
32
|
+
E, [2005-02-27T14:28:39.194000 #124] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Pipeline_elements
|
33
|
+
E, [2005-02-27T14:28:39.194000 #124] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Logging_interceptor
|
34
|
+
E, [2005-02-27T14:29:18.710000 #1944] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Logs
|
35
|
+
E, [2005-02-27T14:29:18.710000 #1944] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Definition_context_factory
|
36
|
+
E, [2005-02-27T14:29:18.710000 #1944] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Log_for
|
37
|
+
E, [2005-02-27T14:29:18.710000 #1944] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Namespace_impl_factory
|
38
|
+
E, [2005-02-27T14:29:18.710000 #1944] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Service_models
|
39
|
+
E, [2005-02-27T14:29:18.710000 #1944] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Interceptor_impl_factory
|
40
|
+
E, [2005-02-27T14:29:18.710000 #1944] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Pipeline_elements
|
41
|
+
E, [2005-02-27T14:29:18.720000 #1944] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Logging_interceptor
|
42
|
+
E, [2005-02-27T14:30:13.149000 #336] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Logs
|
43
|
+
E, [2005-02-27T14:30:13.149000 #336] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Definition_context_factory
|
44
|
+
E, [2005-02-27T14:30:13.149000 #336] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Sample
|
45
|
+
E, [2005-02-27T14:30:13.149000 #336] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Log_for
|
46
|
+
E, [2005-02-27T14:30:13.159000 #336] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Namespace_impl_factory
|
47
|
+
E, [2005-02-27T14:30:13.159000 #336] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Service_models
|
48
|
+
E, [2005-02-27T14:30:13.159000 #336] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Interceptor_impl_factory
|
49
|
+
E, [2005-02-27T14:30:13.159000 #336] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Pipeline_elements
|
50
|
+
E, [2005-02-27T14:30:13.159000 #336] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Logging_interceptor
|
51
|
+
E, [2005-02-27T14:30:45.445000 #1752] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Logs
|
52
|
+
E, [2005-02-27T14:30:45.445000 #1752] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Definition_context_factory
|
53
|
+
E, [2005-02-27T14:30:45.445000 #1752] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Log_for
|
54
|
+
E, [2005-02-27T14:30:45.445000 #1752] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Namespace_impl_factory
|
55
|
+
E, [2005-02-27T14:30:45.445000 #1752] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Service_models
|
56
|
+
E, [2005-02-27T14:30:45.445000 #1752] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Interceptor_impl_factory
|
57
|
+
E, [2005-02-27T14:30:45.445000 #1752] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Pipeline_elements
|
58
|
+
E, [2005-02-27T14:30:45.445000 #1752] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Logging_interceptor
|
59
|
+
E, [2005-02-27T14:35:55.901000 #2064] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Logs
|
60
|
+
E, [2005-02-27T14:35:55.921000 #2064] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Definition_context_factory
|
61
|
+
E, [2005-02-27T14:35:55.921000 #2064] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Log_for
|
62
|
+
E, [2005-02-27T14:35:55.921000 #2064] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Namespace_impl_factory
|
63
|
+
E, [2005-02-27T14:35:55.921000 #2064] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Service_models
|
64
|
+
E, [2005-02-27T14:35:55.921000 #2064] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Interceptor_impl_factory
|
65
|
+
E, [2005-02-27T14:35:55.921000 #2064] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Pipeline_elements
|
66
|
+
E, [2005-02-27T14:35:55.921000 #2064] ERROR -- : System#list_methods error (eval):1:in `list_methods': uninitialized constant Orbjson::System::Logging_interceptor
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<Directory D:\development\RubyForge\orbjson\examples\cgi >
|
2
|
+
DirectoryIndex index.html index.rbx index.rb
|
3
|
+
AllowOverride All
|
4
|
+
Options MultiViews SymLinksIfOwnerMatch ExecCGI
|
5
|
+
AllowOverride All
|
6
|
+
<Files ~ "\.(rb|rbx|cgi)$" >
|
7
|
+
SetHandler cgi-script
|
8
|
+
</Files>
|
9
|
+
|
10
|
+
</Directory>
|
11
|
+
|
12
|
+
|
@@ -0,0 +1,71 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
5
|
+
<title>Metatagging</title>
|
6
|
+
<script type="text/javascript" src="script/jsonrpc.js"></script>
|
7
|
+
<script language="javascript" type="text/javascript">
|
8
|
+
<!-- Make sure this URL makes sense for your set-up -->
|
9
|
+
var jsonurl = "http://127.0.0.1/orbjson/json-rpc.rb";
|
10
|
+
|
11
|
+
var jsonrpc = null;
|
12
|
+
|
13
|
+
function init() {
|
14
|
+
jsonrpc = new JSONRpcClient( jsonurl );
|
15
|
+
}
|
16
|
+
|
17
|
+
function show_details( topic ) {
|
18
|
+
var el = document.getElementById( 'details' );
|
19
|
+
var html = jsonrpc.details.fetch( topic)
|
20
|
+
el.innerHTML = html;
|
21
|
+
}
|
22
|
+
|
23
|
+
</script>
|
24
|
+
|
25
|
+
<style type="text/css">
|
26
|
+
#metatagFields #reset {
|
27
|
+
text-align: right;
|
28
|
+
}
|
29
|
+
body {
|
30
|
+
font-family: Verdana, Arial, Helvetica, sans-serif;
|
31
|
+
color: #666666;
|
32
|
+
}
|
33
|
+
a {
|
34
|
+
text-decoration: none;
|
35
|
+
}
|
36
|
+
|
37
|
+
fieldset {
|
38
|
+
background-image: url(yellow_crossfade_01.gif);
|
39
|
+
background-repeat: repeat-y;
|
40
|
+
background-position: left top;
|
41
|
+
}
|
42
|
+
|
43
|
+
#metatagFields {
|
44
|
+
width: 300px;
|
45
|
+
margin-top: 10px;
|
46
|
+
}
|
47
|
+
|
48
|
+
#metatagFields legend {
|
49
|
+
background-color: #FFFFFF;
|
50
|
+
border: 1px dashed #333333;
|
51
|
+
}
|
52
|
+
</style>
|
53
|
+
|
54
|
+
</head>
|
55
|
+
<body onload='init()' >
|
56
|
+
|
57
|
+
<div id='instructions'>Select a topic to seee more about it</div>
|
58
|
+
<div id='curentItemList'>
|
59
|
+
<a href='javascript:show_details( "JSON")'>JSON</a>, <a href='javascript:show_details( "JSON-RPC")'>JSON-RPC</a>, <a href='javascript:show_details( "Ruby")' >Ruby</a>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id='currentSelectionSet'>
|
63
|
+
<form name='metatagForm' action='#' method="get">
|
64
|
+
<fieldset id='metatagFields'>
|
65
|
+
<legend>Topic info</legend>
|
66
|
+
<div id='details'></div>
|
67
|
+
</fieldset>
|
68
|
+
</form>
|
69
|
+
</div>
|
70
|
+
</body>
|
71
|
+
</html>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/local/bin/ruby
|
2
|
+
|
3
|
+
|
4
|
+
require 'cgi'
|
5
|
+
require 'rubygems'
|
6
|
+
require "orbjson"
|
7
|
+
require 'logger'
|
8
|
+
|
9
|
+
include Orbjson
|
10
|
+
|
11
|
+
|
12
|
+
$logger = Logger.new( "orbjson_cgi.log" )
|
13
|
+
$logger.level = Logger::DEBUG
|
14
|
+
|
15
|
+
$logger.debug( "Have a request!" )
|
16
|
+
|
17
|
+
# You can config the
|
18
|
+
cfg = 'services/sample:
|
19
|
+
- Details'
|
20
|
+
json_rpc = CGI_JSON_RPC.new( cfg )
|
21
|
+
|
22
|
+
print "content-type: text/javascript\n\n"
|
23
|
+
res = json_rpc.process_request
|
24
|
+
$logger.debug( "Have a resposne:\n#{res}" )
|
25
|
+
|
26
|
+
print res
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# Logfile created on Sun Feb 27 14:21:31 US Mountain Standard Time 2005 by logger.rb/1.5.2.4
|
2
|
+
D, [2005-02-27T14:28:39.063000 #124] DEBUG -- : Have a request!
|
3
|
+
D, [2005-02-27T14:29:18.680000 #1944] DEBUG -- : Have a request!
|
4
|
+
D, [2005-02-27T14:29:18.720000 #1944] DEBUG -- : Have a resposne:
|
5
|
+
{ "result" : ["system.listMethods","system.listMethods","sample.calls_so_far","sample.complex_struct","sample.foo","sample.foo=","sample.metatag_sets","sample.tag_list"], "error":"", "id": "default" }
|
6
|
+
D, [2005-02-27T14:30:13.129000 #336] DEBUG -- : Have a request!
|
7
|
+
D, [2005-02-27T14:30:13.159000 #336] DEBUG -- : Have a resposne:
|
8
|
+
{ "result" : ["system.listMethods","system.listMethods"], "error":"", "id": "default" }
|
9
|
+
D, [2005-02-27T14:30:45.415000 #1752] DEBUG -- : Have a request!
|
10
|
+
D, [2005-02-27T14:30:45.455000 #1752] DEBUG -- : Have a resposne:
|
11
|
+
{ "result" : ["system.listMethods","system.listMethods","details.fetch"], "error":"", "id": "default" }
|
12
|
+
D, [2005-02-27T14:30:48.840000 #1596] DEBUG -- : Have a request!
|
13
|
+
D, [2005-02-27T14:30:48.870000 #1596] DEBUG -- : Have a resposne:
|
14
|
+
{ "result" : "It's got soul, and it's super bad!", "error":"", "id": "default" }
|
15
|
+
D, [2005-02-27T14:30:52.415000 #1752] DEBUG -- : Have a request!
|
16
|
+
D, [2005-02-27T14:30:52.445000 #1752] DEBUG -- : Have a resposne:
|
17
|
+
{ "result" : "It's got soul, and it's super bad!", "error":"", "id": "default" }
|
18
|
+
D, [2005-02-27T14:31:00.076000 #1596] DEBUG -- : Have a request!
|
19
|
+
D, [2005-02-27T14:31:00.106000 #1596] DEBUG -- : Have a resposne:
|
20
|
+
{ "result" : "Like XML-RPC, but use JSON as the wire format.", "error":"", "id": "default" }
|
21
|
+
D, [2005-02-27T14:31:03.491000 #1752] DEBUG -- : Have a request!
|
22
|
+
D, [2005-02-27T14:31:03.511000 #1752] DEBUG -- : Have a resposne:
|
23
|
+
{ "result" : "A serialization format for transmitting native JavaScript objects as plain text.", "error":"", "id": "default" }
|
24
|
+
D, [2005-02-27T14:33:10.594000 #1396] DEBUG -- : Have a request!
|
25
|
+
D, [2005-02-27T14:33:10.624000 #1396] DEBUG -- : Have a resposne:
|
26
|
+
{ "result" : "It's got soul, and it's super bad!", "error":"", "id": "default" }
|
27
|
+
D, [2005-02-27T14:35:55.861000 #2064] DEBUG -- : Have a request!
|
28
|
+
D, [2005-02-27T14:35:55.921000 #2064] DEBUG -- : Have a resposne:
|
29
|
+
{ "result" : ["system.listMethods","system.listMethods","details.fetch"], "error":"", "id": "default" }
|
30
|
+
D, [2005-02-27T14:36:01.119000 #2076] DEBUG -- : Have a request!
|
31
|
+
D, [2005-02-27T14:36:01.139000 #2076] DEBUG -- : Have a resposne:
|
32
|
+
{ "result" : "It's got soul, and it's super bad!", "error":"", "id": "default" }
|
33
|
+
D, [2005-02-27T14:36:09.431000 #1588] DEBUG -- : Have a request!
|
34
|
+
D, [2005-02-27T14:36:09.451000 #1588] DEBUG -- : Have a resposne:
|
35
|
+
{ "result" : "Like XML-RPC, but use JSON as the wire format.", "error":"", "id": "default" }
|