final case class IndefiniteLength(contentType: ContentType, data: Source[ByteString, Any]) extends javadsl.model.HttpEntity.IndefiniteLength with BodyPartEntity with WithoutKnownLength with Product with Serializable
The model for the entity of a BodyPart with an indefinite length. Note that this type of HttpEntity can only be used for BodyParts.
- Source
- HttpEntity.scala
- Alphabetic
- By Inheritance
- IndefiniteLength
- Serializable
- Product
- Equals
- WithoutKnownLength
- BodyPartEntity
- HttpEntity
- IndefiniteLength
- BodyPartEntity
- HttpEntity
- AnyRef
- Any
- by HttpEntityScalaDSLSugar
- by HttpEntityScalaDSLSugar
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new IndefiniteLength(contentType: ContentType, data: Source[ByteString, Any])
Type Members
- type Self = IndefiniteLength
- Definition Classes
- IndefiniteLength → WithoutKnownLength
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- Implicit
- This member is added by an implicit conversion from IndefiniteLength toany2stringadd[IndefiniteLength] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
- def ->[B](y: B): (IndefiniteLength, B)
- Implicit
- This member is added by an implicit conversion from IndefiniteLength toArrowAssoc[IndefiniteLength] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- 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.
- Definition Classes
- WithoutKnownLength → HttpEntity
- val contentType: ContentType
The
ContentType
associated with this entity.The
ContentType
associated with this entity.- Definition Classes
- IndefiniteLength → WithoutKnownLength → HttpEntity
- val data: Source[ByteString, Any]
- Definition Classes
- IndefiniteLength → WithoutKnownLength
- def dataBytes: Source[ByteString, Any]
A stream of the data of this entity.
A stream of the data of this entity.
- Definition Classes
- WithoutKnownLength → HttpEntity
- def discardBytes(system: ClassicActorSystemProvider): HttpMessage.DiscardedEntity
Java API
Java API
- Definition Classes
- HttpEntity → HttpEntity
- def discardBytes(mat: Materializer): HttpMessage.DiscardedEntity
Discards the entities data bytes by running the
dataBytes
Source contained in thisentity
.Discards the entities data bytes by running the
dataBytes
Source contained in thisentity
.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
- HttpEntity → HttpEntity
- def ensuring(cond: (IndefiniteLength) => Boolean, msg: => Any): IndefiniteLength
- Implicit
- This member is added by an implicit conversion from IndefiniteLength toEnsuring[IndefiniteLength] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: (IndefiniteLength) => Boolean): IndefiniteLength
- Implicit
- This member is added by an implicit conversion from IndefiniteLength toEnsuring[IndefiniteLength] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean, msg: => Any): IndefiniteLength
- Implicit
- This member is added by an implicit conversion from IndefiniteLength toEnsuring[IndefiniteLength] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean): IndefiniteLength
- Implicit
- This member is added by an implicit conversion from IndefiniteLength toEnsuring[IndefiniteLength] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def getContentLengthOption(): OptionalLong
Java API
Java API
- Definition Classes
- HttpEntity → HttpEntity
- def getContentType(): javadsl.model.ContentType
Java API
Java API
- Definition Classes
- HttpEntity → HttpEntity
- def getDataBytes(): Source[ByteString, AnyRef]
Java API
Java API
- Definition Classes
- HttpEntity → HttpEntity
- def isChunked(): Boolean
Returns if this entity is a subtype of HttpEntityChunked.
Returns if this entity is a subtype of HttpEntityChunked.
- Definition Classes
- HttpEntity → HttpEntity
- def isCloseDelimited(): Boolean
Returns if this entity is a subtype of HttpEntityCloseDelimited.
Returns if this entity is a subtype of HttpEntityCloseDelimited.
- Definition Classes
- HttpEntity → HttpEntity
- def isDefault(): Boolean
Returns if this entity is a subtype of HttpEntityDefault.
Returns if this entity is a subtype of HttpEntityDefault.
- Definition Classes
- HttpEntity → HttpEntity
- def isIndefiniteLength(): Boolean
Returns if this entity is a subtype of HttpEntityIndefiniteLength.
Returns if this entity is a subtype of HttpEntityIndefiniteLength.
- Definition Classes
- IndefiniteLength → HttpEntity → HttpEntity
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isKnownEmpty(): Boolean
Determines whether this entity is known to be empty.
Determines whether this entity is known to be empty.
- Definition Classes
- WithoutKnownLength → HttpEntity → HttpEntity
- def isStrict(): Boolean
Returns if this entity is a subtype of HttpEntityStrict.
Returns if this entity is a subtype of HttpEntityStrict.
- Definition Classes
- HttpEntity → HttpEntity
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def productPrefix: String
- Definition Classes
- IndefiniteLength → Product
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toStrict(timeoutMillis: Long, maxBytes: Long, system: ClassicActorSystemProvider): CompletionStage[javadsl.model.HttpEntity.Strict]
Java API
Java API
- Definition Classes
- HttpEntity → HttpEntity
- def toStrict(timeoutMillis: Long, system: ClassicActorSystemProvider): CompletionStage[javadsl.model.HttpEntity.Strict]
Java API
Java API
- Definition Classes
- HttpEntity → HttpEntity
- def toStrict(timeoutMillis: Long, maxBytes: Long, materializer: Materializer): CompletionStage[javadsl.model.HttpEntity.Strict]
Java API
Java API
- Definition Classes
- HttpEntity → HttpEntity
- def toStrict(timeoutMillis: Long, materializer: Materializer): CompletionStage[javadsl.model.HttpEntity.Strict]
Java API
Java API
- Definition Classes
- HttpEntity → HttpEntity
- def toStrict(timeout: FiniteDuration, maxBytes: Long)(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, or with a EntityStreamException when the end of the entity is not reached within the maximum number of bytes.
- Definition Classes
- HttpEntity
- 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, or with a EntityStreamException when the end of the entity is not reached within the maximum number of bytes as configured in
akka.http.parsing.max-to-strict-bytes
. Not that this method does not support different defaults for client- and server use: if you want that, use thetoStrict
method and pass in an explicit maximum number of bytes.- Definition Classes
- HttpEntity
- def toString(): String
- Definition Classes
- IndefiniteLength → AnyRef → Any
- def transformDataBytes(transformer: Flow[ByteString, ByteString, Any]): Self
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 theLastChunk
iftransformer.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.- Definition Classes
- WithoutKnownLength → HttpEntity
- def transformDataBytes(newContentLength: Long, transformer: Flow[ByteString, ByteString, Any]): UniversalEntity
Transforms this' entities data bytes with a transformer that will produce exactly the number of bytes given as
newContentLength
.Transforms this' entities data bytes with a transformer that will produce exactly the number of bytes given as
newContentLength
.- Definition Classes
- HttpEntity
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def withContentType(contentType: ContentType): IndefiniteLength
Creates a copy of this HttpEntity with the
contentType
overridden with the given one.Creates a copy of this HttpEntity with the
contentType
overridden with the given one.- Definition Classes
- IndefiniteLength → BodyPartEntity → HttpEntity
- def withContentType(contentType: javadsl.model.ContentType): HttpEntity
Java API
Java API
- Definition Classes
- HttpEntity → HttpEntity
- def withData(data: Source[ByteString, Any]): IndefiniteLength
- Definition Classes
- IndefiniteLength → WithoutKnownLength
- def withSizeLimit(maxBytes: Long): Self
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 anEntityStreamException
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 aDefault
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.- Definition Classes
- WithoutKnownLength → HttpEntity → HttpEntity
- def withoutSizeLimit(): Self
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.See withSizeLimit for more details.
- Definition Classes
- WithoutKnownLength → HttpEntity → HttpEntity
Shadowed Implicit Value Members
- def discardBytes()(implicit mat: Materializer): HttpMessage.DiscardedEntity
Discards the entities data bytes by running the
dataBytes
Source contained in thisentity
.Discards the entities data bytes by running the
dataBytes
Source contained in thisentity
.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 IndefiniteLength toHttpEntityScalaDSLSugar 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:(indefiniteLength: HttpEntityScalaDSLSugar).discardBytes()(mat)
- Definition Classes
- HttpEntityScalaDSLSugar
- def discardBytes()(implicit mat: Materializer): HttpMessage.DiscardedEntity
Discards the entities data bytes by running the
dataBytes
Source contained in thisentity
.Discards the entities data bytes by running the
dataBytes
Source contained in thisentity
.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 IndefiniteLength toHttpEntityScalaDSLSugar 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:(indefiniteLength: HttpEntityScalaDSLSugar).discardBytes()(mat)
- Definition Classes
- HttpEntityScalaDSLSugar
- val httpEntity: HttpEntity
- Implicit
- This member is added by an implicit conversion from IndefiniteLength toHttpEntityScalaDSLSugar performed by method HttpEntityScalaDSLSugar in akka.http.scaladsl.model.HttpEntity.
- Shadowing
- This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
To access this member you can use a type ascription:(indefiniteLength: HttpEntityScalaDSLSugar).httpEntity
- Definition Classes
- HttpEntityScalaDSLSugar
- val httpEntity: HttpEntity
- Implicit
- This member is added by an implicit conversion from IndefiniteLength toHttpEntityScalaDSLSugar performed by method HttpEntityScalaDSLSugar in akka.http.scaladsl.model.HttpEntity.
- Shadowing
- This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
To access this member you can use a type ascription:(indefiniteLength: HttpEntityScalaDSLSugar).httpEntity
- Definition Classes
- HttpEntityScalaDSLSugar
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)
- def formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from IndefiniteLength toStringFormat[IndefiniteLength] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @deprecated @inline()
- Deprecated
(Since version 2.12.16) Use
formatString.format(value)
instead ofvalue.formatted(formatString)
, or use thef""
string interpolator. In Java 15 and later,formatted
resolves to the new method in String which has reversed parameters.
- def →[B](y: B): (IndefiniteLength, B)
- Implicit
- This member is added by an implicit conversion from IndefiniteLength toArrowAssoc[IndefiniteLength] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use
->
instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.