Package Gnumed :: Package proxiedpyjamas :: Module jsonserver :: Class SimpleJSONRPCRequestHandler
[frames] | no frames]

Class SimpleJSONRPCRequestHandler

source code

SocketServer.BaseRequestHandler --+            
                                  |            
  SocketServer.StreamRequestHandler --+        
                                      |        
  BaseHTTPServer.BaseHTTPRequestHandler --+    
                                          |    
  SimpleHTTPServer.SimpleHTTPRequestHandler --+
                                              |
                                             SimpleJSONRPCRequestHandler

Simple JSONRPC request handler class and HTTP GET Server

Handles all HTTP POST requests and attempts to decode them as JSONRPC requests.

Handles all HTTP GET requests and serves the content from the current directory.

Instance Methods
 
is_rpc_path_valid(self) source code
 
send_head(self)
Common code for GET and HEAD commands.
source code
 
list_directory(self, path)
Helper to produce a directory listing (absent index.html).
source code
 
send_error(self, code, message=None)
Send and log an error reply.
source code
 
do_POST(self)
Handles the HTTP POST request.
source code
 
report_404(self) source code
 
log_request(self, code='-', size='-')
Selectively log an accepted request.
source code

Inherited from SimpleHTTPServer.SimpleHTTPRequestHandler: copyfile, do_GET, do_HEAD, guess_type, translate_path

Inherited from BaseHTTPServer.BaseHTTPRequestHandler: address_string, date_time_string, end_headers, handle, handle_one_request, log_date_time_string, log_error, log_message, parse_request, send_header, send_response, version_string

Inherited from SocketServer.StreamRequestHandler: finish, setup

Inherited from SocketServer.BaseRequestHandler: __init__

Class Variables
  rpc_paths = '/', '/JSON'

Inherited from SimpleHTTPServer.SimpleHTTPRequestHandler: extensions_map, server_version

Inherited from BaseHTTPServer.BaseHTTPRequestHandler: MessageClass, default_request_version, error_content_type, error_message_format, monthname, protocol_version, responses, sys_version, weekdayname

Inherited from SocketServer.StreamRequestHandler: rbufsize, wbufsize

Method Details

send_head(self)

source code 

Common code for GET and HEAD commands.

This sends the response code and MIME headers.

Return value is either a file object (which has to be copied to the outputfile by the caller unless the command was HEAD, and must be closed by the caller under all circumstances), or None, in which case the caller has nothing further to do.

Overrides: SimpleHTTPServer.SimpleHTTPRequestHandler.send_head

list_directory(self, path)

source code 

Helper to produce a directory listing (absent index.html).

Return value is either a file object, or None (indicating an error). In either case, the headers are sent, making the interface the same as for send_head().

Overrides: SimpleHTTPServer.SimpleHTTPRequestHandler.list_directory

send_error(self, code, message=None)

source code 

Send and log an error reply.

Arguments are the error code, and a detailed message. The detailed message defaults to the short entry matching the response code.

This sends an error response (so it must be called before any output has been generated), logs the error, and finally sends a piece of HTML explaining the error to the user.

Overrides: BaseHTTPServer.BaseHTTPRequestHandler.send_error

do_POST(self)

source code 

Handles the HTTP POST request.

Attempts to interpret all HTTP POST requests as XML-RPC calls, which are forwarded to the server's _dispatch method for handling.

log_request(self, code='-', size='-')

source code 

Selectively log an accepted request.

Overrides: BaseHTTPServer.BaseHTTPRequestHandler.log_request