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) |
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)
Consumes the data.
|
abstract java.util.Optional<java.lang.Long> |
contentLength() |
abstract java.util.Optional<java.lang.String> |
contentType() |
abstract akka.stream.javadsl.Source<akka.util.ByteString,?> |
dataStream() |
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() |
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)
contentType
- the content type to use, i.e. "text/html".public java.util.concurrent.CompletionStage<akka.util.ByteString> consumeData(akka.stream.Materializer mat)
mat
- the application's materializer.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.