sealed trait HttpEntity extends javadsl.model.HttpEntity

Models the entity (aka "body" or "content) of an HTTP message.

Source
HttpEntity.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. HttpEntity
  2. HttpEntity
  3. AnyRef
  4. Any
Implicitly
  1. by HttpEntityScalaDSLSugar
  2. by any2stringadd
  3. by StringFormat
  4. by Ensuring
  5. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def contentLengthOption: Option[Long]

    Some(content length) if a length is defined for this entity, None otherwise.

    Some(content length) if a length is defined for this entity, None otherwise. A length is only defined for Strict and Default entity types.

    In many cases it's dangerous to rely on the (non-)existence of a content-length. HTTP intermediaries like (transparent) proxies are allowed to change the transfer-encoding which can result in the entity being delivered as another type as expected.

  2. abstract def contentType: ContentType

    The ContentType associated with this entity.

  3. abstract def dataBytes: Source[ByteString, Any]

    A stream of the data of this entity.

  4. abstract def isKnownEmpty(): Boolean

    Determines whether this entity is known to be empty.

    Determines whether this entity is known to be empty.

    Definition Classes
    HttpEntityHttpEntity
  5. abstract def transformDataBytes(transformer: Flow[ByteString, ByteString, Any]): HttpEntity

    Returns a copy of the given entity with the ByteString chunks of this entity transformed by the given transformer.

    Returns a copy of the given entity with the ByteString chunks of this entity transformed by the given transformer. For a Chunked entity, the chunks will be transformed one by one keeping the chunk metadata (but may introduce an extra chunk before the LastChunk if transformer.onTermination returns additional data).

    This method may only throw an exception if the transformer function throws an exception while creating the transformer. Any other errors are reported through the new entity data stream.

  6. abstract def withContentType(contentType: ContentType): HttpEntity

    Creates a copy of this HttpEntity with the contentType overridden with the given one.

  7. abstract def withSizeLimit(maxBytes: Long): HttpEntity

    Apply the given size limit to this entity by returning a new entity instance which automatically verifies that the data stream encapsulated by this instance produces at most maxBytes data bytes.

    Apply the given size limit to this entity by returning a new entity instance which automatically verifies that the data stream encapsulated by this instance produces at most maxBytes data bytes. In case this verification fails the respective stream will be terminated with an EntityStreamException either directly at materialization time (if the Content-Length is known) or whenever more data bytes than allowed have been read.

    When called on Strict entities the method will return the entity itself if the length is within the bound, otherwise a Default entity with a single element data stream. This allows for potential refinement of the entity size limit at a later point (before materialization of the data stream).

    By default all message entities produced by the HTTP layer automatically carry the limit that is defined in the application's max-content-length config setting. If the entity is transformed in a way that changes the Content-Length and then another limit is applied then this new limit will be evaluated against the new Content-Length. If the entity is transformed in a way that changes the Content-Length and no new limit is applied then the previous limit will be applied against the previous Content-Length.

    Note that the size limit applied via this method will only have any effect if the Source instance contained in this entity has been appropriately modified via the HttpEntity.limitable method. For all entities created by the HTTP layer itself this is always the case, but if you create entities yourself and would like them to properly respect limits defined via this method you need to make sure to apply HttpEntity.limitable yourself.

    Definition Classes
    HttpEntityHttpEntity
  8. abstract def withoutSizeLimit(): HttpEntity

    Lift the size limit from this entity by returning a new entity instance which skips the size verification.

    Lift the size limit from this entity by returning a new entity instance which skips the size verification.

    By default all message entities produced by the HTTP layer automatically carry the limit that is defined in the application's max-content-length config setting. It is recommended to always keep an upper limit on accepted entities to avoid potential attackers flooding you with too large requests/responses, so use this method with caution.

    Note that the size limit applied via this method will only have any effect if the Source instance contained in this entity has been appropriately modified via the HttpEntity.limitable method. For all entities created by the HTTP layer itself this is always the case, but if you create entities yourself and would like them to properly respect limits defined via this method you need to make sure to apply HttpEntity.limitable yourself.

    See withSizeLimit for more details.

    Definition Classes
    HttpEntityHttpEntity

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from HttpEntity to any2stringadd[HttpEntity] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (HttpEntity, B)
    Implicit
    This member is added by an implicit conversion from HttpEntity to ArrowAssoc[HttpEntity] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  8. def discardBytes(mat: Materializer): DiscardedEntity

    Discards the entities data bytes by running the dataBytes Source contained in this entity.

    Discards the entities data bytes by running the dataBytes Source contained in this entity.

    Note: It is crucial that entities are either discarded, or consumed by running the underlying akka.stream.scaladsl.Source as otherwise the lack of consuming of the data will trigger back-pressure to the underlying TCP connection (as designed), however possibly leading to an idle-timeout that will close the connection, instead of just having ignored the data.

    Warning: It is not allowed to discard and/or consume the entity.dataBytes more than once as the stream is directly attached to the "live" incoming data source from the underlying TCP connection. Allowing it to be consumable twice would require buffering the incoming data, thus defeating the purpose of its streaming nature. If the dataBytes source is materialized a second time, it will fail with an "stream can cannot be materialized more than once" exception.

    When called on Strict entities or sources whose values can be buffered in memory, the above warnings can be ignored. Repeated materialization is not necessary in this case, avoiding the mentioned exceptions due to the data being held in memory.

    In future versions, more automatic ways to warn or resolve these situations may be introduced, see issue #18716.

    Definition Classes
    HttpEntityHttpEntity
  9. def ensuring(cond: (HttpEntity) ⇒ Boolean, msg: ⇒ Any): HttpEntity
    Implicit
    This member is added by an implicit conversion from HttpEntity to Ensuring[HttpEntity] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  10. def ensuring(cond: (HttpEntity) ⇒ Boolean): HttpEntity
    Implicit
    This member is added by an implicit conversion from HttpEntity to Ensuring[HttpEntity] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def ensuring(cond: Boolean, msg: ⇒ Any): HttpEntity
    Implicit
    This member is added by an implicit conversion from HttpEntity to Ensuring[HttpEntity] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. def ensuring(cond: Boolean): HttpEntity
    Implicit
    This member is added by an implicit conversion from HttpEntity to Ensuring[HttpEntity] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  15. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from HttpEntity to StringFormat[HttpEntity] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  17. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  18. def getContentLengthOption(): OptionalLong

    Java API

    Java API

    Definition Classes
    HttpEntityHttpEntity
  19. def getContentType(): javadsl.model.ContentType

    Java API

    Java API

    Definition Classes
    HttpEntityHttpEntity
  20. def getDataBytes(): Source[ByteString, AnyRef]

    Java API

    Java API

    Definition Classes
    HttpEntityHttpEntity
  21. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  22. val httpEntity: HttpEntity
    Implicit
    This member is added by an implicit conversion from HttpEntity to HttpEntityScalaDSLSugar performed by method HttpEntityScalaDSLSugar in akka.http.scaladsl.model.HttpEntity.
    Definition Classes
    HttpEntityScalaDSLSugar
  23. def isChunked(): Boolean

    Returns if this entity is a subtype of HttpEntityChunked.

    Returns if this entity is a subtype of HttpEntityChunked.

    Definition Classes
    HttpEntityHttpEntity
  24. def isCloseDelimited(): Boolean

    Returns if this entity is a subtype of HttpEntityCloseDelimited.

    Returns if this entity is a subtype of HttpEntityCloseDelimited.

    Definition Classes
    HttpEntityHttpEntity
  25. def isDefault(): Boolean

    Returns if this entity is a subtype of HttpEntityDefault.

    Returns if this entity is a subtype of HttpEntityDefault.

    Definition Classes
    HttpEntityHttpEntity
  26. def isIndefiniteLength(): Boolean

    Returns if this entity is a subtype of HttpEntityIndefiniteLength.

    Returns if this entity is a subtype of HttpEntityIndefiniteLength.

    Definition Classes
    HttpEntityHttpEntity
  27. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  28. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  29. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  30. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  31. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  32. def toStrict(timeoutMillis: Long, materializer: Materializer): CompletionStage[Strict]

    Java API

    Java API

    Definition Classes
    HttpEntityHttpEntity
  33. def toStrict(timeout: FiniteDuration)(implicit fm: Materializer): Future[Strict]

    Collects all possible parts and returns a potentially future Strict entity for easier processing.

    Collects all possible parts and returns a potentially future Strict entity for easier processing. The Future is failed with an TimeoutException if the stream isn't completed after the given timeout.

  34. def toString(): String
    Definition Classes
    AnyRef → Any
  35. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  37. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  38. def withContentType(contentType: javadsl.model.ContentType): HttpEntity

    Java API

    Java API

    Definition Classes
    HttpEntityHttpEntity
  39. def [B](y: B): (HttpEntity, B)
    Implicit
    This member is added by an implicit conversion from HttpEntity to ArrowAssoc[HttpEntity] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Shadowed Implicit Value Members

  1. def discardBytes()(implicit mat: Materializer): DiscardedEntity

    Discards the entities data bytes by running the dataBytes Source contained in this entity.

    Discards the entities data bytes by running the dataBytes Source contained in this entity.

    Note: It is crucial that entities are either discarded, or consumed by running the underlying akka.stream.scaladsl.Source as otherwise the lack of consuming of the data will trigger back-pressure to the underlying TCP connection (as designed), however possibly leading to an idle-timeout that will close the connection, instead of just having ignored the data.

    Warning: It is not allowed to discard and/or consume the entity.dataBytes more than once as the stream is directly attached to the "live" incoming data source from the underlying TCP connection. Allowing it to be consumable twice would require buffering the incoming data, thus defeating the purpose of its streaming nature. If the dataBytes source is materialized a second time, it will fail with an "stream can cannot be materialized more than once" exception.

    In future versions, more automatic ways to warn or resolve these situations may be introduced, see issue #18716.

    Implicit
    This member is added by an implicit conversion from HttpEntity to HttpEntityScalaDSLSugar performed by method HttpEntityScalaDSLSugar in akka.http.scaladsl.model.HttpEntity.
    Shadowing
    This implicitly inherited member is shadowed by one or more members in this class.
    To access this member you can use a type ascription:
    (httpEntity: HttpEntityScalaDSLSugar).discardBytes()(mat)
    Definition Classes
    HttpEntityScalaDSLSugar

Inherited from javadsl.model.HttpEntity

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion HttpEntityScalaDSLSugar from HttpEntity to HttpEntityScalaDSLSugar

Inherited by implicit conversion any2stringadd from HttpEntity to any2stringadd[HttpEntity]

Inherited by implicit conversion StringFormat from HttpEntity to StringFormat[HttpEntity]

Inherited by implicit conversion Ensuring from HttpEntity to Ensuring[HttpEntity]

Inherited by implicit conversion ArrowAssoc from HttpEntity to ArrowAssoc[HttpEntity]

Ungrouped