"# SniffDataHttpApplication"
Multi-Module Maven Application with Java Modules , http.HttpClient connection ,still in progress adding new functionality
- Java - version 12;
- maven - version 3.6;
- Multi-Module Maven;
- http.HttpClient;
download, compile and run, in module main file to compile main-1.0-SNAPSHOT-jar-with-dependencies.jar
public String establishAsyncConnection(Long idNumber) {
String name;
try {
final String nbpPath = "https://tvjan-tvmaze-v1.p.rapidapi.com/people/" + idNumber;
System.out.println("\n------------------LOADING--------------------");
CompletableFuture<HttpResponse<String>> response1 = HttpClient
.newBuilder()
.proxy(ProxySelector.getDefault())
.build()
.sendAsync(requestGet(nbpPath), HttpResponse.BodyHandlers.ofString());
Gson gson = new GsonBuilder().setPrettyPrinting().create();
Actor actor = gson.fromJson(response1.get().body(), Actor.class);
name = actor.getName();
} catch (Exception e) {
throw new MyAppException("Error in HttpConnectionName establishConnection");
}
return name;
}
To-do list:
- add test
Project is: in_progress