Package

com.twitter.finatra.http

marshalling

Permalink

package marshalling

Visibility
  1. Public
  2. All

Type Members

  1. trait DefaultMessageBodyReader extends AnyRef

    Permalink

    Marker trait denoting the default MessageBodyReader for the HTTP server.

    Marker trait denoting the default MessageBodyReader for the HTTP server. This default MessageBodyReader is invoked when the com.twitter.finatra.http.internal.marshalling.CallbackConverter cannot find a suitable 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.marshalling.CallbackConverter attempts to locate a com.twitter.finatra.http.internal.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 MessageBodyReader will attempt to convert the incoming request body using the server's configured com.twitter.finatra.json.FinatraObjectMapper and is the basis for the framework's JSON Integration with Routing.

    The DefaultMessageBodyReader trait differs from the 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 MessageBodyReader is expected to only ever generate a single type T from it's parse[T] implementation.

    See also

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

    com.twitter.finatra.http.HttpServer.messageBodyModule

    com.twitter.finatra.http.modules.MessageBodyModule

    com.twitter.finatra.http.internal.marshalling.MessageBodyManager

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

  2. trait DefaultMessageBodyWriter extends MessageBodyWriter[Any]

    Permalink

    A marker trait denoting the default MessageBodyWriter for the HTTP server.

    A marker trait denoting the default MessageBodyWriter for the HTTP server. This default MessageBodyWriter is invoked by either the com.twitter.finatra.http.internal.marshalling.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 MessageBodyWriter will attempt to convert the outgoing type T to a JSON response using the server's configured com.twitter.finatra.json.FinatraObjectMapper.

    See also

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

    com.twitter.finatra.http.HttpServer.messageBodyModule

    com.twitter.finatra.http.modules.MessageBodyModule

    com.twitter.finatra.http.internal.marshalling.MessageBodyManager

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

  3. trait MessageBodyComponent extends AnyRef

    Permalink

    Marker trait for MessageBodyReaders and MessageBodyWriters

  4. trait MessageBodyReader[T] extends MessageBodyComponent

    Permalink

    MessageBodyReader transforms an HTTP Request into an object.

  5. trait MessageBodyWriter[T] extends MessageBodyComponent

    Permalink

    MessageBodyWriter transforms an object into an HTTP Response.

  6. case class WriterResponse(contentType: MediaType, body: Any, headers: Map[String, String] = Map.empty) extends Product with Serializable

    Permalink

Value Members

  1. package mustache

    Permalink

Ungrouped