Transforms an HTTP Message into an object.
Transforms an object into an HTTP Response.
Transforms an object into an HTTP Response. Usable from Java.
Scala users please use the MessageBodyWriter trait.
,This allows Java users to not have to implement the base #write(Message, T)
unless necessary as a defaulted implementation exists in the trait but needs
to be accessible to Java users as an abstract class.
Marker trait denoting a class that can act as a default com.twitter.finatra.http.marshalling.MessageBodyReader for the HTTP server.
Marker trait denoting a class that can act as a default com.twitter.finatra.http.marshalling.MessageBodyReader for the HTTP server.
This default is invoked when the com.twitter.finatra.http.internal.CallbackConverter
cannot find a suitable com.twitter.finatra.http.marshalling.MessageBodyReader to convert the
incoming Finagle request into the route callback input type. E.g., given a defined route in a Controller:
get("/") { request: T => ... }
The com.twitter.finatra.http.internal.CallbackConverter
attempts to locate a
com.twitter.finatra.http.marshalling.MessageBodyManager which can parse a Finagle
request into the input type T
. If one is not found, this default is invoked.
The framework binds com.twitter.finatra.http.internal.marshalling.DefaultMessageBodyReaderImpl as an overridable implementation via the com.twitter.finatra.http.modules.MessageBodyModule.
To override this implementation, provide a customized com.twitter.inject.TwitterModule by overriding com.twitter.finatra.http.HttpServer.messageBodyModule, e.g.,
class MyServer extends HttpServer { ... override val messageBodyModule = MyCustomMessageBodyModule }
The framework default com.twitter.finatra.http.marshalling.MessageBodyReader will attempt to convert the incoming request body using the server's configured com.twitter.finatra.jackson.ScalaObjectMapper and is the basis for the framework's JSON Integration with Routing.
The com.twitter.finatra.http.marshalling.DefaultMessageBodyReader trait differs from the
com.twitter.finatra.http.marshalling.MessageBodyReader trait in that the
default is not parameterized to a specific type but instead defines a generic parse[T]
function
which can generate a type T
from a given request.
A com.twitter.finatra.http.marshalling.MessageBodyReader is expected to only
ever generate a single type T
from its parse[T]
implementation.
this class is explicitly NOT an extension of com.twitter.finatra.http.marshalling.MessageBodyReader because it is bound to the object graph and needs to support injectable value lookup by type passed into the parse method.
https://twitter.github.io/finatra/user-guide/json/routing.html#requests
com.twitter.finatra.http.internal.marshalling.DefaultMessageBodyReaderImpl
A marker trait denoting a class that can act as a default com.twitter.finatra.http.marshalling.MessageBodyWriter for the HTTP server.
A marker trait denoting a class that can act as a default com.twitter.finatra.http.marshalling.MessageBodyWriter for the HTTP server.
This default is invoked by either the com.twitter.finatra.http.internal.CallbackConverter
(by invoking the com.twitter.finatra.http.response.ResponseBuilder) or
com.twitter.finatra.http.response.ResponseBuilder#write directly to return a suitable
response for a given return type.
The framework binds com.twitter.finatra.http.internal.marshalling.DefaultMessageBodyWriterImpl as an overridable implementation via the com.twitter.finatra.http.modules.MessageBodyModule. To override this implementation, provide a customized com.twitter.inject.TwitterModule by overriding com.twitter.finatra.http.HttpServer.messageBodyModule, e.g.,
class MyServer extends HttpServer { ... override val messageBodyModule = MyCustomMessageBodyModule }
The framework default will attempt to convert the outgoing type T
to a JSON response using the
server's configured com.twitter.finatra.jackson.ScalaObjectMapper.
The com.twitter.finatra.http.marshalling.DefaultMessageBodyWriter trait differs from the
com.twitter.finatra.http.marshalling.MessageBodyWriter trait in that the
default is not parameterized to a specific type but instead defines a generic write[T]
function
which can generate a response from a given type T
.
this class is an extension of the com.twitter.finatra.http.marshalling.MessageBodyWriter
trait parameterized to the Any
type.
https://twitter.github.io/finatra/user-guide/json/routing.html#responses
com.twitter.finatra.http.internal.marshalling.DefaultMessageBodyWriterImpl
Marker trait for MessageBodyReaders and MessageBodyWriters
Manages registration of message body components.
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).
Transforms an HTTP Message into an object.
Transforms an HTTP Message into an object.
Java users should prefer the AbstractMessageBodyReader abstract class.
Transforms an object into an HTTP Response.
Transforms an object into an HTTP Response.
Java users should prefer the AbstractMessageBodyWriter abstract class.
Transforms an HTTP Message into an object. Usable from Java.
Scala users please use the MessageBodyReader trait.