Packages

class MessageBodyManager extends AnyRef

Manages registration of message body components. I.e., components that specify how to parse an incoming Finagle HTTP request body into a model object ("message body reader") and how to render a given type as a response ("message body writer").

A default implementation for both a reader and a writer is necessary in order to specify the behavior to invoke when a reader or writer is not found for a requested type T. The framework binds two default implementations: DefaultMessageBodyReader and DefaultMessageBodyWriter via the com.twitter.finatra.http.modules.MessageBodyModule.

These defaults are overridable by providing a customized MessageBodyModule in your com.twitter.finatra.http.HttpServer by overriding the com.twitter.finatra.http.HttpServer.MessageBodyModule.

When the MessageBodyManager is obtained from the injector (which is configured with the framework com.twitter.finatra.http.modules.MessageBodyModule) the framework default implementations for the reader and writer will be provided accordingly (along with the configured server injector).

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

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def add[Component <: MessageBodyComponent]()(implicit arg0: ClassTag[Component], tt: scala.reflect.api.JavaUniverse.TypeTag[Component]): Unit

    Register a MessageBodyReader or MessageBodyWriter to its parameterized type.

    Register a MessageBodyReader or MessageBodyWriter to its parameterized type. E.g., a MessageBodyReader[Foo] will register the given reader for the Foo type.

    Component

    the MessageBodyComponent to register.

  5. final def addExplicit[Component <: MessageBodyComponent, T]()(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[Component], arg1: scala.reflect.api.JavaUniverse.TypeTag[T]): Unit

    Register a MessageBodyReader or MessageBodyWriter to an explicitly given type.

    Register a MessageBodyReader or MessageBodyWriter to an explicitly given type. E.g., given a MessageBodyReader[Car] and a type of Audi the MessageBodyReader[Car] will be registered to the Audi type. This is useful when you want to register subtypes to a reader/writer of their parent type.

    Component

    the MessageBodyComponent to register. An instance of the component will be obtained from the injector.

    T

    the type to associate to the registered MessageBodyComponent.

  6. final def addWriterByAnnotation[A <: Annotation, Writer <: MessageBodyWriter[_]]()(implicit arg0: Manifest[A], arg1: Manifest[Writer]): Unit

    Register a MessageBodyWriter to a given Annotation, A.

    Register a MessageBodyWriter to a given Annotation, A.

    A

    the Annotation type to register against the given MessageBodyWriter type.

    Writer

    the MessageBodyWriter type to associate to the given Annotation. An instance of the MessageBodyWriter will be obtained from the injector.

  7. final def addWriterByComponentType[Component <: MessageBodyComponent, Writer <: MessageBodyWriter[_]]()(implicit arg0: Manifest[Component], arg1: Manifest[Writer]): Unit

    Register a MessageBodyWriter to a given MessageBodyComponent.

    Component

    the MessageBodyComponent type to register against the given MessageBodyWriter type.

    Writer

    the MessageBodyWriter type to associate to the given MessageBodyComponent. An instance of the MessageBodyWriter will be obtained from the injector

  8. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  13. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  18. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. final def read[T](message: Message, clazz: Class[T]): T

    For use from Java

  20. final def read[T](message: Message)(implicit tt: scala.reflect.api.JavaUniverse.TypeTag[T]): T

    Read the body of a com.twitter.finagle.http.Message into a type T.

    Read the body of a com.twitter.finagle.http.Message into a type T. Performs a lookup of a matching MessageBodyReader for the type T and invokes the MessageBodyReader#parse method of the matching reader. Otherwise if no matching reader for the type T is found, the defaultMessageBodyReader#parse method is invoked.

    T

    the type into which to parse the message body.

    message

    the com.twitter.finagle.http.Message to read

    returns

    an instance of type T parsed from the Message body contents by a matching MessageBodyReader.

    Note

    Java users should prefer Message, clazz: Class.

  21. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  22. def toString(): String
    Definition Classes
    AnyRef → Any
  23. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  24. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  25. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  26. final def writer(obj: Any): MessageBodyWriter[Any]

    Return a MessageBodyWriter over the type of the class from the given object.

    Return a MessageBodyWriter over the type of the class from the given object. If a suitable MessageBodyWriter cannot be located the defaultMessageBodyWriter will be returned.

    obj

    the Any type to use as the key for locating an appropriate MessageBodyWriter.

    returns

    a suitable writer for the type represented by the given object.

    Note

    the writerCache is bounded on the number of unique classes returned from controller routes

Inherited from AnyRef

Inherited from Any

Ungrouped