public abstract class HttpEntity extends 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(String contentType) |
abstract play.api.http.HttpEntity |
asScala() |
static HttpEntity |
chunked(akka.stream.javadsl.Source<akka.util.ByteString,?> data,
Optional<String> contentType)
Convert the given source of ByteStrings to a chunked entity.
|
CompletionStage<akka.util.ByteString> |
consumeData(akka.stream.Materializer mat)
Consumes the data.
|
abstract Optional<Long> |
contentLength() |
abstract Optional<String> |
contentType() |
abstract akka.stream.javadsl.Source<akka.util.ByteString,?> |
dataStream() |
static HttpEntity |
fromContent(play.twirl.api.Content content,
String charset)
Create an entity from the given content.
|
static HttpEntity |
fromString(String content,
String charset)
Create an entity from the given String.
|
abstract boolean |
isKnownEmpty() |
public static final HttpEntity NO_ENTITY
public abstract boolean isKnownEmpty()
public abstract akka.stream.javadsl.Source<akka.util.ByteString,?> dataStream()
public abstract HttpEntity as(String contentType)
contentType
- the content type to use, i.e. "text/html".public CompletionStage<akka.util.ByteString> consumeData(akka.stream.Materializer mat)
This method should be used carefully, since if the source represents an ephemeral stream, then the entity may not be usable after this method is invoked.
mat
- the application's materializer.public abstract play.api.http.HttpEntity asScala()
public static final HttpEntity fromContent(play.twirl.api.Content content, String charset)
content
- The content.charset
- The charset.public static final HttpEntity fromString(String content, String charset)
content
- The content.charset
- The charset.public static final HttpEntity chunked(akka.stream.javadsl.Source<akka.util.ByteString,?> data, Optional<String> contentType)
data
- The source.contentType
- The optional content type.