public class RequestBody extends Object
Modifier and Type | Field and Description |
---|---|
static io.vertx.lang.rx.TypeArg<RequestBody> |
__TYPE_ARG |
Constructor and Description |
---|
RequestBody(Object delegate) |
RequestBody(RequestBody delegate) |
Modifier and Type | Method and Description |
---|---|
JsonArray |
asJsonArray() |
JsonArray |
asJsonArray(int maxAllowedLength)
Gets the current body buffer as a .
|
JsonObject |
asJsonObject() |
JsonObject |
asJsonObject(int maxAllowedLength)
Gets the current body buffer as a .
|
<R> R |
asPojo(Class<R> clazz) |
<R> R |
asPojo(Class<R> clazz,
int maxAllowedLength) |
String |
asString() |
String |
asString(String encoding)
Get the entire HTTP request body as a string, assuming the specified encoding.
|
boolean |
available()
Return
true if a BodyHandler was executed before this call in the lifetime
of the request. |
Buffer |
buffer() |
boolean |
equals(Object o) |
RequestBody |
getDelegate() |
int |
hashCode() |
boolean |
isEmpty()
A body can be empty if it is not available, or its length is
0 . |
int |
length()
Returns the total length of the body buffer.
|
static RequestBody |
newInstance(RequestBody arg) |
String |
toString() |
public static final io.vertx.lang.rx.TypeArg<RequestBody> __TYPE_ARG
public RequestBody(RequestBody delegate)
public RequestBody(Object delegate)
public RequestBody getDelegate()
public String asString()
BodyHandler
for this to be populated.public String asString(String encoding)
BodyHandler
for this to be populated.encoding
- the encoding, e.g. "UTF-16"public JsonObject asJsonObject(int maxAllowedLength)
IllegalStateException
is thrown.
When the application is only handling uploads in JSON format, it is recommended to set a limit on
BodyHandler.setBodyLimit(long)
as this will avoid the upload to be parsed and
loaded into the application memory.maxAllowedLength
- if the current buffer length is greater than the limit an IllegalStateException
is thrown. This can be used to avoid DDoS attacks on very long JSON payloads that could take over the CPU while attempting to parse the data.BodyHandler
for this to be populated. null
or the "null"
JSON literal then null
is returned.public JsonArray asJsonArray(int maxAllowedLength)
IllegalStateException
is thrown.
When the application is only handling uploads in JSON format, it is recommended to set a limit on
BodyHandler.setBodyLimit(long)
as this will avoid the upload to be parsed and
loaded into the application memory.maxAllowedLength
- if the current buffer length is greater than the limit an IllegalStateException
is thrown. This can be used to avoid DDoS attacks on very long JSON payloads that could take over the CPU while attempting to parse the data.BodyHandler
for this to be populated. null
or the "null"
JSON literal then null
is returned.public JsonObject asJsonObject()
BodyHandler
for this to be populated. null
or the "null"
JSON literal then null
is returned.public JsonArray asJsonArray()
BodyHandler
for this to be populated. null
or the "null"
JSON literal then null
is returned.public Buffer buffer()
BodyHandler
for this to be populated.public <R> R asPojo(Class<R> clazz, int maxAllowedLength)
clazz
- maxAllowedLength
- if the current buffer length is greater than the limit an IllegalStateException
is thrown. This can be used to avoid DDoS attacks on very long JSON payloads that could take over the CPU while attempting to parse the data.BodyHandler
for this to be populated. null
or the "null"
JSON literal then null
is returned. WARNING: This feature requires jackson-databind. Or another JSON codec that implements POJO parsingpublic <R> R asPojo(Class<R> clazz)
clazz
- BodyHandler
for this to be populated. null
or the "null"
JSON literal then null
is returned. WARNING: This feature requires jackson-databind. Or another JSON codec that implements POJO parsingpublic int length()
-1
.public boolean isEmpty()
0
.true
if empty.public boolean available()
true
if a BodyHandler
was executed before this call in the lifetime
of the request.true
if body was parsed during the duration of the request.public static RequestBody newInstance(RequestBody arg)
Copyright © 2024 Eclipse. All rights reserved.