JsonEntityStreamingSupport

org.apache.pekko.http.scaladsl.marshallers.sprayjson.JsonEntityStreamingSupport

Attributes

Source
SprayJsonSupport.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Show all

Members list

Value members

Constructors

def this(maxObjectSize: Int)

Attributes

Source
SprayJsonSupport.scala

Concrete methods

override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any
Source
SprayJsonSupport.scala

Write-side, defines what Content-Type the Marshaller should offer and the final Content-Type of the response.

Write-side, defines what Content-Type the Marshaller should offer and the final Content-Type of the response.

EntityStreamingSupport traits MUST support re-configuring the offered ContentType. This is due to the need integrating with existing systems which sometimes expect custom Content-Types, however really are just plain JSON or something else internally (perhaps with slight extensions).

NOTE: Implementations should specialize the return type to their own Type!

Attributes

Definition Classes
Source
SprayJsonSupport.scala

Java API: Write-side, apply framing to outgoing entity stream.

Java API: Write-side, apply framing to outgoing entity stream.

Most typical usage will be a variant of Flow[ByteString].intersperse.

For example for rendering a JSON array one would return Flow[ByteString].intersperse(ByteString("["), ByteString(","), ByteString("]")) and for rendering a new-line separated CSV simply Flow[ByteString].intersperse(ByteString("\n")).

Attributes

Definition Classes
Source
SprayJsonSupport.scala
override def withParallelMarshalling(parallelism: Int, unordered: Boolean): JsonEntityStreamingSupport

Write-side / read-side, defines parallelism and if ordering should be preserved or not of Source element marshalling.

Write-side / read-side, defines parallelism and if ordering should be preserved or not of Source element marshalling.

Sometimes marshalling multiple elements at once (esp. when elements are not evenly sized, and ordering is not enforced) may yield in higher throughput.

NOTE: Implementations should specialize the return type to their own Type!

Attributes

Definition Classes
Source
SprayJsonSupport.scala

Read-side, allows changing what content types are accepted by this framing.

Read-side, allows changing what content types are accepted by this framing.

EntityStreamingSupport traits MUST support re-configuring the accepted ContentTypeRange.

This is in order to support a-typical APIs which users still want to communicate with using the provided support trait. Typical examples include APIs which return valid application/json however advertise the content type as being application/javascript or vendor specific content types, which still parse correctly as JSON, CSV or something else that a provided support trait is built for.

NOTE: Implementations should specialize the return type to their own Type!

Attributes

Definition Classes
Source
SprayJsonSupport.scala

Inherited methods

Read-side, decode incoming framed entity. For example with an incoming JSON array, chunk it up into JSON objects contained within that array.

Read-side, decode incoming framed entity. For example with an incoming JSON array, chunk it up into JSON objects contained within that array.

Attributes

Definition Classes
Inherited from:
EntityStreamingSupport
Source
EntityStreamingSupport.scala

Write-side, apply framing to outgoing entity stream.

Write-side, apply framing to outgoing entity stream.

Most typical usage will be a variant of Flow[ByteString].intersperse.

For example for rendering a JSON array one would return Flow[ByteString].intersperse(ByteString("["), ByteString(","), ByteString("]")) and for rendering a new-line separated CSV simply Flow[ByteString].intersperse(ByteString("\n")).

Attributes

Definition Classes
Inherited from:
EntityStreamingSupport
Source
EntityStreamingSupport.scala

Concrete fields

Write-side, defines what Content-Type the Marshaller should offer and the final Content-Type of the response.

Write-side, defines what Content-Type the Marshaller should offer and the final Content-Type of the response.

Attributes

Source
SprayJsonSupport.scala

Read-side, decode incoming framed entity. For example with an incoming JSON array, chunk it up into JSON objects contained within that array.

Read-side, decode incoming framed entity. For example with an incoming JSON array, chunk it up into JSON objects contained within that array.

Attributes

Source
SprayJsonSupport.scala

Write-side, apply framing to outgoing entity stream.

Write-side, apply framing to outgoing entity stream.

Most typical usage will be a variant of Flow[ByteString].intersperse.

For example for rendering a JSON array one would return Flow[ByteString].intersperse(ByteString("["), ByteString(","), ByteString("]")) and for rendering a new-line separated CSV simply Flow[ByteString].intersperse(ByteString("\n")).

Attributes

Source
SprayJsonSupport.scala

Write-side / read-side, defines if (un)marshalling should be done in parallel.

Write-side / read-side, defines if (un)marshalling should be done in parallel.

This may be beneficial marshalling the bottleneck in the pipeline.

See also parallelism and withParallelMarshalling.

Attributes

Source
SprayJsonSupport.scala

Read-side, what content types it is able to frame and unmarshall.

Read-side, what content types it is able to frame and unmarshall.

Attributes

Source
SprayJsonSupport.scala

Write-side / read-side, defines if (un)marshalling should preserve ordering of incoming stream elements.

Write-side / read-side, defines if (un)marshalling should preserve ordering of incoming stream elements.

Allowing for parallel and unordered (un)marshalling often yields higher throughput and also allows avoiding head-of-line blocking if some elements are much larger than others.

See also parallelism and withParallelMarshalling.

Attributes

Source
SprayJsonSupport.scala