Package io.vertx.mutiny.ext.web
Class RequestBody
- java.lang.Object
-
- io.vertx.mutiny.ext.web.RequestBody
-
public class RequestBody extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<RequestBody>
__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description RequestBody(io.vertx.ext.web.RequestBody delegate)
RequestBody(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description io.vertx.core.json.JsonArray
asJsonArray()
io.vertx.core.json.JsonArray
asJsonArray(int maxAllowedLength)
io.vertx.core.json.JsonObject
asJsonObject()
io.vertx.core.json.JsonObject
asJsonObject(int maxAllowedLength)
<R> R
asPojo(Class<R> clazz)
<R> R
asPojo(Class<R> clazz, int maxAllowedLength)
String
asString()
String
asString(String encoding)
boolean
available()
Buffer
buffer()
boolean
equals(Object o)
io.vertx.ext.web.RequestBody
getDelegate()
int
hashCode()
boolean
isEmpty()
int
length()
static RequestBody
newInstance(io.vertx.ext.web.RequestBody arg)
String
toString()
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<RequestBody> __TYPE_ARG
-
-
Constructor Detail
-
RequestBody
public RequestBody(io.vertx.ext.web.RequestBody delegate)
-
RequestBody
public RequestBody(Object delegate)
-
-
Method Detail
-
getDelegate
public io.vertx.ext.web.RequestBody getDelegate()
-
asString
public String asString()
- Returns:
- the entire HTTP request body as a string, assuming UTF-8 encoding if the request does not provide the content type charset attribute. If a charset is provided in the request that it shall be respected. The context must have first been routed to a
BodyHandler
for this to be populated.
-
asString
public String asString(String encoding)
- Parameters:
encoding
- the encoding, e.g. "UTF-16"- Returns:
- the body
-
asJsonObject
public io.vertx.core.json.JsonObject asJsonObject(int maxAllowedLength)
- Parameters:
maxAllowedLength
- if the current buffer length is greater than the limit anIllegalStateException
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.- Returns:
- Get the entire HTTP request body as a . The context must have first been routed to a
BodyHandler
for this to be populated.
When the body isnull
or the"null"
JSON literal thennull
is returned.
-
asJsonArray
public io.vertx.core.json.JsonArray asJsonArray(int maxAllowedLength)
- Parameters:
maxAllowedLength
- if the current buffer length is greater than the limit anIllegalStateException
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.- Returns:
- Get the entire HTTP request body as a . The context must have first been routed to a
BodyHandler
for this to be populated.
When the body isnull
or the"null"
JSON literal thennull
is returned.
-
asJsonObject
public io.vertx.core.json.JsonObject asJsonObject()
- Returns:
- Get the entire HTTP request body as a . The context must have first been routed to a
BodyHandler
for this to be populated.
When the body isnull
or the"null"
JSON literal thennull
is returned.
-
asJsonArray
public io.vertx.core.json.JsonArray asJsonArray()
- Returns:
- Get the entire HTTP request body as a . The context must have first been routed to a
BodyHandler
for this to be populated.
When the body isnull
or the"null"
JSON literal thennull
is returned.
-
buffer
public Buffer buffer()
- Returns:
- Get the entire HTTP request body as a . The context must have first been routed to a
BodyHandler
for this to be populated.
-
asPojo
public <R> R asPojo(Class<R> clazz, int maxAllowedLength)
- Parameters:
clazz
-maxAllowedLength
- if the current buffer length is greater than the limit anIllegalStateException
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.- Returns:
- Get the entire HTTP request body as a POJO. The context must have first been routed to a
BodyHandler
for this to be populated.
When the body isnull
or the"null"
JSON literal thennull
is returned. WARNING: This feature requires jackson-databind. Or another JSON codec that implements POJO parsing
-
asPojo
public <R> R asPojo(Class<R> clazz)
- Parameters:
clazz
-- Returns:
- Get the entire HTTP request body as a POJO. The context must have first been routed to a
BodyHandler
for this to be populated.
When the body isnull
or the"null"
JSON literal thennull
is returned. WARNING: This feature requires jackson-databind. Or another JSON codec that implements POJO parsing
-
length
public int length()
- Returns:
- length in bytes.
-
isEmpty
public boolean isEmpty()
- Returns:
true
if empty.
-
available
public boolean available()
- Returns:
true
if body was parsed during the duration of the request.
-
newInstance
public static RequestBody newInstance(io.vertx.ext.web.RequestBody arg)
-
-