Package org.example.services
Class HTTPService
- java.lang.Object
-
- org.example.services.HTTPService
-
public class HTTPService extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHTTPService.HTTPMethods
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.net.http.HttpClientgetClient()static HTTPServicegetInstance()java.util.concurrent.CompletableFuture<java.net.http.HttpResponse<java.lang.String>>sendRequest(java.lang.String IP, java.lang.String url, HTTPService.HTTPMethods method, java.lang.String requestBody)Send HTTP request using the app default port
-
-
-
Method Detail
-
getInstance
public static HTTPService getInstance()
-
getClient
public java.net.http.HttpClient getClient()
-
sendRequest
public java.util.concurrent.CompletableFuture<java.net.http.HttpResponse<java.lang.String>> sendRequest(java.lang.String IP, @NotNull java.lang.String url, @NotNull HTTPService.HTTPMethods method, @NotNull java.lang.String requestBody)Send HTTP request using the app default port- Parameters:
IP- - domain or IP without / at the start ex: "192.168.0.14"url- - path to ping with slash : "/test"method- - HTTP request method GET or POST or DELETE or PUTrequestBody-- Returns:
- response
-
-