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.

Source
MessageProtocol.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. MessageProtocol
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  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. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from MessageProtocol to any2stringadd[MessageProtocol] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (MessageProtocol, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from MessageProtocol to ArrowAssoc[MessageProtocol] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

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

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def ensuring(cond: (MessageProtocol) ⇒ Boolean, msg: ⇒ Any): MessageProtocol

    Permalink
    Implicit information
    This member is added by an implicit conversion from MessageProtocol to Ensuring[MessageProtocol] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  9. def ensuring(cond: (MessageProtocol) ⇒ Boolean): MessageProtocol

    Permalink
    Implicit information
    This member is added by an implicit conversion from MessageProtocol to Ensuring[MessageProtocol] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  10. def ensuring(cond: Boolean, msg: ⇒ Any): MessageProtocol

    Permalink
    Implicit information
    This member is added by an implicit conversion from MessageProtocol to Ensuring[MessageProtocol] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def ensuring(cond: Boolean): MessageProtocol

    Permalink
    Implicit information
    This member is added by an implicit conversion from MessageProtocol to Ensuring[MessageProtocol] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. final def eq(arg0: AnyRef): Boolean

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

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from MessageProtocol to StringFormat[MessageProtocol] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  16. final def getClass(): Class[_]

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

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

    Permalink
    Definition Classes
    Any
  19. 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.

  20. 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.

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
  25. 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.

  26. def toString(): String

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. def [B](y: B): (MessageProtocol, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from MessageProtocol to ArrowAssoc[MessageProtocol] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from MessageProtocol to any2stringadd[MessageProtocol]

Inherited by implicit conversion StringFormat from MessageProtocol to StringFormat[MessageProtocol]

Inherited by implicit conversion Ensuring from MessageProtocol to Ensuring[MessageProtocol]

Inherited by implicit conversion ArrowAssoc from MessageProtocol to ArrowAssoc[MessageProtocol]

Ungrouped