the configured com.twitter.inject.Injector for the server.
a default message body reader implementation.
a default message body writer implementation.
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.
the MessageBodyComponent to register.
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.
the MessageBodyComponent to register. An instance of the component will be obtained from the injector.
the type to associate to the registered MessageBodyComponent.
Register a MessageBodyWriter to a given Annotation, A.
Register a MessageBodyWriter to a given Annotation, A.
the Annotation type to register against the given MessageBodyWriter type.
the MessageBodyWriter type to associate to the given Annotation. An instance of the MessageBodyWriter will be obtained from the injector.
Register a MessageBodyWriter to a given MessageBodyComponent.
Register a MessageBodyWriter to a given MessageBodyComponent.
the MessageBodyComponent type to register against the given MessageBodyWriter type.
the MessageBodyWriter type to associate to the given MessageBodyComponent. An instance of the MessageBodyWriter will be obtained from the injector
For use from Java
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.
the type into which to parse the message body.
the com.twitter.finagle.http.Message to read
an instance of type T parsed from the Message body contents by a matching MessageBodyReader.
Java users should prefer Message, clazz: Class.
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.
the Any type to use as the key for locating an appropriate MessageBodyWriter.
a suitable writer for the type represented by the given object.
the writerCache is bounded on the number of unique classes returned from controller routes
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).