Interface HttpEntity.WithoutKnownLength
- All Superinterfaces:
- HttpEntity,- HttpEntity
- All Known Implementing Classes:
- HttpEntity.CloseDelimited,- HttpEntity.IndefiniteLength
- Enclosing interface:
- HttpEntity
INTERNAL API
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.apache.pekko.http.scaladsl.model.HttpEntityHttpEntity.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 SummaryModifier and TypeMethodDescriptionscala.Option<Object>Some(content length) if a length is defined for this entity, None otherwise.TheContentTypeassociated with this entity.org.apache.pekko.stream.scaladsl.Source<org.apache.pekko.util.ByteString,Object> data()org.apache.pekko.stream.scaladsl.Source<org.apache.pekko.util.ByteString,Object> A stream of the data of this entity.booleanDetermines whether this entity is known to be empty.transformDataBytes(org.apache.pekko.stream.scaladsl.Flow<org.apache.pekko.util.ByteString, org.apache.pekko.util.ByteString, Object> transformer) Returns a copy of the given entity with the ByteString chunks of this entity transformed by the given transformer.Lift the size limit from this entity by returning a new entity instance which skips the size verification.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 mostmaxBytesdata bytes.Methods inherited from interface org.apache.pekko.http.scaladsl.model.HttpEntitycompletionStageCovariant, discardBytes, discardBytes, getContentLengthOption, getContentType, getDataBytes, isChunked, isCloseDelimited, isDefault, isIndefiniteLength, isStrict, toStrict, toStrict, toStrict, toStrict, toStrict, toStrict, transformDataBytes, withContentType, withContentType
- 
Method Details- 
contentLengthOptionscala.Option<Object> contentLengthOption()Description copied from interface:HttpEntitySome(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. - Specified by:
- contentLengthOptionin interface- HttpEntity
- Returns:
- (undocumented)
 
- 
contentTypeContentType contentType()Description copied from interface:HttpEntityTheContentTypeassociated with this entity.- Specified by:
- contentTypein interface- HttpEntity
- Returns:
- (undocumented)
 
- 
dataorg.apache.pekko.stream.scaladsl.Source<org.apache.pekko.util.ByteString,Object> data()
- 
dataBytesorg.apache.pekko.stream.scaladsl.Source<org.apache.pekko.util.ByteString,Object> dataBytes()Description copied from interface:HttpEntityA stream of the data of this entity.- Specified by:
- dataBytesin interface- HttpEntity
- Returns:
- (undocumented)
 
- 
isKnownEmptyboolean isKnownEmpty()Description copied from interface:HttpEntityDetermines whether this entity is known to be empty.- Specified by:
- isKnownEmptyin interface- HttpEntity
- Specified by:
- isKnownEmptyin interface- HttpEntity
- Returns:
- (undocumented)
 
- 
transformDataBytesHttpEntity.WithoutKnownLength transformDataBytes(org.apache.pekko.stream.scaladsl.Flow<org.apache.pekko.util.ByteString, org.apache.pekko.util.ByteString, Object> transformer) Description copied from interface:HttpEntityReturns a copy of the given entity with the ByteString chunks of this entity transformed by the given transformer. For aChunkedentity, the chunks will be transformed one by one keeping the chunk metadata (but may introduce an extra chunk before theLastChunkiftransformer.onTerminationreturns additional data).This method may only throw an exception if the transformerfunction throws an exception while creating the transformer. Any other errors are reported through the new entity data stream.- Specified by:
- transformDataBytesin interface- HttpEntity
- Parameters:
- transformer- (undocumented)
- Returns:
- (undocumented)
 
- 
withDataHttpEntity.WithoutKnownLength withData(org.apache.pekko.stream.scaladsl.Source<org.apache.pekko.util.ByteString, Object> data) 
- 
withSizeLimitDescription copied from interface:HttpEntityApply 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 mostmaxBytesdata bytes. In case this verification fails the respective stream will be terminated with anEntityStreamExceptioneither directly at materialization time (if the Content-Length is known) or whenever more data bytes than allowed have been read.When called on Strictentities the method will return the entity itself if the length is within the bound, otherwise aDefaultentity 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-lengthconfig 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:
- withSizeLimitin interface- HttpEntity
- Specified by:
- withSizeLimitin interface- HttpEntity
- Parameters:
- maxBytes- (undocumented)
- Returns:
- (undocumented)
 
- 
withoutSizeLimitHttpEntity.WithoutKnownLength withoutSizeLimit()Description copied from interface:HttpEntityLift 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-lengthconfig 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:
- withoutSizeLimitin interface- HttpEntity
- Specified by:
- withoutSizeLimitin interface- HttpEntity
- Returns:
- (undocumented)
 
 
-