public interface BodyPartEntity extends HttpEntity, BodyPartEntity
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 |
---|---|
BodyPartEntity |
withContentType(ContentType contentType)
Creates a copy of this HttpEntity with the
contentType overridden with the given one. |
BodyPartEntity |
withoutSizeLimit()
Lift the size limit from this entity by returning a new entity instance which skips the size verification.
|
BodyPartEntity |
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, contentLengthOption, contentType, dataBytes, discardBytes, discardBytes, getContentLengthOption, getContentType, getDataBytes, isChunked, isCloseDelimited, isDefault, isIndefiniteLength, isKnownEmpty, isStrict, toStrict, toStrict, toStrict, toStrict, toStrict, toStrict, transformDataBytes, transformDataBytes, withContentType
BodyPartEntity withContentType(ContentType contentType)
HttpEntity
contentType
overridden with the given one.contentType
- (undocumented)BodyPartEntity withSizeLimit(long maxBytes)
HttpEntity
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.
withSizeLimit
in interface HttpEntity
maxBytes
- (undocumented)BodyPartEntity 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