The Java 11 HTTP client

There were several goals associated with creating the new HTTP client for the modern Java platform, available with Java 9, 10, and 11. The primary goals are listed in the following table. These goals are presented in the broad categories of ease of use, core capabilities, additional capabilities, and performance:

Ease of use
  • The API was designed to provide up to 90 percent of HTTP-related application requirements.
  • The new API is usable, without unnecessary complexity, for the most common use cases.
  • A simplistic blocking mode is included.
  • The API supports modern Java language features. Lambda expressions, a major new introduction released with Java 8, is an example.
Core capabilities
  • Support HTTPS/TLS
  • Supports HTTP/2
  • Provides visibility on all details related to HTTP protocol requests and responses
  • Supports standard/common authentication mechanisms
  • Provides header received event notifications
  • Provides response body received event notifications
  • Provides error event notifications
Additional capabilities
  • The new API can be used for WebSocket handshakes
  • It performs security checks in concert with the current networking API
Performance
  • For HTTP/1.1:
    • The new API must perform at least as effectively as the previous API.
    • Memory consumption must not exceed that of Apache HttpClient, Netty, and Jetty, when being used as a client API.
  • For HTTP/2:
    • Performance must exceed that of HTTP/1.1.
    • The new performance must match or exceed that of Netty and Jetty when being used as a client API. Performance degradation should not be a result of the new client.
    • Memory consumption must not exceed that of Apache HttpClient, Netty, and Jetty, when being used as a client API.
  • Avoids running timer threads.
..................Content has been hidden....................

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