Class WebbWebUtilities

java.lang.Object
webb.client.ui.helpers.http.WebbWebUtilities

public class WebbWebUtilities extends Object
  • Method Details

    • getRequest

      public static com.fasterxml.jackson.databind.node.ObjectNode getRequest(String urlStr)
      Makes a GET request to the specified URL and returns the response as a JSON object.
      Parameters:
      urlStr - The URL to make the request to.
      Returns:
      The response as a JSON object. { "success": true, //false if there was any error "httpStatusCode": 200, //The HTTP status code we successfully made the request to the server "error": "...", //Only present if success is false. Returns the error message from the catch statements "data": {...} //The data returned by the server if everything went well. Else its null. }
    • getRequest

      public static com.fasterxml.jackson.databind.node.ObjectNode getRequest(String urlStr, HTTPProgressCallback progressCallback)
    • getRequestAsync

      public static void getRequestAsync(String urlStr, FutureReply<com.fasterxml.jackson.databind.node.ObjectNode> futureReply)
      Makes a GET request to the specified URL and returns the response as a JSON object.
      Parameters:
      urlStr - The URL to make the request to.
      futureReply - The response as a JSON object. { "success": true, //false if there was any error "httpStatusCode": 200, //The HTTP status code we successfully made the request to the server "error": "...", //Only present if success is false. Returns the error message from the catch statements "data": {...} //The data returned by the server if everything went well. Else its null. }
    • getRequestAsync

      public static void getRequestAsync(String urlStr, FutureReply<com.fasterxml.jackson.databind.node.ObjectNode> futureReply, HTTPProgressCallback progressCallback)
    • getRequestAsync

      public static <T> void getRequestAsync(String urlStr, Class<T> clazz, FutureReply<T> futureReply)
      Makes a GET request to the specified URL and returns the response as a Java object. Returns null if there was an error.
      Parameters:
      urlStr - The URL to make the request to.
      clazz - The class of the object to return.
      futureReply - The response as a Java object of T, or null if there was an error.
    • getRequestAsync

      public static <T> void getRequestAsync(String urlStr, Class<T> clazz, FutureReply<T> futureReply, HTTPProgressCallback progressCallback)
    • getRequestAsync

      public static <T> void getRequestAsync(String urlStr, Class<T> clazz, T defaultValue, FutureReply<T> futureReply)
      Makes a GET request to the specified URL and returns the response as a Java object.
      Parameters:
      urlStr - The URL to make the request to.
      clazz - The class of the object to return.
      defaultValue - The default value to return if we get an error.
      futureReply - The response as a Java object of T, or defaultValue if there was an error.
    • getRequestAsync

      public static <T> void getRequestAsync(String urlStr, Class<T> clazz, T defaultValue, FutureReply<T> futureReply, HTTPProgressCallback progressCallback)
    • getRequest

      public static <T> T getRequest(String urlStr, Class<T> clazz)
      Makes a GET request to the specified URL and returns the response as a Java object. Returns null if there was an error.
      Parameters:
      urlStr - The URL to make the request to.
      clazz - The class of the object to return.
      Returns:
      The response as a Java object of T, or null if there was an error.
    • getRequest

      public static <T> T getRequest(String urlStr, Class<T> clazz, HTTPProgressCallback progressCallback)
    • getRequest

      public static <T> T getRequest(String urlStr, Class<T> clazz, T defaultValue)
      Makes a GET request to the specified URL and returns the response as a Java object.
      Parameters:
      urlStr - The URL to make the request to.
      clazz - The class of the object to return.
      defaultValue - The default value to return if we get an error.
      Returns:
      The response as a Java object of T, or defaultValue if there was an error.
    • getRequest

      public static <T> T getRequest(String urlStr, Class<T> clazz, T defaultValue, HTTPProgressCallback progressCallback)
    • sendPostRequest

      public static com.fasterxml.jackson.databind.node.ObjectNode sendPostRequest(String urlStr, com.fasterxml.jackson.databind.node.ObjectNode data)
      Makes a POST request to the specified URL and returns the response as a JSON object.
      Parameters:
      urlStr - The URL to make the request to.
      data - The data to send to the server.
      Returns:
      The response as a JSON object. { "success": true, //false if there was any error "httpStatusCode": 200, //The HTTP status code we successfully made the request to the server "error": "...", //Only present if success is false. Returns the error message from the catch statements "data": {...} //The data returned by the server if everything went well. Else its null. }
    • sendPostRequestAsync

      public static void sendPostRequestAsync(String urlStr, com.fasterxml.jackson.databind.node.ObjectNode data, FutureReply<com.fasterxml.jackson.databind.node.ObjectNode> futureReply)
      Makes a POST request to the specified URL and returns the response as a JSON object.
      Parameters:
      urlStr - The URL to make the request to.
      data - The data to send to the server.
      futureReply - The response as a JSON object. { "success": true, //false if there was any error "httpStatusCode": 200, //The HTTP status code we successfully made the request to the server "error": "...", //Only present if success is false. Returns the error message from the catch statements "data": {...} //The data returned by the server if everything went well. Else its null. }