Interface BodyPartEntity
-
- All Superinterfaces:
BodyPartEntity
,HttpEntity
,HttpEntity
- All Known Subinterfaces:
UniversalEntity
- All Known Implementing Classes:
HttpEntity.Default
,HttpEntity.IndefiniteLength
,HttpEntity.Strict
public interface BodyPartEntity extends HttpEntity, BodyPartEntity
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface akka.http.javadsl.model.HttpEntity
HttpEntity.Chunked, HttpEntity.ChunkStreamPart, HttpEntity.CloseDelimited, HttpEntity.Default, HttpEntity.DiscardedEntity, HttpEntity.IndefiniteLength, HttpEntity.Strict
-
Nested classes/interfaces inherited from interface akka.http.scaladsl.model.HttpEntity
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
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description BodyPartEntity
withContentType(ContentType contentType)
Creates a copy of this HttpEntity with thecontentType
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 mostmaxBytes
data bytes.-
Methods inherited from interface akka.http.scaladsl.model.HttpEntity
completionStageCovariant, contentLengthOption, contentType, dataBytes, discardBytes, discardBytes, getContentLengthOption, getContentType, getDataBytes, isChunked, isCloseDelimited, isDefault, isIndefiniteLength, isKnownEmpty, isStrict, toStrict, toStrict, toStrict, toStrict, toStrict, toStrict, transformDataBytes, transformDataBytes, withContentType
-
-
-
-
Method Detail
-
withContentType
BodyPartEntity withContentType(ContentType contentType)
Description copied from interface:HttpEntity
Creates a copy of this HttpEntity with thecontentType
overridden with the given one.- Specified by:
withContentType
in interfaceHttpEntity
- Parameters:
contentType
- (undocumented)- Returns:
- (undocumented)
-
withSizeLimit
BodyPartEntity withSizeLimit(long maxBytes)
Description copied from interface: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 mostmaxBytes
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.- Specified by:
withSizeLimit
in interfaceHttpEntity
- Specified by:
withSizeLimit
in interfaceHttpEntity
- Parameters:
maxBytes
- (undocumented)- Returns:
- (undocumented)
-
withoutSizeLimit
BodyPartEntity withoutSizeLimit()
Description copied from interface:HttpEntity
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
HttpEntity.withSizeLimit(long)
for more details.- Specified by:
withoutSizeLimit
in interfaceHttpEntity
- Specified by:
withoutSizeLimit
in interfaceHttpEntity
- Returns:
- (undocumented)
-
-