network.protocols.jsonrpc.message - Palamecia/mint GitHub Wiki

Module

load network.protocols.jsonrpc.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.

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.
- final body Internal message body.
+ @ const decode Creates an instance of Network.JsonRpc.Message from an instance of Serializer...
+ const encode Returns the content of the message as an instance of Serializer.DataStream.
+ @ const fromString Creates a new instance of Network.JsonRpc.Message from a string. The body p...
+ const getAttribute Returns the value of the attribute name of the header.
+ const getBody Returns the body of the message as a hash.
- final headers Internal header data.
+ const in Returns true if the body of the message contains the key attribute; other...
+ const new Creates a new empty message.
+ const setAttribute Sets the attribute name of the header to value.
+ const setBody Sets the body of the message to body. The Content-Length header will be a...
+ const toString Returns the content of the message as a string.

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 (stream, length)

Creates an instance of Network.JsonRpc.Message from an instance of Serializer.DataStream given by stream. The length parameter is the number of bytes to be used to create the message.

Network.JsonRpc.Message.encode

def (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.getAttribute

def (const self, name)

Returns the value of the attribute name of the header.

Network.JsonRpc.Message.getBody

def (const self)

Returns the body of the message as a hash.

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.setAttribute

def (self, name, value)

Sets the attribute name of the header to value.

Network.JsonRpc.Message.setBody

def (self, body)

Sets the body of the message to body. The Content-Length header will be automaticaly updated using the length of the body.

Network.JsonRpc.Message.toString

def (const self)

Returns the content of the message as a string.