public abstract class HttpEntity
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
HttpEntity.Chunked
A chunked entity, backed by a source of chunks.
|
static class |
HttpEntity.Streamed
A streamed entity, backed by a source.
|
static class |
HttpEntity.Strict
A strict entity, where all the data for it is in memory.
|
Modifier and Type | Field and Description |
---|---|
static HttpEntity |
NO_ENTITY
No entity.
|
Modifier and Type | Method and Description |
---|---|
abstract HttpEntity |
as(java.lang.String contentType)
Return the entity as the given content type.
|
abstract play.api.http.HttpEntity |
asScala() |
static HttpEntity |
chunked(akka.stream.javadsl.Source<akka.util.ByteString,?> data,
java.util.Optional<java.lang.String> contentType)
Convert the given source of ByteStrings to a chunked entity.
|
java.util.concurrent.CompletionStage<akka.util.ByteString> |
consumeData(akka.stream.Materializer mat)
Consume the data.
|
abstract java.util.Optional<java.lang.Long> |
contentLength()
The content length, if known
|
abstract java.util.Optional<java.lang.String> |
contentType()
The content type, if defined
|
abstract akka.stream.javadsl.Source<akka.util.ByteString,?> |
dataStream()
The stream of data.
|
static HttpEntity |
fromContent(play.twirl.api.Content content,
java.lang.String charset)
Create an entity from the given content.
|
static HttpEntity |
fromString(java.lang.String content,
java.lang.String charset)
Create an entity from the given String.
|
abstract boolean |
isKnownEmpty()
Whether the entity is known to be empty or not.
|
public static final HttpEntity NO_ENTITY
public abstract java.util.Optional<java.lang.String> contentType()
public abstract boolean isKnownEmpty()
public abstract java.util.Optional<java.lang.Long> contentLength()
public abstract akka.stream.javadsl.Source<akka.util.ByteString,?> dataStream()
public abstract HttpEntity as(java.lang.String contentType)
public java.util.concurrent.CompletionStage<akka.util.ByteString> consumeData(akka.stream.Materializer mat)
public abstract play.api.http.HttpEntity asScala()
public static final HttpEntity fromContent(play.twirl.api.Content content, java.lang.String charset)
content
- The content.charset
- The charset.public static final HttpEntity fromString(java.lang.String content, java.lang.String charset)
content
- The content.charset
- The charset.public static final HttpEntity chunked(akka.stream.javadsl.Source<akka.util.ByteString,?> data, java.util.Optional<java.lang.String> contentType)
data
- The source.contentType
- The optional content type.