HttpMessage

sealed trait HttpMessage

Defines HTTP message.

HttpMessage defines fundamental characteristics of an HTTP message. HttpRequest and HttpResponse extend the specification to define characteristics specific to their respective message types.

class Object
trait Matchable
class Any

Type members

Types

Specifies start line type.

Specifies start line type.

Value members

Abstract methods

def attributes: Map[String, Any]

Gets message attributes.

Gets message attributes.

Note:

Attributes are arbitrary values associated with message and are not part of transmitted message.

Gets message body.

Gets message body.

def headers: Seq[Header]

Gets message headers.

Gets message headers.

Gets message start line.

Gets message start line.

Concrete methods

def as[T](using parser: BodyParser[T]): T

Gets message body as instance of T.

Gets message body as instance of T.

Value parameters:
parser

body parser

def drain(maxLength: Long): HttpMessage

Drains decoded message body.

Drains decoded message body.

Value parameters:
maxLength

maximum number of bytes

Returns:

this message

Throws:
ReadLimitExceeded

if body exceeds maxLength

def drain(sink: Array[Byte]): Int

Drains decoded message body to supplied sink.

Drains decoded message body to supplied sink.

Value parameters:
sink

buffer to which message body is written

Returns:

number of bytes written

Throws:
BufferOverflowException

  if sink not large enough to hold decoded message body

def drain(sink: Array[Byte], offset: Int, length: Int): Int

Drains decoded message body to supplied sink.

Drains decoded message body to supplied sink.

Value parameters:
length

buffer size (starting at offset)

offset

buffer position

sink

buffer to which message body is written

Returns:

number of bytes written

Throws:
BufferOverflowException

  if sink not large enough to hold decoded message body

IndexOutOfBoundsException

  if offset or length is illegal

def drain(sink: ByteBuffer): sink

Drains decoded message body to supplied sink.

Drains decoded message body to supplied sink.

Value parameters:
sink

buffer to which message body is written

Returns:

this message

Throws:
BufferOverflowException

  if sink not large enough to hold decoded message body

def drain(sink: OutputStream, maxLength: Long): sink

Drains decoded message body to supplied sink.

Drains decoded message body to supplied sink.

Value parameters:
maxLength

maximum number of bytes

sink

stream to which message body is written

Throws:
ReadLimitExceeded

if body exceeds maxLength

def drain(sink: WritableByteChannel, maxLength: Long): sink

Drains decoded message body to supplied sink.

Drains decoded message body to supplied sink.

Value parameters:
maxLength

maximum number of bytes

sink

channel to which message body is written

Throws:
ReadLimitExceeded

if body exceeds maxLength

def getAttribute[T](name: String): Option[T]

Gets attribute value with given name.

Gets attribute value with given name.

Value parameters:
name

attribute name

def getAttributeOrElse[T](name: String, default: => T): T

Gets attribute value with given name, or returns default if attribute not present.

Gets attribute value with given name, or returns default if attribute not present.

Value parameters:
default

default value

name

attribute name

def getHeader(name: String): Option[Header]

Gets first header with given name.

Gets first header with given name.

def getHeaderOrElse(name: String, default: => Header): Header

Gets first header with given name, or returns default if header not present.

Gets first header with given name, or returns default if header not present.

def getHeaderValue(name: String): Option[String]

Gets first header value with given name.

Gets first header value with given name.

def getHeaderValueOrElse(name: String, default: => String): String

Gets first header value with given name, or returns default if header not present.

Gets first header value with given name, or returns default if header not present.

def getHeaderValues(name: String): Seq[String]

Gets header values with given name.

Gets header values with given name.

def getHeaders(name: String): Seq[Header]

Gets headers with given name.

Gets headers with given name.

def hasHeader(name: String): Boolean

Tests for header with given name.

Tests for header with given name.

Gets HTTP version.

Gets HTTP version.