REST client

TornadoFX comes with a REST client that makes it easy to perform JSON-based REST calls. 

The underlying HTTP engine interface has two implementations:

  • By default, it uses HttpURLConnection
  • Apache HttpClient

To change the HTTP engine to the Apache HttpClient implementation, we will simply need to call Rest.useApacheHttpClient() in the init block of the App class.

Make sure that you add extra dependency org.apache.httpcomponents:httpclient in the project description or the Gradle file to use the Apache HTTP client.

Get Kotlin Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.