core.http | index

`This module adds the http support to the python vert.x platform`

Modules

``

core |  |  |

Classes

``

__builtin__.object
  HttpClient(core.ssl_support.SSLSupport, core.tcp_support.TCPSupport, __builtin__.object)
  HttpServer(core.tcp_support.TCPSupport, core.ssl_support.SSLSupport, __builtin__.object)
  RouteMatcher
core.ssl_support.SSLSupport(__builtin__.object)
  HttpClient(core.ssl_support.SSLSupport, core.tcp_support.TCPSupport, __builtin__.object)
  HttpServer(core.tcp_support.TCPSupport, core.ssl_support.SSLSupport, __builtin__.object)
core.streams.ReadStream(__builtin__.object)
  HttpClientResponse
  HttpServerRequest
  WebSocket(core.streams.ReadStream, core.streams.WriteStream)
    ServerWebSocket
core.streams.WriteStream(__builtin__.object)
  HttpClientRequest
  HttpServerResponse
  WebSocket(core.streams.ReadStream, core.streams.WriteStream)
    ServerWebSocket
core.tcp_support.TCPSupport(__builtin__.object)
  HttpClient(core.ssl_support.SSLSupport, core.tcp_support.TCPSupport, __builtin__.object)
  HttpServer(core.tcp_support.TCPSupport, core.ssl_support.SSLSupport, __builtin__.object)
org.vertx.java.core.Handler(java.lang.Object)
  org.python.proxies.core.http$HttpClientResponseHandler$12(org.vertx.java.core.Handler, java.lang.Object)
    HttpClientResponseHandler
  org.python.proxies.core.http$HttpServerRequestHandler$11(org.vertx.java.core.Handler, java.lang.Object)
    HttpServerRequestHandler
  org.python.proxies.core.http$ServerWebSocketHandler$13(org.vertx.java.core.Handler, java.lang.Object)
    ServerWebSocketHandler
  org.python.proxies.core.http$WebSocketHandler$14(org.vertx.java.core.Handler, java.lang.Object)
    WebSocketHandler

class HttpClient(core.ssl_support.SSLSupport, core.tcp_support.TCPSupport, __builtin__.object)
`` | `An HTTP client. A client maintains a pool of connections to a specific host, at a specific port. The HTTP connections can act as pipelines for HTTP requests. It is used as a factory for HttpClientRequest instances which encapsulate the actual HTTP requests. It is also used as a factory for HTML5 WebSocket websockets.`

Method resolution order:
  HttpClient
  core.ssl_support.SSLSupport
  core.tcp_support.TCPSupport
  __builtin__.object

Methods defined here:

__init__(self, **kwargs)

close(self)
  `Close the client. Any unclosed connections will be closed.`

connect(self, uri, handler)
  `This method returns an HttpClientRequest instance which represents an HTTP CONNECT request with the specified uri.
  When an HTTP response is received from the server the handler is called passing in the response.
  Keyword arguments:
  @param uri: A relative URI where to perform the CONNECT on the server.
  @param handler: The handler to be called with the HttpClientResponse`

connect_web_socket(self, uri, handler)
  `Attempt to connect an HTML5 websocket to the specified URI.
  The connect is done asynchronously and the handler is called with a WebSocket on success.
  Keyword arguments:
  @param uri: A relative URI where to connect the websocket on the host, e.g. /some/path
  @param handler: The handler to be called with the WebSocket`

delete(self, uri, handler)
  `This method returns an HttpClientRequest instance which represents an HTTP DELETE request with the specified uri.
  When an HTTP response is received from the server the handler is called passing in the response.
  Keyword arguments:
  @param uri: A relative URI where to perform the DELETE on the server.
  @param handler: The handler to be called with the HttpClientResponse`

exception_handler(self, handler)
  `Set the exception handler.
  Keyword arguments:
  @param handler: function to be used as the handler`

get(self, uri, handler)
  `This method returns an HttpClientRequest instance which represents an HTTP GET request with the specified uri.
  When an HTTP response is received from the server the handler is called passing in the response.
  Keyword arguments:
  @param uri: A relative URI where to perform the GET on the server.
  @param handler: The handler to be called with the HttpClientResponse`

get_max_pool_size(self)
  `The maxium number of connections this client will pool.`

get_now(self, uri, handler, **headers)
  `This is a quick version of the get method where you do not want to do anything with the request
  before sing.
  With this method the request is immediately sent.
  When an HTTP response is received from the server the handler is called passing in the response.
  Keyword arguments:
  @param uri: A relative URI where to perform the GET on the server.
  @param handler: The handler to be called with the HttpClientResponse
  @param headers: A dictionary of headers to pass with the request.`

head(self, uri, handler)
  `This method returns an HttpClientRequest instance which represents an HTTP HEAD request with the specified uri.
  When an HTTP response is received from the server the handler is called passing in the response.
  Keyword arguments:
  @param uri: A relative URI where to perform the HEAD on the server.
  @param handler: The handler to be called with the HttpClientResponse`

options(self, uri, handler)
  `This method returns an HttpClientRequest instance which represents an HTTP OPTIONS request with the specified uri.
  When an HTTP response is received from the server the handler is called passing in the response.
  Keyword arguments:
  @param uri: A relative URI where to perform the OPTIONS on the server.
  @param handler: The handler to be called with the HttpClientResponse`

patch(self, uri, handler)
  `This method returns an HttpClientRequest instance which represents an HTTP PATCH request with the specified uri.
  When an HTTP response is received from the server the handler is called passing in the response.
  Keyword arguments:
  @param uri: A relative URI where to perform the PATCH on the server.
  @param handler: The handler to be called with the HttpClientResponse`

post(self, uri, handler)
  `This method returns an HttpClientRequest instance which represents an HTTP POST request with the specified uri.
  When an HTTP response is received from the server the handler is called passing in the response.
  Keyword arguments:
  @param uri: A relative URI where to perform the POST on the server.
  @param handler: The handler to be called with the HttpClientResponse`

put(self, uri, handler)
  `This method returns an HttpClientRequest instance which represents an HTTP PUT request with the specified uri.
  When an HTTP response is received from the server the handler is called passing in the response.
  Keyword arguments:
  @param uri: A relative URI where to perform the PUT on the server.
  @param handler: The handler to be called with the HttpClientResponse`

request(self, method, uri, handler)
  `This method returns an HttpClientRequest instance which represents an HTTP request with the specified method and uri.
  When an HTTP response is received from the server the handler is called passing in the response.
  method. The HTTP method. Can be one of OPTIONS, HEAD, GET, POST, PUT, DELETE, TRACE, CONNECT.
  Keyword arguments:
  @param uri: A relative URI where to perform the OPTIONS on the server.
  @param handler: The handler to be called with the HttpClientResponse`

set_host(self, val)
  `Set the host name or ip address that the client will attempt to connect to on the server on.
  Keyword arguments:
  @param val: The host name or ip address to connect to.`

set_keep_alive(self, val)
  `If val is true then, after the request has ended the connection will be returned to the pool
  where it can be used by another request. In this manner, many HTTP requests can be pipe-lined over an HTTP connection.
  Keep alive connections will not be closed until the close method is invoked.
  If val is false then a new connection will be created for each request and it won't ever go in the pool,
  the connection will closed after the response has been received. Even with no keep alive, the client will not allow more
  than max_pool_size connections to be created at any one time.
  Keyword arguments:
  @param val: The value to use for keep_alive`

set_max_pool_size(self, val)
  `Set the maximum pool size.
  The client will maintain up to this number of HTTP connections in an internal pool
  Keyword arguments:
  @param val: The maximum number of connections (default to 1).`

set_port(self, val)
  `Set the port that the client will attempt to connect to on the server on. The default value is 80
  Keyword arguments:
  @param val: The port value.`

set_trust_all(self, val)
  `Should the client trust ALL server certificates?
  Keyword arguments:
  @param val: If val is set to true then the client will trust ALL server certificates and will not attempt to authenticate them
  against it's local client trust store. The default value is false.
  Use this method with caution!`

trace(self, uri, handler)
  `This method returns an HttpClientRequest instance which represents an HTTP TRACE request with the specified uri.
  When an HTTP response is received from the server the handler is called passing in the response.
  Keyword arguments:
  @param uri: A relative URI where to perform the TRACE on the server.
  handler. The handler to be called with the HttpClientResponse`

Data descriptors defined here:

host

keep_alive

max_pool_size
  `The maxium number of connections this client will pool.`

port

trust_all

Methods inherited from core.ssl_support.SSLSupport:

set_key_store_password(self, password)
  `Set the password for the SSL key store. This method should only be used with the client in SSL mode, i.e. after ssl
  has been set to true.
  Keyword arguments:
  @param password: The password.
  return self. So multiple invocations can be chained.`

set_key_store_path(self, path)
  `Set the path to the SSL key store. This method should only be used with the client/server in SSL mode, i.e. after {#ssl=}
  has been set to true.
  The SSL key store is a standard Java Key Store, and should contain the client/server certificate. For a client, it's only necessary to supply
  a client key store if the server requires client authentication via client certificates.
  Keyword arguments:
  @param path: The path to the key store
  return self. So multiple invocations can be chained.`

set_ssl(self, val)
  `Set whether the server or client will use SSL.
  Keyword arguments:
  @param val: If true then ssl will be used.
  return self. So multiple invocations can be chained.`

set_trust_store_password(self, password)
  `Set the password for the SSL trust store. This method should only be used with the client in SSL mode, i.e. after {#ssl=}
  has been set to true.
  Keyword arguments:
  @param password: The password.
  return self. So multiple invocations can be chained.`

set_trust_store_path(self, path)
  `Set the path to the SSL trust store. This method should only be used with the client/server in SSL mode, i.e. after {#ssl=}
  has been set to true.
  The SSL trust store is a standard Java Key Store, and should contain the certificate(s) of the clients/servers that the server/client trusts. The SSL
  handshake will fail if the server provides a certificate that the client does not trust, or if client authentication is used,
  if the client provides a certificate the server does not trust.
  Keyword arguments:
  @param path: The path to the trust store
  return self. So multiple invocations can be chained.`

Data descriptors inherited from core.ssl_support.SSLSupport:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

key_store_password

key_store_path

ssl

trust_store_password

trust_store_path

Methods inherited from core.tcp_support.TCPSupport:

set_receive_buffer_size(self, bytes)
  `Set the TCP receive buffer size.
  Keyword arguments:
  @param bytes: The size in bytes.
  return a reference to self so invocations can be chained`

set_reuse_address(self, val)
  `Set the TCP reuse address setting.
  Keyword arguments:
  @param val: If true, then TCP reuse address will be enabled.
  @return: a reference to self so invocations can be chained`

set_send_buffer_size(self, bytes)
  `Set the TCP send buffer size.
  Keyword arguments:
  @param bytes: The size in bytes.
  return a reference to self so invocations can be chained`

set_so_linger(self, val)
  `Set the TCP so linger setting.
  Keyword arguments:
  @param val: If true, then TCP so linger will be enabled.
  return a reference to self so invocations can be chained`

set_tcp_keep_alive(self, val)
  `Set the TCP keep alive setting.
  Keyword arguments:
  @param val: If true, then TCP keep alive will be enabled.
  return a reference to self so invocations can be chained`

set_traffic_class(self, val)
  `Set the TCP traffic class setting.
  Keyword arguments:
  @param val: The TCP traffic class setting.
  return a reference to self so invocations can be chained`

Data descriptors inherited from core.tcp_support.TCPSupport:

receive_buffer_size

reuse_address

send_buffer_size

so_linger

tcp_keep_alive

traffic_class

class HttpClientRequest(core.streams.WriteStream)

``

`Instances of this class are created by an HttpClient instance, via one of the methods corresponding to the
specific HTTP methods, or the generic HttpClient request method.
Once an instance of this class has been obtained, headers can be set on it, and data can be written to its body,
if required. Once you are ready to send the request, the end method must called.
Nothing is sent until the request has been internally assigned an HTTP connection. The HttpClient instance
will return an instance of this class immediately, even if there are no HTTP connections available in the pool. Any requests
sent before a connection is assigned will be queued internally and actually sent when an HTTP connection becomes
available from the pool.
The headers of the request are actually sent either when the end method is called, or, when the first
part of the body is written, whichever occurs first.
This class supports both chunked and non-chunked HTTP.
`

Method resolution order:
  HttpClientRequest
  core.streams.WriteStream
  __builtin__.object

Methods defined here:

__init__(self, java_obj)

continue_handler(self, handler)
  `If you send an HTTP request with the header 'Expect' set to the value '100-continue'
  and the server responds with an interim HTTP response with a status code of '100' and a continue handler
  has been set using this method, then the handler will be called.
  You can then continue to write data to the request body and later end it. This is normally used in conjunction with
  the send_head method to force the request header to be written before the request has ended.
  Keyword arguments:
  @param handler: The handler`

end(self)
  `Ends the request. If no data has been written to the request body, and send_head has not been called then
  the actual request won't get written until this method gets called.
  Once the request has ended, it cannot be used any more, and if keep alive is true the underlying connection will
  be returned to the HttpClient pool so it can be assigned to another request.`

put_header(self, key, value)
  `Inserts a header into the request.
  Keyword arguments:
  @param key: The header key
  @param value: The header value. to_s will be called on the value to determine the actual String value to insert.
  @return: self so multiple operations can be chained.`

send_head(self)
  `Forces the head of the request to be written before end is called on the request. This is normally used
  to implement HTTP 100-continue handling, see continue_handler for more information.
  @return: self So multiple operations can be chained.`

set_chunked(self, val)
  `Sets whether the request should used HTTP chunked encoding or not.
  Keyword arguments:
  @param val: If val is true, this request will use HTTP chunked encoding, and each call to write to the body
  will correspond to a new HTTP chunk sent on the wire. If chunked encoding is used the HTTP header
  'Transfer-Encoding' with a value of 'Chunked' will be automatically inserted in the request.
  If chunked is false, this request will not use HTTP chunked encoding, and therefore if any data is written the
  body of the request, the total size of that data must be set in the 'Content-Length' header before any
  data is written to the request body.
  @return: self So multiple operations can be chained.`

write_buffer(self, chunk, handler=None)
  `Write a to the request body.
  Keyword arguments:
  @param chunk: The buffer to write.
  @param handler: The handler will be called when the buffer has actually been written to the wire.
  @return: self So multiple operations can be chained.`

write_buffer_and_end(self, chunk)
  `Same as end but writes some data to the response body before ending. If the response is not chunked and
  no other data has been written then the Content-Length header will be automatically set
  Keyword arguments:
  @param chunk: The Buffer to write`

write_str(self, str, enc='UTF-8', handler=None)
  `Write a to the request body.
  Keyword arguments:
  @param str: The string to write.
  @param enc: The encoding to use.
  @param handler: The handler will be called when the buffer has actually been written to the wire.
  @return: self So multiple operations can be chained.`

write_str_and_end(self, str, enc='UTF-8')
  `Same as write_buffer_and_end but writes a String
  Keyword arguments:
  @param str: The String to write
  @param enc: The encoding`

Data descriptors defined here:

chunked

headers
  `Hash of headers for the request`

Methods inherited from core.streams.WriteStream:

drain_handler(self, handler)
  `Set a drain handler on the stream. If the write queue is full, then the handler will be called when the write
  queue has been reduced to maxSize / 2. See for an example of this being used.
  Keyword arguments:
  @param handler: The drain handler`

exception_handler(self, handler)
  `Set an execption handler on the stream.
  Keyword arguments:
  @param handler: The exception handler`

set_write_queue_max_size(self, size)
  `Set the maximum size of the write queue. You will still be able to write to the stream even
  if there is more data than this in the write queue. This is used as an indicator by classes such as
  to provide flow control.
  Keyword arguments:
  @param size: The maximum size, in bytes.`

Data descriptors inherited from core.streams.WriteStream:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

write_queue_full
  `Is the write queue full?
  return True if there are more bytes in the write queue than the max write queue size.`

write_queue_max_size

class HttpClientResponse(core.streams.ReadStream)
`` | `Encapsulates a client-side HTTP response. An instance of this class is provided to the user via a handler that was specified when one of the HTTP method operations, or the generic HttpClientrequest method was called on an instance of HttpClient.`

Method resolution order:
  HttpClientResponse
  core.streams.ReadStream
  __builtin__.object

Methods defined here:

__init__(self, java_obj)

body_handler(self, handler)
  `Set a handler to receive the entire body in one go - do not use this for large bodies`

header(self, key)
  `Get a header value
  Keyword arguments:
  @param key: The key of the header.
  return the header value.`

Data descriptors defined here:

headers
  `Get all the headers in the response.
  If the response contains multiple headers with the same key, the values
  will be concatenated together into a single header with the same key value, with each value separated by a comma,
  as specified by {http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.htmlsec4.2}.
  return a dictionary of headers.`

status_code
  `return the HTTP status code of the response.`

trailers
  `Get all the trailers in the response.
  If the response contains multiple trailers with the same key, the values
  will be concatenated together into a single header with the same key value, with each value separated by a comma,
  as specified by {http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.htmlsec4.2}.
  Trailers will only be available in the response if the server has sent a HTTP chunked response where headers have
  been inserted by the server on the last chunk. In such a case they won't be available on the client until the last chunk has
  been received.
  return a dictionary of trailers.`

Methods inherited from core.streams.ReadStream:

data_handler(self, handler)
  `Set a data handler. As data is read, the handler will be called with the data.
  Keyword arguments:
  @param handler: The data handler`

end_handler(self, handler)
  `Set an end handler on the stream. Once the stream has ended, and there is no more data to be read, this handler will be called.
  Keyword arguments:
  @param handler: The exception handler`

exception_handler(self, handler)
  `Set an execption handler on the stream.
  param [Block] hndlr. The exception handler`

pause(self)
  `Pause the ReadStream. After calling this, the ReadStream will aim to send no more data to the`

resume(self)
  `Resume reading. If the ReadStream has been paused, reading will recommence on it.`

Data descriptors inherited from core.streams.ReadStream:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

class HttpClientResponseHandler(org.python.proxies.core.http$HttpClientResponseHandler$12)
`` | `A handler for Http Client Responses`

Method resolution order:
  HttpClientResponseHandler
  org.python.proxies.core.http$HttpClientResponseHandler$12
  org.vertx.java.core.Handler
  java.lang.Object
  __builtin__.object

Methods defined here:

__init__(self, handler)

handle(self, res)
  `Called when a response is being handled. Argument is a HttpClientResponse object`

Data descriptors defined here:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

Data and other attributes defined here:

__initProxy__ = <java function __initProxy__ 0x7d>

__supernames__ = array('java.lang.String', [u'clone', u'finalize'])

classDictInit = <java function classDictInit 0x7e>

clone = <java function clone 0x7f>

finalize = <java function finalize 0x80>

Methods inherited from java.lang.Object:

__copy__(...)

__deepcopy__(...)

__eq__(...)

__hash__(...)

__ne__(...)

__repr__(...)

__unicode__(...)

Data and other attributes inherited from java.lang.Object:

equals = <java function equals 0x81>

getClass = <java function getClass 0x82>

hashCode = <java function hashCode 0x83>

notify = <java function notify 0x84>

notifyAll = <java function notifyAll 0x85>

toString = <java function toString 0x86>

wait = <java function wait 0x87>

class HttpServer(core.tcp_support.TCPSupport, core.ssl_support.SSLSupport, __builtin__.object)
`` | `An HTTP and websockets server`

Method resolution order:
  HttpServer
  core.tcp_support.TCPSupport
  core.ssl_support.SSLSupport
  __builtin__.object

Methods defined here:

__init__(self, **kwargs)

client_auth_required(self, val)
  `Client authentication is an extra level of security in SSL, and requires clients to provide client certificates.
  Those certificates must be added to the server trust store.
  Keyword arguments:
  @param val: If true then the server will request client authentication from any connecting clients, if they
  do not authenticate then they will not make a connection.`

close(self, handler=None)
  `Close the server. Any open HTTP connections will be closed. This can be used as a decorator.
  Keyword arguments:
  @param handler: a handler that is called when the connection is closed. The handler is wrapped in a ClosedHandler.`

listen(self, port, host=None)
  `Instruct the server to listen for incoming connections. If host is None listens on all.
  Keyword arguments:
  @param port: The port to listen on.
  @param host: The host name or ip address to listen on. (default None)`

request_handler(self, handler)
  `Set the HTTP request handler for the server.
  As HTTP requests arrive on the server a new HttpServerRequest instance will be created and passed to the handler.
  Keyword arguments:
  @param handler: the function used to handle the request.
  @return: self`

websocket_handler(self, handler)
  `Set the websocket handler for the server.
  As websocket requests arrive on the server a new ServerWebSocket instance will be created and passed to the handler.
  Keyword arguments:
  @param handler: the function used to handle the request.`

Methods inherited from core.tcp_support.TCPSupport:

set_receive_buffer_size(self, bytes)
  `Set the TCP receive buffer size.
  Keyword arguments:
  @param bytes: The size in bytes.
  return a reference to self so invocations can be chained`

set_reuse_address(self, val)
  `Set the TCP reuse address setting.
  Keyword arguments:
  @param val: If true, then TCP reuse address will be enabled.
  @return: a reference to self so invocations can be chained`

set_send_buffer_size(self, bytes)
  `Set the TCP send buffer size.
  Keyword arguments:
  @param bytes: The size in bytes.
  return a reference to self so invocations can be chained`

set_so_linger(self, val)
  `Set the TCP so linger setting.
  Keyword arguments:
  @param val: If true, then TCP so linger will be enabled.
  return a reference to self so invocations can be chained`

set_tcp_keep_alive(self, val)
  `Set the TCP keep alive setting.
  Keyword arguments:
  @param val: If true, then TCP keep alive will be enabled.
  return a reference to self so invocations can be chained`

set_traffic_class(self, val)
  `Set the TCP traffic class setting.
  Keyword arguments:
  @param val: The TCP traffic class setting.
  return a reference to self so invocations can be chained`

Data descriptors inherited from core.tcp_support.TCPSupport:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

receive_buffer_size

reuse_address

send_buffer_size

so_linger

tcp_keep_alive

traffic_class

Methods inherited from core.ssl_support.SSLSupport:

set_key_store_password(self, password)
  `Set the password for the SSL key store. This method should only be used with the client in SSL mode, i.e. after ssl
  has been set to true.
  Keyword arguments:
  @param password: The password.
  return self. So multiple invocations can be chained.`

set_key_store_path(self, path)
  `Set the path to the SSL key store. This method should only be used with the client/server in SSL mode, i.e. after {#ssl=}
  has been set to true.
  The SSL key store is a standard Java Key Store, and should contain the client/server certificate. For a client, it's only necessary to supply
  a client key store if the server requires client authentication via client certificates.
  Keyword arguments:
  @param path: The path to the key store
  return self. So multiple invocations can be chained.`

set_ssl(self, val)
  `Set whether the server or client will use SSL.
  Keyword arguments:
  @param val: If true then ssl will be used.
  return self. So multiple invocations can be chained.`

set_trust_store_password(self, password)
  `Set the password for the SSL trust store. This method should only be used with the client in SSL mode, i.e. after {#ssl=}
  has been set to true.
  Keyword arguments:
  @param password: The password.
  return self. So multiple invocations can be chained.`

set_trust_store_path(self, path)
  `Set the path to the SSL trust store. This method should only be used with the client/server in SSL mode, i.e. after {#ssl=}
  has been set to true.
  The SSL trust store is a standard Java Key Store, and should contain the certificate(s) of the clients/servers that the server/client trusts. The SSL
  handshake will fail if the server provides a certificate that the client does not trust, or if client authentication is used,
  if the client provides a certificate the server does not trust.
  Keyword arguments:
  @param path: The path to the trust store
  return self. So multiple invocations can be chained.`

Data descriptors inherited from core.ssl_support.SSLSupport:

key_store_password

key_store_path

ssl

trust_store_password

trust_store_path

class HttpServerRequest(core.streams.ReadStream)
`` | `Encapsulates a server-side HTTP request. An instance of this class is created for each request that is handled by the server and is passed to the user via the handler specified using HttpServer.request_handler. Each instance of this class is associated with a corresponding HttpServerResponse instance via the property response.`

Method resolution order:
  HttpServerRequest
  core.streams.ReadStream
  __builtin__.object

Methods defined here:

__init__(self, java_obj)

body_handler(self, handler)
  `Set the body handler for this request, the handler receives a single Buffer object as a parameter.
  This can be used as a decorator.
  Keyword arguments:
  @param handler: a handler that is called when the body has been received. The handler is wrapped in a BufferHandler.`

Data descriptors defined here:

headers
  `The request headers as a dictionary`

method
  `The HTTP method, one of HEAD, OPTIONS, GET, POST, PUT, DELETE, CONNECT, TRACE`

params
  `The request parameters as a dictionary`

path
  `The path part of the uri. For example /somepath/somemorepath/somresource.foo`

query
  `The query part of the uri. For example someparam=32&someotherparam=x`

response
  `The response HttpServerResponse object.`

uri
  `The uri of the request. For example 'http://www.somedomain.com/somepath/somemorepath/somresource.foo?someparam=32&someotherparam=x`

Methods inherited from core.streams.ReadStream:

data_handler(self, handler)
  `Set a data handler. As data is read, the handler will be called with the data.
  Keyword arguments:
  @param handler: The data handler`

end_handler(self, handler)
  `Set an end handler on the stream. Once the stream has ended, and there is no more data to be read, this handler will be called.
  Keyword arguments:
  @param handler: The exception handler`

exception_handler(self, handler)
  `Set an execption handler on the stream.
  param [Block] hndlr. The exception handler`

pause(self)
  `Pause the ReadStream. After calling this, the ReadStream will aim to send no more data to the`

resume(self)
  `Resume reading. If the ReadStream has been paused, reading will recommence on it.`

Data descriptors inherited from core.streams.ReadStream:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

class HttpServerRequestHandler(org.python.proxies.core.http$HttpServerRequestHandler$11)
`` | `A handler for Http Server Requests`

Method resolution order:
  HttpServerRequestHandler
  org.python.proxies.core.http$HttpServerRequestHandler$11
  org.vertx.java.core.Handler
  java.lang.Object
  __builtin__.object

Methods defined here:

__init__(self, handler)

handle(self, req)
  `Called when a request is being handled. Argument is a HttpServerRequest object`

Data descriptors defined here:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

Data and other attributes defined here:

__initProxy__ = <java function __initProxy__ 0x88>

__supernames__ = array('java.lang.String', [u'clone', u'finalize'])

classDictInit = <java function classDictInit 0x89>

clone = <java function clone 0x8a>

finalize = <java function finalize 0x8b>

Methods inherited from java.lang.Object:

__copy__(...)

__deepcopy__(...)

__eq__(...)

__hash__(...)

__ne__(...)

__repr__(...)

__unicode__(...)

Data and other attributes inherited from java.lang.Object:

equals = <java function equals 0x8c>

getClass = <java function getClass 0x8d>

hashCode = <java function hashCode 0x8e>

notify = <java function notify 0x8f>

notifyAll = <java function notifyAll 0x90>

toString = <java function toString 0x91>

wait = <java function wait 0x92>

class HttpServerResponse(core.streams.WriteStream)

``

`Encapsulates a server-side HTTP response.
An instance of this class is created and associated to every instance of HttpServerRequest that is created.
It allows the developer to control the HTTP response that is sent back to the client for the corresponding HTTP
request. It contains methods that allow HTTP headers and trailers to be set, and for a body to be written out
to the response.
It also allows a file to be streamed by the kernel directly from disk to the outgoing HTTP connection,
bypassing user space altogether (where supported by the underlying operating system). This is a very efficient way of
serving files from the server since buffers do not have to be read one by one from the file and written to the outgoing
socket.
`

Method resolution order:
  HttpServerResponse
  core.streams.WriteStream
  __builtin__.object

Methods defined here:

__init__(self, java_obj)

close(self)
  `Close the underlying TCP connection`

end(self, data=None)
  `Ends the response. If no data has been written to the response body, the actual response won't get written until this method gets called.
  Once the response has ended, it cannot be used any more, and if keep alive is true the underlying connection will
  be closed.
  Keywords arguments
  @param data: Optional String or Buffer to write before ending the response`

get_chunked(self)
  `Get whether this response uses HTTP chunked encoding or not.`

get_status_code(self)
  `Get the status code of the response.`

get_status_message(self)
  `Get the status message the goes with status code`

put_header(self, key, value)
  `Inserts a header into the response.
  Keyword arguments:
  @param key: The header key
  @param value: The header value.
  @return: HttpServerResponse so multiple operations can be chained.`

put_trailer(self, key, value)
  `Inserts a trailer into the response.
  Keyword arguments:
  @param key: The header key
  @param value: The header value.
  @return: HttpServerResponse so multiple operations can be chained.`

send_file(self, path)
  `Tell the kernel to stream a file directly from disk to the outgoing connection, bypassing userspace altogether
  (where supported by the underlying operating system. This is a very efficient way to serve files.
  Keyword arguments:
  @param path: Path to file to send.
  @return: a HttpServerResponse so multiple operations can be chained.`

set_chunked(self, val)
  `Sets whether this response uses HTTP chunked encoding or not.
  Keyword arguments:
  @param val: If val is true, this response will use HTTP chunked encoding, and each call to write to the body
  will correspond to a new HTTP chunk sent on the wire. If chunked encoding is used the HTTP header
  'Transfer-Encoding' with a value of 'Chunked' will be automatically inserted in the response.
  If chunked is false, this response will not use HTTP chunked encoding, and therefore if any data is written the
  body of the response, the total size of that data must be set in the 'Content-Length' header before any
  data is written to the response body.
  An HTTP chunked response is typically used when you do not know the total size of the request body up front.
  @return: a HttpServerResponse so multiple operations can be chained.`

set_status_code(self, code)
  `Set the status code of the response. Default is 200`

set_status_message(self, message)
  `Set the status message for a response`

write_buffer(self, buffer, handler=None)
  `Write a buffer to the response. The handler (if supplied) will be called when the buffer has actually been written to the wire.
  Keyword arguments:
  @param buffer: The buffer to write
  @param handler: The handler to be called when writing has been completed. It is wrapped in a DoneHandler (default None)
  @return: a HttpServerResponse so multiple operations can be chained.`

write_str(self, str, enc='UTF-8', handler=None)
  `Write a String to the response. The handler will be called when the String has actually been written to the wire.
  Keyword arguments:
  @param str: The string to write
  @param enc: Encoding to use.
  @param handler: The handler to be called when writing has been completed. It is wrapped in a DoneHandler (default None)
  @return: a HttpServerResponse so multiple operations can be chained.`

Data descriptors defined here:

chunked
  `Get whether this response uses HTTP chunked encoding or not.`

headers
  `Get a copy of the reponse headers as a dictionary`

status_code
  `Get the status code of the response.`

status_message
  `Get the status message the goes with status code`

trailers
  `Get a copy of the trailers as a dictionary`

Methods inherited from core.streams.WriteStream:

drain_handler(self, handler)
  `Set a drain handler on the stream. If the write queue is full, then the handler will be called when the write
  queue has been reduced to maxSize / 2. See for an example of this being used.
  Keyword arguments:
  @param handler: The drain handler`

exception_handler(self, handler)
  `Set an execption handler on the stream.
  Keyword arguments:
  @param handler: The exception handler`

set_write_queue_max_size(self, size)
  `Set the maximum size of the write queue. You will still be able to write to the stream even
  if there is more data than this in the write queue. This is used as an indicator by classes such as
  to provide flow control.
  Keyword arguments:
  @param size: The maximum size, in bytes.`

Data descriptors inherited from core.streams.WriteStream:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

write_queue_full
  `Is the write queue full?
  return True if there are more bytes in the write queue than the max write queue size.`

write_queue_max_size

class RouteMatcher(__builtin__.object)

``

`This class allows you to do route requests based on the HTTP verb and the request URI, in a manner similar
to <a href="http://www.sinatrarb.com/">Sinatra</a> or <a href="http://expressjs.com/">Express</a>.
RouteMatcher also lets you extract paramaters from the request URI either a simple pattern or using
regular expressions for more complex matches. Any parameters extracted will be added to the requests parameters
which will be available to you in your request handler.
It's particularly useful when writing REST-ful web applications.
To use a simple pattern to extract parameters simply prefix the parameter name in the pattern with a ':' (colon).
Different handlers can be specified for each of the HTTP verbs, GET, POST, PUT, DELETE etc.
For more complex matches regular expressions can be used in the pattern. When regular expressions are used, the extracted
parameters do not have a name, so they are put into the HTTP request with names of param0, param1, param2 etc.
Multiple matches can be specified for each HTTP verb. In the case there are more than one matching patterns for
a particular request, the first matching one will be used.
`

Methods defined here:

__call__(self, data)

__init__(self)

all(self, pattern, handler)
  `Specify a handler that will be called for any matching HTTP request
  Keyword arguments:
  @param pattern: pattern to match
  @param handler: http server request handler`

all_re(self, pattern, handler)
  `Specify a handler that will be called for any matching HTTP request
  Keyword arguments:
  @param pattern: pattern to match
  @param handler: http server request handler`

connect(self, pattern, handler)
  `Specify a handler that will be called for a matching HTTP CONNECT
  Keyword arguments:
  @param pattern: pattern to match
  @param handler: http server request handler`

connect_re(self, pattern, handler)
  `Specify a handler that will be called for a matching HTTP CONNECT
  Keyword arguments:
  @param pattern: pattern to match
  @param handler: http server request handler`

delete(self, pattern, handler)
  `Specify a handler that will be called for a matching HTTP DELETE
  Keyword arguments:
  @param pattern: pattern to match
  @param handler: http server request handler`

delete_re(self, pattern, handler)
  `Specify a handler that will be called for a matching HTTP DELETE
  Keyword arguments:
  @param pattern: pattern to match
  @param handler: http server request handler`

get(self, pattern, handler)
  `Specify a handler that will be called for a matching HTTP GET
  Keyword arguments:
  @param pattern: pattern to match
  @param handler: handler for match`

get_re(self, pattern, handler)
  `Specify a handler that will be called for a matching HTTP GET
  Keyword arguments:
  @param pattern: pattern to match
  @param handler: http server request handler`

head(self, pattern, handler)
  `Specify a handler that will be called for a matching HTTP HEAD
  Keyword arguments:
  @param pattern: pattern to match
  @param handler: http server request handler`

head_re(self, pattern, handler)
  `Specify a handler that will be called for a matching HTTP HEAD
  Keyword arguments:
  @param pattern: pattern to match
  @param handler: http server request handler`

input(self, request)
  `This method is called to provide the matcher with data.
  Keyword arguments:
  @param request: input request to the parser.`

no_match(self, handler)
  `Specify a handler that will be called when nothing matches
  Default behaviour is to return a 404
  Keyword arguments:
  @param handler: http server request handler`

options(self, pattern, handler)
  `Specify a handler that will be called for a matching HTTP OPTIONS
  Keyword arguments:
  @param pattern: pattern to match
  @param handler: http server request handler`

options_re(self, pattern, handler)
  `Specify a handler that will be called for a matching HTTP OPTIONS
  Keyword arguments:
  @param pattern: pattern to match
  @param handler: http server request handler`

patch(self, pattern, handler)
  `Specify a handler that will be called for a matching HTTP PATCH
  Keyword arguments:
  @param pattern: pattern to match
  @param handler: http server request handler`

patch_re(self, pattern, handler)
  `Specify a handler that will be called for a matching HTTP PATCH
  Keyword arguments:
  @param pattern: pattern to match
  @param handler: http server request handler`

post(self, pattern, handler)
  `Specify a handler that will be called for a matching HTTP POST
  Keyword arguments:
  @param pattern: pattern to match
  @param handler: http server request handler`

post_re(self, pattern, handler)
  `Specify a handler that will be called for a matching HTTP POST
  Keyword arguments:
  @param pattern: pattern to match
  @param handler: http server request handler`

put(self, pattern, handler)
  `Specify a handler that will be called for a matching HTTP PUT
  Keyword arguments:
  @param pattern: pattern to match
  @param handler: http server request handler`

put_re(self, pattern, handler)
  `Specify a handler that will be called for a matching HTTP PUT
  Keyword arguments:
  @param pattern: pattern to match
  @param handler: http server request handler`

trace(self, pattern, handler)
  `Specify a handler that will be called for a matching HTTP TRACE
  Keyword arguments:
  @param pattern: pattern to match
  @param handler: http server request handler`

trace_re(self, pattern, handler)
  `Specify a handler that will be called for a matching HTTP TRACE
  Keyword arguments:
  @param pattern: pattern to match
  @param handler: http server request handler`

Data descriptors defined here:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

class ServerWebSocket(WebSocket)
`` | `Instances of this class are created when a WebSocket is accepted on the server. It extends WebSocket and adds methods to reject the WebSocket and an attribute for the path.`

Method resolution order:
  ServerWebSocket
  WebSocket
  core.streams.ReadStream
  core.streams.WriteStream
  __builtin__.object

Methods defined here:

__init__(self, websocket)

reject(self)
  `Reject the WebSocket. Sends 404 to client`

Data descriptors defined here:

path
  `The path the websocket connect was attempted at.`

Methods inherited from WebSocket:

close(self)
  `Close the websocket`

closed_handler(self, handler)
  `Set a closed handler on the connection, the handler receives a no parameters.
  This can be used as a decorator.
  Keyword arguments:
  handler - The handler to be called when writing has been completed. It is wrapped in a ClosedHandler.`

write_binary_frame(self, buffer)
  `Write data to the websocket as a binary frame
  Keyword arguments:
  @param buffer: Buffer data to write to socket.`

write_text_frame(self, text)
  `Write data to the websocket as a text frame
  Keyword arguments:
  @param text: text to write to socket`

Methods inherited from core.streams.ReadStream:

data_handler(self, handler)
  `Set a data handler. As data is read, the handler will be called with the data.
  Keyword arguments:
  @param handler: The data handler`

end_handler(self, handler)
  `Set an end handler on the stream. Once the stream has ended, and there is no more data to be read, this handler will be called.
  Keyword arguments:
  @param handler: The exception handler`

exception_handler(self, handler)
  `Set an execption handler on the stream.
  param [Block] hndlr. The exception handler`

pause(self)
  `Pause the ReadStream. After calling this, the ReadStream will aim to send no more data to the`

resume(self)
  `Resume reading. If the ReadStream has been paused, reading will recommence on it.`

Data descriptors inherited from core.streams.ReadStream:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

Methods inherited from core.streams.WriteStream:

drain_handler(self, handler)
  `Set a drain handler on the stream. If the write queue is full, then the handler will be called when the write
  queue has been reduced to maxSize / 2. See for an example of this being used.
  Keyword arguments:
  @param handler: The drain handler`

set_write_queue_max_size(self, size)
  `Set the maximum size of the write queue. You will still be able to write to the stream even
  if there is more data than this in the write queue. This is used as an indicator by classes such as
  to provide flow control.
  Keyword arguments:
  @param size: The maximum size, in bytes.`

write_buffer(self, buff)
  `Write some data to the stream. The data is put on an internal write queue, and the write actually happens
  asynchronously. To avoid running out of memory by putting too much on the write queue,
  check the method before writing. This is done automatically if using a .
  param [Buffer]. The buffer to write.`

Data descriptors inherited from core.streams.WriteStream:

write_queue_full
  `Is the write queue full?
  return True if there are more bytes in the write queue than the max write queue size.`

write_queue_max_size

class ServerWebSocketHandler(org.python.proxies.core.http$ServerWebSocketHandler$13)
`` | `A handler for WebSocket Server Requests`

Method resolution order:
  ServerWebSocketHandler
  org.python.proxies.core.http$ServerWebSocketHandler$13
  org.vertx.java.core.Handler
  java.lang.Object
  __builtin__.object

Methods defined here:

__init__(self, handler)

handle(self, req)
  `Calls the Handler with the ServerWebSocket when connected`

Data descriptors defined here:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

Data and other attributes defined here:

__initProxy__ = <java function __initProxy__ 0x93>

__supernames__ = array('java.lang.String', [u'clone', u'finalize'])

classDictInit = <java function classDictInit 0x94>

clone = <java function clone 0x95>

finalize = <java function finalize 0x96>

Methods inherited from java.lang.Object:

__copy__(...)

__deepcopy__(...)

__eq__(...)

__hash__(...)

__ne__(...)

__repr__(...)

__unicode__(...)

Data and other attributes inherited from java.lang.Object:

equals = <java function equals 0x97>

getClass = <java function getClass 0x98>

hashCode = <java function hashCode 0x99>

notify = <java function notify 0x9a>

notifyAll = <java function notifyAll 0x9b>

toString = <java function toString 0x9c>

wait = <java function wait 0x9d>

class WebSocket(core.streams.ReadStream, core.streams.WriteStream)
`` | `Encapsulates an HTML 5 Websocket. Instances of this class are created by an HttpClient instance when a client succeeds in a websocket handshake with a server. Once an instance has been obtained it can be used to s or receive buffers of data from the connection, a bit like a TCP socket.`

Method resolution order:
  WebSocket
  core.streams.ReadStream
  core.streams.WriteStream
  __builtin__.object

Methods defined here:

__init__(self, websocket)

close(self)
  `Close the websocket`

closed_handler(self, handler)
  `Set a closed handler on the connection, the handler receives a no parameters.
  This can be used as a decorator.
  Keyword arguments:
  handler - The handler to be called when writing has been completed. It is wrapped in a ClosedHandler.`

write_binary_frame(self, buffer)
  `Write data to the websocket as a binary frame
  Keyword arguments:
  @param buffer: Buffer data to write to socket.`

write_text_frame(self, text)
  `Write data to the websocket as a text frame
  Keyword arguments:
  @param text: text to write to socket`

Methods inherited from core.streams.ReadStream:

data_handler(self, handler)
  `Set a data handler. As data is read, the handler will be called with the data.
  Keyword arguments:
  @param handler: The data handler`

end_handler(self, handler)
  `Set an end handler on the stream. Once the stream has ended, and there is no more data to be read, this handler will be called.
  Keyword arguments:
  @param handler: The exception handler`

exception_handler(self, handler)
  `Set an execption handler on the stream.
  param [Block] hndlr. The exception handler`

pause(self)
  `Pause the ReadStream. After calling this, the ReadStream will aim to send no more data to the`

resume(self)
  `Resume reading. If the ReadStream has been paused, reading will recommence on it.`

Data descriptors inherited from core.streams.ReadStream:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

Methods inherited from core.streams.WriteStream:

drain_handler(self, handler)
  `Set a drain handler on the stream. If the write queue is full, then the handler will be called when the write
  queue has been reduced to maxSize / 2. See for an example of this being used.
  Keyword arguments:
  @param handler: The drain handler`

set_write_queue_max_size(self, size)
  `Set the maximum size of the write queue. You will still be able to write to the stream even
  if there is more data than this in the write queue. This is used as an indicator by classes such as
  to provide flow control.
  Keyword arguments:
  @param size: The maximum size, in bytes.`

write_buffer(self, buff)
  `Write some data to the stream. The data is put on an internal write queue, and the write actually happens
  asynchronously. To avoid running out of memory by putting too much on the write queue,
  check the method before writing. This is done automatically if using a .
  param [Buffer]. The buffer to write.`

Data descriptors inherited from core.streams.WriteStream:

write_queue_full
  `Is the write queue full?
  return True if there are more bytes in the write queue than the max write queue size.`

write_queue_max_size

class WebSocketHandler(org.python.proxies.core.http$WebSocketHandler$14)
`` | `A handler for WebSocket Requests`

Method resolution order:
  WebSocketHandler
  org.python.proxies.core.http$WebSocketHandler$14
  org.vertx.java.core.Handler
  java.lang.Object
  __builtin__.object

Methods defined here:

__init__(self, handler)

handle(self, req)
  `Calls the Handler with the WebSocket when connected`

Data descriptors defined here:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

Data and other attributes defined here:

__initProxy__ = <java function __initProxy__ 0x9e>

__supernames__ = array('java.lang.String', [u'clone', u'finalize'])

classDictInit = <java function classDictInit 0x9f>

clone = <java function clone 0xa0>

finalize = <java function finalize 0xa1>

Methods inherited from java.lang.Object:

__copy__(...)

__deepcopy__(...)

__eq__(...)

__hash__(...)

__ne__(...)

__repr__(...)

__unicode__(...)

Data and other attributes inherited from java.lang.Object:

equals = <java function equals 0xa2>

getClass = <java function getClass 0xa3>

hashCode = <java function hashCode 0xa4>

notify = <java function notify 0xa5>

notifyAll = <java function notifyAll 0xa6>

toString = <java function toString 0xa7>

wait = <java function wait 0xa8>

Data
`` |  | __author__ = 'Scott Horn' __credits__ = 'Based entirely on work by Tim Fox http://tfox.org' __email__ = 'scott@hornmicro.com' org = <java package org 0x2>

Author
`` |  | Scott Horn

Credits
`` |  | Based entirely on work by Tim Fox http://tfox.org