Class MimeMultipartDataFormat

Assembly: redb.Route.DataFormats.Mime.dll

MIME multipart as a data format, Apache Camel's mimeMultipart with a form mode added. It works on the whole
message (): the boundary comes from the content type, the files become message
attachments.

public sealed class MimeMultipartDataFormat : IMessageDataFormat, IMessageSerializer

Inheritance

Object→MimeMultipartDataFormat

Implements

Properties

ContentType

Content type this serializer handles (e.g., "application/json").

public string ContentType { get; }

Methods

Deserialize(byte[], Type)

Deserializes a byte array to a typed value.

public object? Deserialize(byte[] data, Type type)

Deserialize<T>(byte[])

Deserializes a byte array to a typed value.

public T? Deserialize<T>(byte[] data)

MarshalAsync(IExchange, CancellationToken)

Turns the body of exchange.In (and its attachments, when the format carries them) into the wire form, in place.

public ValueTask MarshalAsync(IExchange exchange, CancellationToken ct = default)

Serialize<T>(T)

Serializes a value to a byte array.

public byte[] Serialize<T>(T value)

UnmarshalAsync(IExchange, Type, CancellationToken)

Turns the wire form in exchange.In into targetType, in place.

public ValueTask UnmarshalAsync(IExchange exchange, Type targetType, CancellationToken ct = default)

Constructors

MimeMultipartDataFormat(MimeMultipartDataFormatOptions?)

A format with the given options (defaults when null).

Remarks

Unmarshal. A body that is not multipart/* is left as it is, as Camel does.
multipart/form-data (RFC 7578): the fields become a body, in order with repeated names,
and every part with a file name becomes an attachment named by that file name (as Camel Jetty names uploads), its
part headers kept (the form field name is in Content-Disposition). Any other multipart/*: the first part
becomes the body with its content type, the others attachments named by file name, then Content-ID, then a
generated id. File names lose their directory and line breaks. Large parts spool to a
under the engine's stream cache options; the content type is removed (the form) or set to the first part's.
Marshal. form-data: a (or string pairs, or no body) and the attachments as
files. mixed: the body as the first part and the attachments after it; without attachments the body is left
as it is unless . A new boundary per message,
written into the content type and the Content-Type header; the attachments stay on the message.