Skip to content

Aplication connects with few free Api collects and converts data from them

Notifications You must be signed in to change notification settings

KarolSz001/SniffDataHttpApplication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

"# SniffDataHttpApplication"

Table of contents

General info

Multi-Module Maven Application with Java Modules , http.HttpClient connection ,still in progress adding new functionality

Technologies

  • Java - version 12;
  • maven - version 3.6;
  • Multi-Module Maven;
  • http.HttpClient;

Setup

download, compile and run, in module main file to compile main-1.0-SNAPSHOT-jar-with-dependencies.jar

Code Examples

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;
 }

Features

To-do list:

  • add test

Status

Project is: in_progress

About

Aplication connects with few free Api collects and converts data from them

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages