Packages

package marshalling

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. Protected

Package Members

  1. package modules

Type Members

  1. abstract class AbstractMessageBodyReader[T] extends MessageBodyReader[T]

    Transforms an HTTP Message into an object.

    Transforms an HTTP Message into an object. Usable from Java.

    Note

    Scala users please use the MessageBodyReader trait.

  2. abstract class AbstractMessageBodyWriter[T] extends MessageBodyWriter[T]

    Transforms an object into an HTTP Response.

    Transforms an object into an HTTP Response. Usable from Java.

    Note

    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.

    ,

    Scala users please use the MessageBodyWriter trait.

  3. trait DefaultMessageBodyReader extends AnyRef

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

    Note

    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.

    See also

    com.twitter.finatra.http.internal.marshalling.DefaultMessageBodyReaderImpl

    com.twitter.finatra.http.marshalling.MessageBodyManager

    com.twitter.finatra.http.modules.MessageBodyModule

    com.twitter.finatra.http.HttpServer.messageBodyModule

    https://twitter.github.io/finatra/user-guide/json/routing.html#requests

  4. trait DefaultMessageBodyWriter extends MessageBodyWriter[Any]

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

    Note

    this class is an extension of the com.twitter.finatra.http.marshalling.MessageBodyWriter trait parameterized to the Any type.

    See also

    com.twitter.finatra.http.internal.marshalling.DefaultMessageBodyWriterImpl

    com.twitter.finatra.http.marshalling.MessageBodyManager

    com.twitter.finatra.http.modules.MessageBodyModule

    com.twitter.finatra.http.HttpServer.messageBodyModule

    https://twitter.github.io/finatra/user-guide/json/routing.html#responses

  5. trait MessageBodyComponent extends AnyRef

    Marker trait for MessageBodyReaders and MessageBodyWriters

  6. class MessageBodyManager extends AnyRef

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

  7. trait MessageBodyReader[T] extends MessageBodyComponent

    Transforms an HTTP Message into an object.

    Transforms an HTTP Message into an object.

    Note

    Java users should prefer the AbstractMessageBodyReader abstract class.

  8. trait MessageBodyWriter[T] extends MessageBodyComponent

    Transforms an object into an HTTP Response.

    Transforms an object into an HTTP Response.

    Note

    Java users should prefer the AbstractMessageBodyWriter abstract class.

  9. case class MustacheBodyComponent(data: Any, templateName: String, contentType: String) extends MessageBodyComponent with Product with Serializable
  10. class MustacheMessageBodyWriter extends MessageBodyWriter[Any]
    Annotations
    @Singleton()
  11. abstract class WriterResponse extends AnyRef

Value Members

  1. object MessageBodyFlags
  2. object MessageBodyManager
  3. object MessageBodyReader
  4. object WriterResponse
  5. object mapper
  6. object response

Ungrouped