Package akka.http.scaladsl.model
Class HttpEntity.Chunked
- java.lang.Object
-
- akka.http.scaladsl.model.HttpEntity.Chunked
-
- All Implemented Interfaces:
HttpEntity,HttpEntity.Chunked,RequestEntity,ResponseEntity,HttpEntity,RequestEntity,ResponseEntity,java.io.Serializable,scala.Equals,scala.Product
- Enclosing interface:
- HttpEntity
public static final class HttpEntity.Chunked extends java.lang.Object implements HttpEntity.Chunked, RequestEntity, scala.Product, java.io.Serializable
The model for the entity of a chunked HTTP message (withTransfer-Encoding: chunked).- See Also:
- Serialized Form
-
-
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
-
-
Constructor Summary
Constructors Constructor Description Chunked(ContentType contentType, akka.stream.scaladsl.Source<HttpEntity.ChunkStreamPart,java.lang.Object> chunks)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description akka.stream.scaladsl.Source<HttpEntity.ChunkStreamPart,java.lang.Object>chunks()scala.Option<java.lang.Object>contentLengthOption()Some(content length) if a length is defined for this entity, None otherwise.ContentTypecontentType()TheContentTypeassociated with this entity.akka.stream.scaladsl.Source<akka.util.ByteString,java.lang.Object>dataBytes()A stream of the data of this entity.akka.stream.javadsl.Source<HttpEntity.ChunkStreamPart,java.lang.Object>getChunks()Java APIbooleanisChunked()Returns if this entity is a subtype of HttpEntityChunked.booleanisKnownEmpty()Returns if this entity is known to be empty.java.lang.StringproductPrefix()java.lang.StringtoString()HttpEntity.ChunkedtransformDataBytes(akka.stream.scaladsl.Flow<akka.util.ByteString,akka.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.ChunkedwithContentType(ContentType contentType)Creates a copy of this HttpEntity with thecontentTypeoverridden with the given one.HttpEntity.ChunkedwithoutSizeLimit()Lift the size limit from this entity by returning a new entity instance which skips the size verification.HttpEntity.ChunkedwithSizeLimit(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.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface akka.http.scaladsl.model.HttpEntity
completionStageCovariant, discardBytes, discardBytes, getContentLengthOption, getContentType, getDataBytes, isCloseDelimited, isDefault, isIndefiniteLength, isStrict, toStrict, toStrict, toStrict, toStrict, toStrict, toStrict, transformDataBytes, withContentType
-
-
-
-
Constructor Detail
-
Chunked
public Chunked(ContentType contentType, akka.stream.scaladsl.Source<HttpEntity.ChunkStreamPart,java.lang.Object> chunks)
-
-
Method Detail
-
contentType
public ContentType contentType()
Description copied from interface:HttpEntityTheContentTypeassociated with this entity.- Specified by:
contentTypein interfaceHttpEntity- Returns:
- (undocumented)
-
chunks
public akka.stream.scaladsl.Source<HttpEntity.ChunkStreamPart,java.lang.Object> chunks()
-
isKnownEmpty
public boolean isKnownEmpty()
Description copied from interface:HttpEntityReturns if this entity is known to be empty. Open-ended entity types like HttpEntityChunked and HttpCloseDelimited will always return false here.- Specified by:
isKnownEmptyin interfaceHttpEntity- Specified by:
isKnownEmptyin interfaceHttpEntity- Returns:
- (undocumented)
-
contentLengthOption
public scala.Option<java.lang.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 interfaceHttpEntity- Returns:
- (undocumented)
-
isChunked
public boolean isChunked()
Description copied from interface:HttpEntityReturns if this entity is a subtype of HttpEntityChunked.- Specified by:
isChunkedin interfaceHttpEntity- Specified by:
isChunkedin interfaceHttpEntity
-
dataBytes
public akka.stream.scaladsl.Source<akka.util.ByteString,java.lang.Object> dataBytes()
Description copied from interface:HttpEntityA stream of the data of this entity.- Specified by:
dataBytesin interfaceHttpEntity- Returns:
- (undocumented)
-
withSizeLimit
public HttpEntity.Chunked withSizeLimit(long maxBytes)
Description 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 most `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.- Specified by:
withSizeLimitin interfaceHttpEntity- Specified by:
withSizeLimitin interfaceHttpEntity- Specified by:
withSizeLimitin interfaceRequestEntity- Specified by:
withSizeLimitin interfaceResponseEntity- Parameters:
maxBytes- (undocumented)- Returns:
- (undocumented)
-
withoutSizeLimit
public HttpEntity.Chunked 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-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.- Specified by:
withoutSizeLimitin interfaceHttpEntity- Specified by:
withoutSizeLimitin interfaceHttpEntity- Specified by:
withoutSizeLimitin interfaceRequestEntity- Specified by:
withoutSizeLimitin interfaceResponseEntity- Returns:
- (undocumented)
-
transformDataBytes
public HttpEntity.Chunked transformDataBytes(akka.stream.scaladsl.Flow<akka.util.ByteString,akka.util.ByteString,java.lang.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 interfaceHttpEntity- Specified by:
transformDataBytesin interfaceRequestEntity- Specified by:
transformDataBytesin interfaceResponseEntity- Parameters:
transformer- (undocumented)- Returns:
- (undocumented)
-
withContentType
public HttpEntity.Chunked withContentType(ContentType contentType)
Description copied from interface:HttpEntityCreates a copy of this HttpEntity with thecontentTypeoverridden with the given one.- Specified by:
withContentTypein interfaceHttpEntity- Specified by:
withContentTypein interfaceRequestEntity- Specified by:
withContentTypein interfaceResponseEntity- Parameters:
contentType- (undocumented)- Returns:
- (undocumented)
-
productPrefix
public java.lang.String productPrefix()
- Specified by:
productPrefixin interfacescala.Product
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getChunks
public akka.stream.javadsl.Source<HttpEntity.ChunkStreamPart,java.lang.Object> getChunks()
Java API- Specified by:
getChunksin interfaceHttpEntity.Chunked
-
-