methanol v1.5.0 Release Notes

  • 14-5-2021

    • Methanol now has an [RFC-compliant][httpcaching_rfc] HTTP cache! It can store entries on disk or in memory. Give it a try!

      void cache() throws InterruptedException, IOException {
      var cache = HttpCache.newBuilder()
          .cacheOnDisk(Path.of("cache-dir"), 100 * 1024 * 1024)
      var client = Methanol.newBuilder()
      var request = MutableRequest.GET("");
      var response = (CacheAwareResponse<Path>) client.send(
          request, BodyHandlers.ofFile(Path.of("banana_cat.mp4")));
          "%s (CacheStatus: %s, elapsed: %s)%n",
          Duration.between(response.timeRequestSent(), response.timeResponseReceived()));
    • ➕ Added CacheControl to model the Cache-Control header and its directives. This is complementary to the new cache as all configuration is communicated through Cache-Control.

    • 🗄 Interceptors have been reworked. The old naming convention is deprecated. An interceptor is now either a client or a backend interceptor instead of a pre/post decoration interceptor, where 'backend' refers to Methanol's backing HttpClient. The cache intercepts requests after client but before backend interceptors. It was tempting to name the latter 'network interceptors', but that seemed rather confusing as not all 'network' requests can be intercepted (HttpClient can make its own intermediate requests like redirects & retries).

    • ➕ Added HttpStatus, which contains functions for checking response codes.

    • ➕ Added ForwardingEncoder & ForwardingDecoder. These are meant for easier installation of adapters from the classpath.

    • 🌲 System.Logger API is now used instead of java.util.logging.

    • 🛠 Fix: Don't attempt to decompress responses to HEADs. This fixed failures like unexpected end of gzip stream.

    • 🛠 Fix: Decompressed responses now have their stale Content-Encoding & Content-Length headers removed.

    • 🔄 Changed reactor dependency to API scope in the methanol-jackson-flux adapter.

    • 🚀 Upgraded Jackson to 2.12.3.

    • 🚀 Upgraded Reactor to 3.4.6.

    • 🆕 New project website!