Package webb.client.ui.helpers.http
Class WebbWebUtilities
java.lang.Object
webb.client.ui.helpers.http.WebbWebUtilities
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.fasterxml.jackson.databind.node.ObjectNodegetRequest(String urlStr) Makes a GET request to the specified URL and returns the response as a JSON object.static <T> TgetRequest(String urlStr, Class<T> clazz) Makes a GET request to the specified URL and returns the response as a Java object.static <T> TgetRequest(String urlStr, Class<T> clazz, T defaultValue) Makes a GET request to the specified URL and returns the response as a Java object.static <T> TgetRequest(String urlStr, Class<T> clazz, T defaultValue, HTTPProgressCallback progressCallback) static <T> TgetRequest(String urlStr, Class<T> clazz, HTTPProgressCallback progressCallback) static com.fasterxml.jackson.databind.node.ObjectNodegetRequest(String urlStr, HTTPProgressCallback progressCallback) static <T> voidgetRequestAsync(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.static <T> voidgetRequestAsync(String urlStr, Class<T> clazz, T defaultValue, FutureReply<T> futureReply, HTTPProgressCallback progressCallback) static <T> voidgetRequestAsync(String urlStr, Class<T> clazz, FutureReply<T> futureReply) Makes a GET request to the specified URL and returns the response as a Java object.static <T> voidgetRequestAsync(String urlStr, Class<T> clazz, FutureReply<T> futureReply, HTTPProgressCallback progressCallback) static voidgetRequestAsync(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.static voidgetRequestAsync(String urlStr, FutureReply<com.fasterxml.jackson.databind.node.ObjectNode> futureReply, HTTPProgressCallback progressCallback) static com.fasterxml.jackson.databind.node.ObjectNodesendPostRequest(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.static voidsendPostRequestAsync(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.
-
Method Details
-
getRequest
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
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
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
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. }
-