package transport
- Alphabetic
- Public
- All
Type Members
- final class BadRequest extends TransportException
- final class DeserializationException extends TransportException
-
final
class
ExceptionMessage extends Serializable
A high level exception message.
A high level exception message.
This is used by the default exception serializer to serialize exceptions into messages.
- final class Forbidden extends TransportException
-
trait
HeaderFilter extends AnyRef
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.
-
sealed
trait
MessageHeader extends AnyRef
A message header.
-
sealed
trait
MessageProtocol extends AnyRef
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 asapplication/json
, or it could be an application specific content type, such asapplication/vnd.myservice+json
. It could also contain protocol versioning information, such asapplication/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 theversion
, leaving acontentType
that will be understood by the message serializer.The
charset
applies to text messages, if the message is not in a text format, then nocharset
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. - final class Method extends AnyVal
- final class NotAcceptable extends TransportException
- final class NotFound extends TransportException
- final class PayloadTooLarge extends TransportException
- final class PolicyViolation extends TransportException
-
sealed
trait
RequestHeader extends MessageHeader
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.
-
sealed
trait
ResponseHeader extends MessageHeader
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.
- final class SerializationException extends TransportException
-
sealed
trait
TransportErrorCode extends Serializable
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.
-
class
TransportException extends RuntimeException
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.
- final class UnsupportedMediaType extends TransportException
Value Members
- object BadRequest extends Serializable
- object DeserializationException extends Serializable
- object Forbidden extends Serializable
- object HeaderFilter
- object MessageProtocol
- object Method
- object NotAcceptable extends Serializable
- object NotFound extends Serializable
- object PayloadTooLarge extends Serializable
- object PolicyViolation extends Serializable
- object RequestHeader
- object ResponseHeader
- object SerializationException extends Serializable
- object TransportErrorCode extends Serializable
- object TransportException extends Serializable
- object UnsupportedMediaType extends Serializable
-
object
UserAgentHeaderFilter extends HeaderFilter
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.