network.protocols.json rpc.message - Palamecia/mint GitHub Wiki
Module network.protocols.json-rpc.message
Description
load network.protocols.json-rpc.message
This module provides the Network.JsonRpc.Message class which implement the structure of the messages used by Network.JsonRpc.Serializer.
Packages
Classes
Network.JsonRpc.Message
This class provides a structure for the messages used by Network.JsonRpc.Serializer and the Network.JsonRpc protocol. It provides helpers for reading and writing messages informations and for messages encoding de decoding.
Public members
| Modifiers | Member | Description |
|---|---|---|
const |
(#NetworkJsonRpcMessage-1) | Returns the value of the key attribute of the body of the message. |
const |
[]= | Sets the key attribute of the body of the message to value. |
@ const |
decode | Creates an instance of Network.JsonRpc.Message.Network.JsonRpc.Message from a... |
const |
encode | Returns the content of the message as an instance of Network.JsonRpc.Message.... |
@ const |
fromString | Creates a new instance of Network.JsonRpc.Message.Network.JsonRpc.Message fro... |
const |
getBody | Returns the body of the message as a hash. |
const |
getBodyText | Returns the body of the message as a string. |
const |
getHeader | Returns the value of the field name of the header. |
const |
in | Returns true if the body of the message contains the key attribute; otherwise... |
const |
new | Creates a new empty message. |
const |
setBody | Sets the body of the message to body. The Content-Length header will be autom... |
const |
setHeader | Sets the field name of the header to value. |
const |
toString | Returns the content of the message as a string including headers and body, wi... |
Private members
| Modifiers | Member | Description |
|---|---|---|
final |
body | Internal message body. |
final |
headers | Internal header data. |
Descriptions
Network.JsonRpc.Message.[]
def (const self, const key)
Returns the value of the key attribute of the body of the
message.
Network.JsonRpc.Message.[]=
def (self, const key, value)
Sets the key attribute of the body of the message to value.
Network.JsonRpc.Message.body
{}
Internal message body.
Network.JsonRpc.Message.decode
def (data, length)
Creates an instance of Network.JsonRpc.Message from an instance of Serializer.DataStream given by
data. The length parameter is the number of bytes to be used to create the message.
Network.JsonRpc.Message.encode
def (const self)
Returns the content of the message as an instance of Serializer.DataStream.
Network.JsonRpc.Message.fromString
def (body, attributes = {})
Creates a new instance of Network.JsonRpc.Message from a string.
The body parameter should be a string representation of the
body of the message. The attributes parameter can also be given
to setup the attributes of the header.
Network.JsonRpc.Message.getBody
def (const self)
Returns the body of the message as a hash.
Network.JsonRpc.Message.getBodyText
def (const self)
Returns the body of the message as a string.
Network.JsonRpc.Message.getHeader
def (const self, name)
Returns the value of the field name of the header.
Network.JsonRpc.Message.headers
{}
Internal header data.
Network.JsonRpc.Message.in
def (const self, const key)
Returns true if the body of the message contains the key
attribute; otherwise returns false.
def (const self)
Returns an iterator containing iterators on the key and value of each attribute of the body of the message.
Network.JsonRpc.Message.new
def (self)
Creates a new empty message.
def (self, body, attributes = {})
Creates a new message described by body. The attributes
parameter can also be given to setup the attributes of the
header.
If body is an instance of Network.JsonRpc.Message, this
instance is returned.
If body is a hash, it is used as the body of the message.
If body is an instance of Serializer.JsonStream, this
instance is read to create the body of the message.
Otherwise, the creation fails.
Network.JsonRpc.Message.setBody
def (self, body)
Sets the body of the message to body. The Content-Length header
will be automatically updated using the length of the body.
Network.JsonRpc.Message.setHeader
def (self, name, value)
Sets the field name of the header to value.
Network.JsonRpc.Message.toString
def (const self)
Returns the content of the message as a string including headers and body, with CRLF line endings converted to LF.