A high level exception message.
Filter for headers.
Filter for headers.
This is used to transform transport and protocol headers according to various strategies for protocol and version negotiation, as well as authentication.
A message header.
A message protocol.
A message protocol.
This describes the negotiated protocol being used for a message. It has three elements, a content type, a charset, and a version.
The contentType
may be registered mime type such as application/json
, or it could be an application
specific content type, such as application/vnd.myservice+json
. It could also contain protocol versioning
information, such as application/vnd.github.v3+json
. During the protocol negotiation process, the
content type may be transformed, for example, if the content type contains a version, the configured
HeaderFilter will be expected to extract that version out into the version
, leaving a contentType
that
will be understood by the message serializer.
The charset
applies to text messages, if the message is not in a text format, then no charset
should be specified. This is not only used in setting of content negotiation headers, it's also used as a hint to
the framework of when it can treat a message as text. For example, if the charset is set, then when a message gets
sent via WebSockets, it will be sent as a text message, otherwise it will be sent as a binary message.
The version
is used to describe the version of the protocol being used. Lagom does not, out of the box,
prescribe any semantics around the version, from Lagom's perspective, two message protocols with different versions
are two different protocols. The version is however treated as a separate piece of information so that generic
parsers, such as json/xml, can make sensible use of the content type passed to them. The version could come from
a media type header, but it does not necessarily have to come from there, it could come from the URI or any other
header.
MessageProtocol
instances can also be used in content negotiation, an empty value means that any value
is accepted.
A request header.
A request header.
This header may or may not be mapped down onto HTTP. In order to remain agnostic to the underlying protocol, information required by Lagom, such as protocol information, is extracted. It is encouraged that the protocol information always be used in preference to reading the information directly out of headers, since the headers may not contain the necessary protocol information.
The headers are however still provided, in case information needs to be extracted out of non standard headers.
This header may or may not be mapped down onto HTTP.
This header may or may not be mapped down onto HTTP. In order to remain agnostic to the underlying protocol, information required by Lagom, such as protocol information, is extracted. It is encouraged that the protocol information always be used in preference to reading the information directly out of headers, since the headers may not contain the necessary protocol information.
The headers are however still provided, in case information needs to be extracted out of non standard headers.
An error code that gets translated into an appropriate underlying error code.
An error code that gets translated into an appropriate underlying error code.
This attempts to match up corresponding HTTP error codes with WebSocket close codes, so that user code can generically select a code without worrying about the underlying transport.
While most WebSocket close codes that we typically use do have a corresponding HTTP error code, there are many HTTP error codes that don't have a corresponding WebSocket close code. In these cases, we use the private WebSocket close code range (4xxx), with the HTTP error code as the last three digits. Such WebSocket close codes will be in the range 4400 to 4599.
This class should only be used to represent error codes, status codes like HTTP 200 should not be represented using this class. This is enforced for HTTP codes, since they have a well defined categorisation, codes between 400 and 599 are considered errors. It is however not enforced for WebSockets, since the WebSocket protocol defines no such categorisation of codes, it specifies a number of well known codes from 1000 to 1015, with no particular pattern to their meaning, and the remaining codes are only categorised by whether they are private, reserved for the WebSocket spec, or reserved for applications to specify.
For WebSocket close codes that are not known, or are not in the private range of 4400 to 4599 defined by us, this use class uses the generic HTTP 404 error code.
An exception that can be translated down to a specific error in the transport.
An exception that can be translated down to a specific error in the transport.
Transport exceptions describe the HTTP/WebSocket error code associated with them, allowing Lagom to send an error code specific to the type of error. They also have an exception message, which is used both to capture exception details, as well as to identify the exception, so that the right type of exception can be deserialized at the other end.
Transfers service principal information via the User-Agent
header.
Transfers service principal information via the User-Agent
header.
If using this on a service that serves requests from the outside world, it would be a good idea to block the
User-Agent
header in the web facing load balancer/proxy.
A high level exception message.
This is used by the default exception serializer to serialize exceptions into messages.