Unirest is a lightweight HTTP client library that can be used to make HTTP requests from a Java application. It is easy to use and does not require any external dependencies.
To use Unirest in a JavaFX application, you will first need to add the Unirest library to your project. You can do this by adding the following dependency to your pom.xml
file (if you are using Maven) or by downloading the Unirest JAR file and adding it to your classpath:
<dependency> <groupId>com.mashape.unirest</groupId> <artifactId>unirest-java</artifactId> <version>3.6.03</version> </dependency>
Once you have added the Unirest library to your project, you can use it to make HTTP requests from your JavaFX application. Here is an example of how to make a GET request using Unirest:
import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.JsonNode; import com.mashape.unirest.http.Unirest; import com.mashape.unirest.http.exceptions.UnirestException; ... public void makeRequest() { try { HttpResponse<JsonNode> response = Unirest.get("https://www.lautturi.com/endpoint") .asJson(); int statusCode = response.getStatus(); if (statusCode == 200) { // Request was successful JsonNode body = response.getBody(); } else { // Handle error } }