public static interface HttpEntity.WithoutKnownLength extends HttpEntity
INTERNAL API
HttpEntity.Chunk, HttpEntity.Chunk$, HttpEntity.Chunked, HttpEntity.Chunked$, HttpEntity.ChunkStreamPart, HttpEntity.ChunkStreamPart$, HttpEntity.CloseDelimited, HttpEntity.CloseDelimited$, HttpEntity.Default, HttpEntity.Default$, HttpEntity.DiscardedEntity, HttpEntity.HttpEntityScalaDSLSugar, HttpEntity.HttpEntityScalaDSLSugar$, HttpEntity.IndefiniteLength, HttpEntity.IndefiniteLength$, HttpEntity.LastChunk, HttpEntity.LastChunk$, HttpEntity.Strict, HttpEntity.Strict$, HttpEntity.WithoutKnownLength| Modifier and Type | Method and Description |
|---|---|
scala.Option<java.lang.Object> |
contentLengthOption()
Some(content length) if a length is defined for this entity, None otherwise.
|
ContentType |
contentType()
The
ContentType associated with this entity. |
org.apache.pekko.stream.scaladsl.Source<org.apache.pekko.util.ByteString,java.lang.Object> |
data() |
org.apache.pekko.stream.scaladsl.Source<org.apache.pekko.util.ByteString,java.lang.Object> |
dataBytes()
A stream of the data of this entity.
|
boolean |
isKnownEmpty()
Determines whether this entity is known to be empty.
|
HttpEntity.WithoutKnownLength |
transformDataBytes(org.apache.pekko.stream.scaladsl.Flow<org.apache.pekko.util.ByteString,org.apache.pekko.util.ByteString,java.lang.Object> transformer)
Returns a copy of the given entity with the ByteString chunks of this entity transformed by the given transformer.
|
HttpEntity.WithoutKnownLength |
withData(org.apache.pekko.stream.scaladsl.Source<org.apache.pekko.util.ByteString,java.lang.Object> data) |
HttpEntity.WithoutKnownLength |
withoutSizeLimit()
Lift the size limit from this entity by returning a new entity instance which skips the size verification.
|
HttpEntity.WithoutKnownLength |
withSizeLimit(long maxBytes)
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. |
completionStageCovariant, discardBytes, discardBytes, getContentLengthOption, getContentType, getDataBytes, isChunked, isCloseDelimited, isDefault, isIndefiniteLength, isStrict, toStrict, toStrict, toStrict, toStrict, toStrict, toStrict, transformDataBytes, withContentType, withContentTypescala.Option<java.lang.Object> contentLengthOption()
HttpEntityIn 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.
ContentType contentType()
HttpEntityContentType associated with this entity.org.apache.pekko.stream.scaladsl.Source<org.apache.pekko.util.ByteString,java.lang.Object> data()
org.apache.pekko.stream.scaladsl.Source<org.apache.pekko.util.ByteString,java.lang.Object> dataBytes()
HttpEntityboolean isKnownEmpty()
HttpEntityisKnownEmpty in interface HttpEntityHttpEntity.WithoutKnownLength transformDataBytes(org.apache.pekko.stream.scaladsl.Flow<org.apache.pekko.util.ByteString,org.apache.pekko.util.ByteString,java.lang.Object> transformer)
HttpEntityChunked 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.
transformer - (undocumented)HttpEntity.WithoutKnownLength withData(org.apache.pekko.stream.scaladsl.Source<org.apache.pekko.util.ByteString,java.lang.Object> data)
HttpEntity.WithoutKnownLength withSizeLimit(long maxBytes)
HttpEntitymaxBytes 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.
withSizeLimit in interface HttpEntitymaxBytes - (undocumented)HttpEntity.WithoutKnownLength withoutSizeLimit()
HttpEntity
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.
withoutSizeLimit in interface HttpEntity