Class RequestBody

java.lang.Object
io.vertx.mutiny.ext.web.RequestBody
All Implemented Interfaces:
MutinyDelegate

public class RequestBody extends Object implements MutinyDelegate
NOTE: This class has been automatically generated from the original non Mutiny-ified interface.
See Also:
  • RequestBody
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final TypeArg<RequestBody>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    RequestBody(io.vertx.ext.web.RequestBody delegate)
    Create a new instance of RequestBody delegating to the given (non-null) instance of RequestBody.
    RequestBody(Object delegate)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    io.vertx.core.json.JsonArray
     
    io.vertx.core.json.JsonArray
    asJsonArray(int maxAllowedLength)
    Gets the current body buffer as a JsonArray.
    io.vertx.core.json.JsonObject
     
    io.vertx.core.json.JsonObject
    asJsonObject(int maxAllowedLength)
    Gets the current body buffer as a JsonObject.
    <R> R
    asPojo(Class<R> clazz)
     
    <R> R
    asPojo(Class<R> clazz, int maxAllowedLength)
     
     
    asString(String encoding)
    Get the entire HTTP request body as a string, assuming the specified encoding.
    boolean
    Return true if a BodyHandler was executed before this call in the lifetime of the request.
    io.vertx.core.buffer.Buffer
     
    boolean
     
    io.vertx.ext.web.RequestBody
    Get the delegate instance.
    int
     
    boolean
    A body can be empty if it is not available, or its length is 0.
    int
    Returns the total length of the body buffer.
    newInstance(io.vertx.ext.web.RequestBody delegate)
    Creates a new instance of the RequestBody.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • RequestBody

      public RequestBody(io.vertx.ext.web.RequestBody delegate)
      Create a new instance of RequestBody delegating to the given (non-null) instance of RequestBody.
    • RequestBody

      public RequestBody(Object delegate)
  • 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:
      getDelegate in interface MutinyDelegate
      Returns:
      the delegate instance
    • 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. Can be null.
    • asString

      public String asString(String encoding)
      Get the entire HTTP request body as a string, assuming the specified encoding. The context must have first been routed to a BodyHandler for 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 a JsonObject. If a positive limit is provided the parsing will only happen if the buffer length is smaller or equal to the limit. Otherwise an 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.
      Parameters:
      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.
      Returns:
      Get the entire HTTP request body as a JsonObject. The context must have first been routed to a BodyHandler for this to be populated.
      When the body is null or the "null" JSON literal then null is returned.
    • asJsonArray

      public io.vertx.core.json.JsonArray asJsonArray(int maxAllowedLength)
      Gets the current body buffer as a JsonArray. If a positive limit is provided the parsing will only happen if the buffer length is smaller or equal to the limit. Otherwise an 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.
      Parameters:
      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.
      Returns:
      Get the entire HTTP request body as a JsonArray. The context must have first been routed to a BodyHandler for this to be populated.
      When the body is null or the "null" JSON literal then null is 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 a BodyHandler for this to be populated.
      When the body is null or the "null" JSON literal then null is 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 a BodyHandler for this to be populated.
      When the body is null or the "null" JSON literal then null is 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 a BodyHandler for this to be populated. Can be null.
    • asPojo

      public <R> R asPojo(Class<R> clazz, int maxAllowedLength)
      Parameters:
      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.
      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 is null or the "null" JSON literal then null is returned. WARNING: This feature requires jackson-databind. Or another JSON codec that implements POJO parsing
    • asPojo

      public <R> R asPojo(Class<R> 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 is null or the "null" JSON literal then null is 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 is 0.
      Returns:
      true if empty.
    • available

      public boolean available()
      Return true if a BodyHandler was executed before this call in the lifetime of the request.
      Returns:
      true if body was parsed during the duration of the request.
    • newInstance

      public static RequestBody newInstance(io.vertx.ext.web.RequestBody delegate)
      Creates a new instance of the RequestBody.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object