JavaFX client

This client is a simple JavaFX application that has a dependency on the banking-client module to interact with the server. We can say that this client is a sort of fat client, since it has some code written to simplify the interaction with the server.

Let's review the project structure in the following screenshot:

JavaFX client project structure

This project is fairly simple, and it has only two screens, which allow the users to enter their credentials and then query their account balance. 

Retrofit offers the availability to make synchronous and asynchronous requests. In this client, we will use synchronous requests, as follows:

SecurityApi api = BankClient.getRetrofit().create(SecurityApi.class);
Call<String> call = api.login(
new Credentials(username.getText(), password.getText()));
Response<String> response = call.execute();
// do something with the response

The execute method allows for making synchronous requests. The Retrofit object contains the base URI that will be used in conjunction with the partial URIs provided in the client interfaces, in order to form the full URI to hit the endpoints.

The process of this client application is shown in the following screenshot:

JavaFX client application
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.27.171