Object/Trait

lol.http

ContentEncoder

Related Docs: trait ContentEncoder | package http

Permalink

object ContentEncoder

Library of built-in content encoders.

This provides content encoder functions for the common scala types, and implicit encoder configured with a set of sensible default.

The implicitly provided encoders are chosen by the compiler and cannot be explicitly configured.

For example, this code:

val response = Ok("Hello, world!")

will generate an HTTP response body by encoding the provided string using the UTF-8 charset.

If you want to configure the content encoder, you can just pass it yourself instead of relying on implicit resolution:

val response = Ok("Hello, world!")(text(codec = Codec("us-ascii")))
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ContentEncoder
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. implicit val binary: ContentEncoder[Array[Byte]]

    Permalink

    Encode Array[Byte] binary data.

  6. implicit val byteBuffer: ContentEncoder[ByteBuffer]

    Permalink

    Encode ByteBuffer binary data.

  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @throws( ... )
  8. implicit def defaultFile: ContentEncoder[File]

    Permalink

    Default text encoder, using 16KB chunks.

  9. implicit val defaultText: ContentEncoder[CharSequence]

    Permalink

    Default text encoder, using UTF-8 as charset.

  10. implicit val emptyContent: ContentEncoder[Unit]

    Permalink

    Encode Unit values as an empty content.

  11. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  12. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  13. def file(chunkSize: Int = 16 * 1024): ContentEncoder[File]

    Permalink

    Create a content encoder for java.io.File.

    Create a content encoder for java.io.File.

    chunkSize

    the size of chunks that will be produced in the content stream. Default to 16KB.

    returns

    an encoder for java.io.File.

  14. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  15. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  16. implicit val identity: ContentEncoder[Content]

    Permalink

    Pass-through encoder for Content values.

  17. def inputStream(chunkSize: Int = 16 * 1024): ContentEncoder[InputStream]

    Permalink

    Create a content encoder for java blocking java.io.InputStream.

    Create a content encoder for java blocking java.io.InputStream.

    Note that the inputStream is read lazily and is not buffered in memory. Therefore the content length is not known and no corresponding HTTP header is produced.

    chunkSize

    the size of chunks that will be produced in the content stream. Default to 16KB.

    returns

    an encoder for java.io.InputStream.

  18. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  19. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  20. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  21. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  22. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  23. def text(codec: Codec = Codec.UTF8): ContentEncoder[CharSequence]

    Permalink

    Create text content encoder using the provided charset.

    Create text content encoder using the provided charset.

    codec

    the codec to use to code the string as binary.

    returns

    an encoder for java.lang.Charsequence.

  24. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  25. implicit val urlEncoded: ContentEncoder[Map[String, Seq[String]]]

    Permalink

    Encode url-encoded-form-data from a Map[String,Seq[String]] value.

    Encode url-encoded-form-data from a Map[String,Seq[String]] value. See https://www.w3.org/TR/html5/forms.html#url-encoded-form-data.

  26. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from AnyRef

Inherited from Any

Ungrouped