Class: Orbjson::WEBrick_JSON_RPC

Inherits:
HTTPServlet::AbstractServlet
  • Object
show all
Includes:
Common
Defined in:
lib/orbjson.rb

Overview

Manages json-rpc requests sent as a post to a WEBrick servlet. Mount a path to WEBrick_JSON_RPC, and you should be set

Instance Method Summary collapse

Methods included from Common

#format_repsonse, #process

Instance Method Details

#do_GET(request, response) ⇒ Object

Delegates the call to process_request



198
199
200
# File 'lib/orbjson.rb', line 198

def do_GET( request, response )
  process_request( request, response, request.query_string )
end

#do_POST(request, response) ⇒ Object

Delegates the call to process_request



203
204
205
# File 'lib/orbjson.rb', line 203

def do_POST( request, response )
  process_request( request, response, request.body )    
end

#process_request(req, res, json) ⇒ Object

This initiats the actual message processing. Calls into the Common menthod ‘process’



192
193
194
195
# File 'lib/orbjson.rb', line 192

def process_request( req, res, json )
  res.body = process( json )
  res['Content-Type'] = "text/javascript"    
end