public static final class HttpEntity.Strict extends java.lang.Object implements HttpEntity.Strict, UniversalEntity, scala.Product, java.io.Serializable
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 and Description |
|---|
Strict(ContentType contentType,
org.apache.pekko.util.ByteString data) |
| Modifier and Type | Method and Description |
|---|---|
long |
contentLength() |
ContentType |
contentType()
The
ContentType associated with this entity. |
org.apache.pekko.util.ByteString |
data() |
org.apache.pekko.stream.scaladsl.Source<org.apache.pekko.util.ByteString,org.apache.pekko.NotUsed> |
dataBytes()
A stream of the data of this entity.
|
org.apache.pekko.util.ByteString |
getData()
Java API
|
boolean |
isKnownEmpty()
Returns if this entity is known to be empty.
|
boolean |
isStrict()
Returns if this entity is a subtype of HttpEntityStrict.
|
java.lang.String |
productPrefix() |
scala.concurrent.Future<HttpEntity.Strict> |
toStrict(scala.concurrent.duration.FiniteDuration timeout,
org.apache.pekko.stream.Materializer fm)
Collects all possible parts and returns a potentially future Strict entity for easier processing.
|
java.lang.String |
toString() |
RequestEntity |
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.Strict |
withContentType(ContentType contentType)
Creates a copy of this HttpEntity with the
contentType overridden with the given one. |
UniversalEntity |
withoutSizeLimit()
Lift the size limit from this entity by returning a new entity instance which skips the size
verification.
|
UniversalEntity |
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcontentLengthOptioncompletionStageCovariant, discardBytes, discardBytes, getContentLengthOption, getContentType, getDataBytes, isChunked, isCloseDelimited, isDefault, isIndefiniteLength, toStrict, toStrict, toStrict, toStrict, toStrict, transformDataBytes, withContentTypepublic Strict(ContentType contentType, org.apache.pekko.util.ByteString data)
public ContentType contentType()
HttpEntityContentType associated with this entity.public org.apache.pekko.util.ByteString data()
public long contentLength()
public boolean isKnownEmpty()
HttpEntityisKnownEmpty in interface HttpEntitypublic boolean isStrict()
HttpEntityisStrict in interface HttpEntitypublic org.apache.pekko.stream.scaladsl.Source<org.apache.pekko.util.ByteString,org.apache.pekko.NotUsed> dataBytes()
HttpEntitypublic scala.concurrent.Future<HttpEntity.Strict> toStrict(scala.concurrent.duration.FiniteDuration timeout, org.apache.pekko.stream.Materializer fm)
HttpEntitypekko.http.parsing.max-to-strict-bytes. Not that this method does not support different
defaults for client- and server use: if you want that, use the toStrict method and pass in an explicit
maximum number of bytes.timeout - (undocumented)fm - (undocumented)public RequestEntity 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)public HttpEntity.Strict withContentType(ContentType contentType)
HttpEntitycontentType overridden with the given one.contentType - (undocumented)public UniversalEntity withSizeLimit(long maxBytes)
HttpEntityWhen 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)public UniversalEntity withoutSizeLimit()
HttpEntityBy 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 HttpEntitypublic java.lang.String productPrefix()
productPrefix in interface scala.Productpublic java.lang.String toString()
toString in class java.lang.Objectpublic org.apache.pekko.util.ByteString getData()
getData in interface HttpEntity.Strict