BaseApplicationResponse
abstract class BaseApplicationResponse : ApplicationResponse
Base class for implementing an ApplicationResponse
Exceptions
class BodyLengthIsTooLong : Content’s actual body size doesn’t match the provided one in |
|
class BodyLengthIsTooSmall : Content’s actual body size doesn’t match the provided one in |
|
class InvalidHeaderForContent : OutgoingContent is trying to set some header that is not allowed for this content type.
For example, only upgrade content can set |
|
class ResponseAlreadySentException : IllegalStateException Thrown when there was already response sent but we are trying to respond again |
Constructors
BaseApplicationResponse(call: ApplicationCall) Base class for implementing an ApplicationResponse |
Properties
open val ByteBuffer pool |
|
val call: ApplicationCall ApplicationCall instance this ApplicationResponse is attached to |
|
open val cookies: ResponseCookies Cookies for this response |
|
val pipeline: ApplicationSendPipeline Pipeline for sending content |
Inherited Properties
abstract val headers: ResponseHeaders Headers for this response |
Functions
fun commitHeaders(content: OutgoingContent): Unit Commit header values and status and pass them to the underlying engine |
|
open fun push(builder: ResponsePushBuilder): Unit Produces HTTP/2 push from server to client or sets HTTP/1.x hint header or does nothing. Exact behaviour is up to engine implementation. |
|
Respond with bytes content |
|
open suspend fun respondFromChannel( Respond from readChannel |
|
Process response with no content |
|
open suspend fun respondOutgoingContent( Process response outgoing content |
|
abstract suspend fun respondUpgrade( Process upgrade response |
|
open suspend fun respondWriteChannelContent( Process response content using OutgoingContent.WriteChannelContent.writeTo. |
|
abstract suspend fun responseChannel(): ByteWriteChannel Get response output channel |
|
abstract fun setStatus(statusCode: HttpStatusCode): Unit Set underlying engine’s response status |
|
open fun status(): HttpStatusCode? Currently set status code for this response, or null if none was set open fun status(value: HttpStatusCode): Unit Set status for this response |
Companion Object Properties
val EngineResponseAtributeKey: AttributeKey<BaseApplicationResponse> Attribute key to access engine’s response instance. This is engine internal API and should be never used by end-users unless you are writing your own engine implementation |
Companion Object Functions
fun setupSendPipeline( Install an application-wide send pipeline interceptor into ApplicationSendPipeline.Engine phase to start response object processing via respondOutgoingContent |
Extension Properties
var ApplicationResponse.responseType: KType? Type of the response object that was passed in respond function. Can be useful for custom serializations. |
Extension Functions
fun ApplicationResponse.cacheControl( Append response |
|
fun ApplicationResponse.contentRange( fun ApplicationResponse.contentRange( Append response |
|
fun ApplicationResponse.etag(value: String): Unit Append response |
|
fun ApplicationResponse.expires(value: LocalDateTime): Unit Append response |
|
fun ApplicationResponse.header( Append HTTP response header with string value fun ApplicationResponse.header( Append HTTP response header with integer numeric value fun ApplicationResponse.header( Append HTTP response header with long integer numeric value fun ApplicationResponse.header( Append HTTP response header with temporal date (date, time and so on) |
|
fun ApplicationResponse.lastModified( Append response |
|
fun ApplicationResponse.link(header: LinkHeader): Unit Append fun ApplicationResponse.link( Append |
Inheritors
abstract class NettyApplicationResponse : |
|
abstract class ServletApplicationResponse : |
|
class TestApplicationResponse : Represents test call response received from server |