Module : mime

Module Overview

This module provides functions to encapsulate multiple body parts such as attachments into a single message. The communication of such messages follow the MIME (Multipurpose Internet Mail Extensions) specification as specified in the RFC 2045 standard.

Entity refers to the header fields and the content of a message or a part of the body in a multipart entity.

Modify and retrieve the data in an entity

This module provides functions to set and get an entity body from different kinds of message types such as XML, text, JSON, byte[], and body parts. Headers can be modified through functions such as addHeader(), setHeader(), removeHeader(), etc.

For information on the operations, which you can perform with this module, see the below Functions. For examples on the usage of the operations, see the Request with multiparts Example and Response with multiparts Example.

Records

Detail Holds the details of the entity header and body-related errors.

Objects

ContentDisposition Represents values in Content-Disposition header.
Entity Represents the headers and body of a message.
MediaType Describes the nature of the data in the body of a MIME entity.

Functions

base64Decode Deprecated API.
base64DecodeBlob Deprecated API.
base64Encode Deprecated API.
base64EncodeBlob Deprecated API.
getContentDispositionObject Given the Content-Disposition as a string, gets the ContentDisposition object with it.
getMediaType Gets the MediaType object populated with it when the Content-Type is in string.
prepareDecodingErrorWithDetail Constructs a DecodeError with the given details.
prepareEncodingErrorWithDetail Constructs an EncodeError with the given details.

Constants

LEADING Header is placed before the payload of the request/response.
TRAILING Header is placed after the payload of the request/response.
APPLICATION_OCTET_STREAM Represents the application/octet-stream media type.
APPLICATION_JSON Represents the application/json media type.
APPLICATION_XML Represents the application/xml media type.
APPLICATION_SVG_XML Represents the application/svg+xml media type.
APPLICATION_XHTML_XML Represents the application/xhtml+xml media type.
APPLICATION_SOAP_XML Represents the application/soap+xml media type.
APPLICATION_FORM_URLENCODED Represents the application/x-www-form-urlencoded media type.
APPLICATION_PDF Represents the application/pdf media type.
IMAGE_JPEG Represents the image/jpeg media type.
IMAGE_GIF Represents the image/gif media type.
IMAGE_PNG Represents the image/png media type.
MULTIPART_FORM_DATA Represents the multipart/form-data media type.
MULTIPART_MIXED Represents the multipart/mixed media type.
MULTIPART_ALTERNATIVE Represents the multipart/alternative media type.
Represents the multipart/related media type.
MULTIPART_PARALLEL Represents the multipart/parallel media type.
TEXT_PLAIN Represents the text/plain media type.
TEXT_HTML Represents the text/html media type.
TEXT_XML Represents the text/xml media type.
ENCODE_ERROR Identifies encoding errors.
DECODE_ERROR Identifies decoding errors.
GENERIC_MIME_ERROR Identifies generic errors related to MIME.
SET_HEADER_FAILED Identifies the set header errors.
READING_HEADER_FAILED Identifies header parsing errors.
PARSER_ERROR Identifies entity body parsing errors.
INVALID_CONTENT_TYPE Identifies errors related to content-type header.
HEADER_UNAVAILABLE Identifies errors related to header unavailability.
IDLE_TIMEOUT_TRIGGERED Identifies errors related to read/write timeouts.
NO_CONTENT_ERROR_CODE Identifies the errors occurred due to payloads with no content.
BOUNDARY Key name for boundary parameter in MediaType.
START Key name for start parameter in MediaType.
TYPE Key name for type parameter in MediaType.
CHARSET Key name for charset parameter in MediaType.
DEFAULT_CHARSET Default charset to be used with MIME encoding and decoding.
CONTENT_ID Represents content-id header name.
CONTENT_LENGTH Represents content-length header name.
CONTENT_TYPE Represents content-type header name.
CONTENT_DISPOSITION Represents content-disposition header name.

Types

Error Represents MIME related errors.
HeaderPosition Defines the position of the headers in the request/response.

Errors

DecodeError Represents a DecodeError with a detailed message.
EncodeError Represents an EncodeError with a detailed message.
GenericMimeError Represents a GenericMimeError with a detailed message.
HeaderUnavailableError Represents a HeaderUnavailableError with a detailed message.
IdleTimeoutTriggeredError Represents an IdleTimeoutTriggeredError with a detailed message.
InvalidContentTypeError Represents an InvalidContentTypeError with a detailed message.
NoContentError Represents a NoContentError with a detailed message.
ParserError Represents a ParserError with a detailed message.
ReadingHeaderFailed Represents a ReadingHeaderFailed error with a detailed message.
SetHeaderError Represents a SetHeaderError with a detailed message.