Package shttp :: Module http :: Class HTTPServer
[hide private]
[frames] | no frames]

Class HTTPServer

source code

SocketServer.ThreadingMixIn --+    
                              |    
SocketServer.BaseServer --+   |    
                          |   |    
     SocketServer.TCPServer --+    
                              |    
SocketServer.ThreadingTCPServer --+
                                  |
SocketServer.BaseServer --+       |
                          |       |
     SocketServer.TCPServer --+   |
                              |   |
      BaseHTTPServer.HTTPServer --+
                                  |
                                 HTTPServer

Instance Methods [hide private]
 
__init__(self, server_address, HandlerClass=<class shttp.http.HTTPRequestHandler at 0x851cc2c>, ssl_privatekey_file=None, ssl_certificate_file=None, ssl_method=None, cgi_handlers=None, cgi_directories=None, document_root='.', request_queue_size=1024, show_errors=True, virtual_hosts=None)
Constructor.
source code
 
get_virtual_host(self, virtual_host='') source code
 
reuse_address(self) source code
 
server_bind(self)
Called by constructor to bind the socket.
source code
 
register_urihandler(self, uri, handler, virtual_host='')
Set an urihandler...
source code
 
unregister_urihandler(self, uri, virtual_host='')
Deletes the uri-handler associated to |uri| |virtual_host| The name of the virtual host, default to '' (default virtual host)
source code
 
helloworld(self, httpreq, environment) source code
 
regobj(self, uri, object, returntype='text/plain', authority=None) source code
 
regcall(self, uri, returntype='text/plain')
Register uri |uri| to be handled by a function...
source code
 
serve_forever(self)
Handles requestgs while self.process_next_request is True
source code
 
process_request(self, request, client_address)
Process one request, overloaded to support implement trusted SSL under heavy load
source code
 
close(self) source code

Inherited from SocketServer.ThreadingMixIn: process_request_thread

Inherited from SocketServer.TCPServer: close_request, fileno, get_request, server_activate, server_close

Inherited from SocketServer.BaseServer: finish_request, handle_error, handle_request, verify_request

Class Variables [hide private]
  allow_reuse_address = True

Inherited from SocketServer.ThreadingMixIn: daemon_threads

Inherited from SocketServer.TCPServer: address_family, request_queue_size, socket_type

Method Details [hide private]

__init__(self, server_address, HandlerClass=<class shttp.http.HTTPRequestHandler at 0x851cc2c>, ssl_privatekey_file=None, ssl_certificate_file=None, ssl_method=None, cgi_handlers=None, cgi_directories=None, document_root='.', request_queue_size=1024, show_errors=True, virtual_hosts=None)
(Constructor)

source code 
Constructor. May be extended, do not override.
Overrides: SocketServer.TCPServer.__init__
(inherited documentation)

server_bind(self)

source code 

Called by constructor to bind the socket.

May be overridden.
Overrides: SocketServer.TCPServer.server_bind

register_urihandler(self, uri, handler, virtual_host='')

source code 
Set an urihandler
|uri| The URI to be handled
|handler| a function that handles the event
|virtual_host| The name of the virtual host, default to '' (default virtual host)
Prototype:
    function(httpreq, environment)
    httpreq is an HTTPRequestHandler Object

regcall(self, uri, returntype='text/plain')

source code 
Register uri |uri| to be handled by a function
This method can be used safelly as decorator

Example
@httpobj.regcall('/selected-uri','text/html')
def square(x):
    int(x)
    return x*x

serve_forever(self)

source code 
Handles requestgs while self.process_next_request is True
Overrides: SocketServer.BaseServer.serve_forever

process_request(self, request, client_address)

source code 
Process one request, overloaded to support implement trusted SSL under heavy load
Overrides: SocketServer.ThreadingMixIn.process_request