package http
- Alphabetic
- By Inheritance
- http
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- trait BodyReader extends AnyRef
Representation of a HTTP message body
Representation of a HTTP message body
- Note
The release of resources must be idempotent, meaning that
discard()may be called after complete consumption of the body and it may also be called numerous times.
- trait BodyWriter extends AnyRef
Output pipe for writing http responses
Output pipe for writing http responses
This is, more or less, an asynchronous
OutputStream - trait ClientActions extends AnyRef
Helper functions for the client
- case class ClientResponse(code: Int, status: String, headers: Headers, body: BodyReader) extends Product with Serializable
HTTP response received by the client
HTTP response received by the client
- code
Response code
- status
Response message. This have no meaning for the HTTP connection, its just for human enjoyment.
- headers
Response headers
- body
BodyReader used to consume the response body.
- trait ClientSessionManager extends AnyRef
Provider of HTTP sessions
Provider of HTTP sessions
Implementations of this interface are responsible for providing a HTTP session on demand, ready to immediately perform a client request dispatch.
- Note
It is required that the methods on implementations of this interface be thread safe.
- type Headers = Seq[(String, String)]
- trait Http1ClientSession extends HttpClientSession
- trait Http2ClientSession extends HttpClientSession
- trait HttpClient extends ClientActions
Generic interface for making HTTP client requests
Generic interface for making HTTP client requests
A HttpClient hides the details of the underlying sockets, connection pools etc. For a representation of a concrete session implementation see HttpClientSession.
- case class HttpClientConfig(maxResponseLineLength: Int = 2 * 1048, maxHeadersLength: Int = 8 * 1024, lenientParser: Boolean = false, channelGroup: Option[AsynchronousChannelGroup] = None, sslContext: Option[SSLContext] = None) extends Product with Serializable
Configuration object for creating a HttpClient
Configuration object for creating a HttpClient
- maxResponseLineLength
maximum permissible length of the initial response line
- maxHeadersLength
maximum combined length of the headers
- lenientParser
whether to be lenient in HTTP/1.x parsing
- channelGroup
the
AsynchronousChannelGroupused to multiplex connections on- sslContext
SSLContextto use for secure connections
- sealed trait HttpClientSession extends AnyRef
Representation of a concrete HTTP session
Representation of a concrete HTTP session
The HttpClientSession represents a true HTTP client session, either HTTP/1.x or HTTP/2.
- case class HttpRequest(method: Method, url: Url, majorVersion: Int, minorVersion: Int, headers: Headers, body: BodyReader) extends Product with Serializable
Standard HTTP request
Standard HTTP request
- method
HTTP request method
- url
request url
- headers
request headers
- body
function which returns the next chunk of the request body. Termination is signaled by an empty
ByteBufferas determined byByteBuffer.hasRemaining().
- case class HttpResponsePrelude(code: Int, status: String, headers: Headers) extends Product with Serializable
The prelude of a standard HTTP response
The prelude of a standard HTTP response
- code
Response status code
- status
Response message. This has no meaning for the protocol, its purely for human enjoyment.
- headers
Response headers.
- case class HttpServerStageConfig(maxNonBodyBytes: Int = 16 * 1024, requestPreludeTimeout: Duration = Duration.Inf, serviceTimeout: Duration = Duration.Inf, maxConcurrentStreams: Int = 100, serviceExecutor: ExecutionContext = Execution.trampoline) extends Product with Serializable
General configuration options for http servers
General configuration options for http servers
TODO: what about things like listening address and port?
- type HttpService = (HttpRequest) => Future[RouteAction]
The basic type that represents a HTTP service
The basic type that represents a HTTP service
val service: HttpService = { req => Future.success(RouteAction.Ok("Hello, world!")) }
- Note
When the
Futurereturned by theRouteActionresolves, server implementations are free to forcibly close the request body.
- type Method = String
- trait RouteAction extends AnyRef
Response generator for HTTP servers
Response generator for HTTP servers
The route action can be thought of as a more complex version of the lambda
(HttpResponsePrelude => Writer) => Future[Writer#Finished]with the key difference being the addition of the type parameter that makes the type of the generic, or more importantly, the
Writer#Finishedtype member generic. By doing so, the only way to satisfy the return value is to call theWritersclose()method which has the return typeFuture[Writer#Finished], ensuring that the writer is closed. - type Url = String
Value Members
- object BodyReader
- object ClientResponse extends Serializable
- object HeaderNames
Incomplete collection of header names, all lower case for easy compatibility with HTTP/2.
- object HttpClient
- object HttpClientConfig extends Serializable
- object HttpClientSession
- object RouteAction