Class JsonRequest

java.lang.Object
org.restheart.exchange.Exchange<com.google.gson.JsonElement>
org.restheart.exchange.Request<com.google.gson.JsonElement>
org.restheart.exchange.ServiceRequest<com.google.gson.JsonElement>
org.restheart.exchange.JsonRequest

public class JsonRequest extends ServiceRequest<com.google.gson.JsonElement>
Author:
Andrea Di Cesare <andrea@softinstigate.com>
  • Constructor Details

    • JsonRequest

      protected JsonRequest(io.undertow.server.HttpServerExchange exchange)
  • Method Details

    • init

      public static JsonRequest init(io.undertow.server.HttpServerExchange exchange)
    • of

      public static JsonRequest of(io.undertow.server.HttpServerExchange exchange)
    • parseContent

      public com.google.gson.JsonElement parseContent() throws IOException, BadRequestException
      Description copied from class: ServiceRequest
      Parses the content from the exchange and converts it into an instance of the specified type T. This method retrieves data from the exchange, interprets it according to the expected format, and attempts to convert this data into an object of type T.
      Specified by:
      parseContent in class ServiceRequest<com.google.gson.JsonElement>
      Returns:
      an instance of T representing the parsed content
      Throws:
      IOException - if an IO error occurs
      BadRequestException - if the content does not match the expected format for type T