DoubleReceive

class DoubleReceive

This feature provides ability to invoke ApplicationCall.receive several times. Please note that not every type could be received twice. For example, even with this feature installed you can’t receive a channel twice (unless Configuration.receiveEntireContent is enabled). Types that always can be received twice or more: ByteArray, String and Parameters. Also some of content transformation features (such as ContentNegotiation) could support it as well. If not specified, a transformation result is not considered as reusable. So a transformation feature may mark a result as reusable by proceeding with a ApplicationReceiveRequest instance having ApplicationReceiveRequest.reusableValue = true. So installing DoubleReceive with ContentNegotiation provides ability to receive a user type that will be deserialized at first receive and then the same instance will be returned for every further receive invocation. When the same receive type requested as the firstly received, the receive pipeline and content transformation are not triggered (except when Configuration.receiveEntireContent = true).

Types

Configuration

class Configuration

DoubleReceive Feature configuration.

Feature

companion object Feature : 
    ApplicationFeature<Application, Configuration, DoubleReceive>

DoubleReceive feature’s installation object.

Companion Object Properties

key

Unique key that identifies a feature

Companion Object Functions

install

fun install(
    pipeline: Application,
    configure: Configuration.() -> Unit
): DoubleReceive

Feature installation script