Controls how RestRserve encodes and decodes different content types. Designed to work jointly with EncodeDecodeMiddleware

Public fields

handlers

Handlers storage environment.

Methods


Method new()

Creates ContentHandlersFactory object.


Method set_encode()

Set handler to encode body for the specific content type.

Usage

ContentHandlersFactory$set_encode(content_type, FUN)

Arguments

content_type

MIME type.

FUN

Function to encode response body.


Method get_encode()

Get encoder function for the specific content type.

Usage

ContentHandlersFactory$get_encode(content_type)

Arguments

content_type

MIME type.


Method set_decode()

Set handler to decode body for the specific content type.

Usage

ContentHandlersFactory$set_decode(content_type, FUN)

Arguments

content_type

MIME type.

FUN

Function to decode request body.


Method get_decode()

Get decoder function for the specific content type.

Usage

ContentHandlersFactory$get_decode(content_type)

Arguments

content_type

MIME type.


Method list()

Convert handlers to list.

Usage

ContentHandlersFactory$list()

Returns

List of handlers.


Method reset()

Resets all the content handlers to RestRserve defaults.

Usage

ContentHandlersFactory$reset()


Method clone()

The objects of this class are cloneable with this method.

Usage

ContentHandlersFactory$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.