HTTPHandler¶
This is the interface through which HTTP messages are delivered to application code. On the server, this will be HTTP Requests (GET, HEAD, DELETE, POST, etc) sent from a client. On the client, this will be the HTTP Responses coming back from the server. The protocol is largely symmetrical and the same interface definition is used, though what processing happens behind the interface will of course vary.
This interface delivers asynchronous events when receiving an HTTP
message (called a Payload
). Calls to these methods are made in
the context of the HTTPSession
actor so most of them should be
passing data on to a processing actor.
Each HTTPSession
must have a unique instance of the handler. The
application code does not necessarily know when an HTTPSession
is created,
so the application must provide an instance of HandlerFactory
that
will be called at the appropriate time.
Public Functions¶
apply¶
Parameters¶
- payload: Payload val
Returns¶
- Any tag
chunk¶
Notification of incoming body data. The body belongs to the most
recent Payload
delivered by an apply
notification.
Parameters¶
Returns¶
- None val
finished¶
Notification that no more body chunks are coming. Delivery of this HTTP message is complete.
Returns¶
- None val
cancelled¶
Notification that transferring the payload has been cancelled locally, e.g. by disposing the client, closing the server or manually cancelling a single request.
Returns¶
- None val
failed¶
Notification about failure to transfer the payload (e.g. connection could not be established, authentication failed, connection was closed prematurely, ...)
Parameters¶
- reason: (AuthFailed val | ConnectionClosed val | ConnectFailed val)
Returns¶
- None val
throttled¶
Notification that the session temporarily can not accept more data.
Returns¶
- None val
unthrottled¶
Notification that the session can resume accepting data.
Returns¶
- None val
need_body¶
Notification that the HTTPSession is ready for Stream or Chunked body data.
Returns¶
- None val