Package io.vertx.mutiny.ext.web
Class RequestBody
java.lang.Object
io.vertx.mutiny.ext.web.RequestBody
- All Implemented Interfaces:
MutinyDelegate
NOTE: This class has been automatically generated from the
original non Mutiny-ified interface.- See Also:
-
RequestBody
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRequestBody(io.vertx.ext.web.RequestBody delegate) Create a new instance ofRequestBodydelegating to the given (non-null) instance ofRequestBody.RequestBody(Object delegate) -
Method Summary
Modifier and TypeMethodDescriptionio.vertx.core.json.JsonArrayio.vertx.core.json.JsonArrayasJsonArray(int maxAllowedLength) Gets the current body buffer as aJsonArray.io.vertx.core.json.JsonObjectio.vertx.core.json.JsonObjectasJsonObject(int maxAllowedLength) Gets the current body buffer as aJsonObject.<R> R<R> RasString()Get the entire HTTP request body as a string, assuming the specified encoding.booleanReturntrueif aBodyHandlerwas executed before this call in the lifetime of the request.io.vertx.core.buffer.Bufferbuffer()booleanio.vertx.ext.web.RequestBodyGet the delegate instance.inthashCode()booleanisEmpty()A body can be empty if it is not available, or its length is0.intlength()Returns the total length of the body buffer.static RequestBodynewInstance(io.vertx.ext.web.RequestBody delegate) Creates a new instance of theRequestBody.toString()
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
RequestBody
public RequestBody(io.vertx.ext.web.RequestBody delegate) Create a new instance ofRequestBodydelegating to the given (non-null) instance ofRequestBody. -
RequestBody
-
-
Method Details
-
getDelegate
public io.vertx.ext.web.RequestBody getDelegate()Get the delegate instance.This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.
- Specified by:
getDelegatein interfaceMutinyDelegate- Returns:
- the delegate instance
-
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
BodyHandlerfor this to be populated. Can benull.
-
asString
Get the entire HTTP request body as a string, assuming the specified encoding. The context must have first been routed to aBodyHandlerfor this to be populated.- Parameters:
encoding- the encoding, e.g. "UTF-16"- Returns:
- the body. Can be
null.
-
asJsonObject
public io.vertx.core.json.JsonObject asJsonObject(int maxAllowedLength) Gets the current body buffer as aJsonObject. If a positive limit is provided the parsing will only happen if the buffer length is smaller or equal to the limit. Otherwise anIllegalStateExceptionis thrown. When the application is only handling uploads in JSON format, it is recommended to set a limit onBodyHandler.setBodyLimit(long)as this will avoid the upload to be parsed and loaded into the application memory.- Parameters:
maxAllowedLength- if the current buffer length is greater than the limit anIllegalStateExceptionis 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
JsonObject. The context must have first been routed to aBodyHandlerfor this to be populated.
When the body isnullor the"null"JSON literal thennullis returned.
-
asJsonArray
public io.vertx.core.json.JsonArray asJsonArray(int maxAllowedLength) Gets the current body buffer as aJsonArray. If a positive limit is provided the parsing will only happen if the buffer length is smaller or equal to the limit. Otherwise anIllegalStateExceptionis thrown. When the application is only handling uploads in JSON format, it is recommended to set a limit onBodyHandler.setBodyLimit(long)as this will avoid the upload to be parsed and loaded into the application memory.- Parameters:
maxAllowedLength- if the current buffer length is greater than the limit anIllegalStateExceptionis 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
JsonArray. The context must have first been routed to aBodyHandlerfor this to be populated.
When the body isnullor the"null"JSON literal thennullis returned.
-
asJsonObject
public io.vertx.core.json.JsonObject asJsonObject()- Returns:
- Get the entire HTTP request body as a
JsonObject. The context must have first been routed to aBodyHandlerfor this to be populated.
When the body isnullor the"null"JSON literal thennullis returned.
-
asJsonArray
public io.vertx.core.json.JsonArray asJsonArray()- Returns:
- Get the entire HTTP request body as a
JsonArray. The context must have first been routed to aBodyHandlerfor this to be populated.
When the body isnullor the"null"JSON literal thennullis returned.
-
buffer
public io.vertx.core.buffer.Buffer buffer()- Returns:
- Get the entire HTTP request body as a
Buffer. The context must have first been routed to aBodyHandlerfor this to be populated. Can benull.
-
asPojo
- Parameters:
maxAllowedLength- if the current buffer length is greater than the limit anIllegalStateExceptionis 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
BodyHandlerfor this to be populated.
When the body isnullor the"null"JSON literal thennullis returned. WARNING: This feature requires jackson-databind. Or another JSON codec that implements POJO parsing
-
asPojo
- Returns:
- Get the entire HTTP request body as a POJO. The context must have first been routed to a
BodyHandlerfor this to be populated.
When the body isnullor the"null"JSON literal thennullis returned. WARNING: This feature requires jackson-databind. Or another JSON codec that implements POJO parsing
-
length
public int length()Returns the total length of the body buffer. This is the length in bytes. When there is no buffer the length is-1.- Returns:
- length in bytes.
-
isEmpty
public boolean isEmpty()A body can be empty if it is not available, or its length is0.- Returns:
trueif empty.
-
available
public boolean available()Returntrueif aBodyHandlerwas executed before this call in the lifetime of the request.- Returns:
trueif body was parsed during the duration of the request.
-
newInstance
Creates a new instance of theRequestBody. -
hashCode
public int hashCode() -
equals
-
toString
-