Trait/Object

com.lightbend.lagom.scaladsl.api.transport

MessageProtocol

Related Docs: object MessageProtocol | package transport

Permalink

sealed trait MessageProtocol extends AnyRef

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.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. MessageProtocol
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract val charset: Option[String]

    Permalink
  2. abstract val contentType: Option[String]

    Permalink
  3. abstract val version: Option[String]

    Permalink
  4. abstract def withCharset(charset: String): MessageProtocol

    Permalink
  5. abstract def withContentType(contentType: String): MessageProtocol

    Permalink
  6. abstract def withVersion(version: String): MessageProtocol

    Permalink

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  10. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  11. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  12. def isText: Boolean

    Permalink

    Whether this message protocol is a text based protocol.

    Whether this message protocol is a text based protocol.

    This is determined by whether the charset is defined.

    returns

    true if this message protocol is text based.

  13. def isUtf8: Boolean

    Permalink

    Whether the protocol uses UTF-8.

    Whether the protocol uses UTF-8.

    returns

    true if the charset used by this protocol is UTF-8, false if it's some other encoding or if no charset is defined.

  14. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  15. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  16. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  18. def toContentTypeHeader: Option[String]

    Permalink

    Convert this message protocol to a content type header, if the content type is defined.

    Convert this message protocol to a content type header, if the content type is defined.

    returns

    The message protocol as a content type header.

  19. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  20. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped