Skip to content

Latest commit

 

History

History
 
 

riptide-compression

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Riptide: Compression

Zipper

Javadoc Maven Central

Riptide: Compression adds support to compress request bodies.

Features

  • pluggable compression mechanism
  • out of the box GZIP support

Dependencies

  • Riptide: Core

Installation

Add the following dependency to your project:

<dependency>
    <groupId>org.zalando</groupId>
    <artifactId>riptide-compression</artifactId>
    <version>${riptide.version}</version>
</dependency>

Configuration

Http.builder()
    .plugin(new RequestCompressionPlugin())
    .build();

By default request bodies are compressed using GZIP.

In order to specify the compression algorithm you can pass in a custom Compression:

new RequestCompressionPlugin(Compression.of("br", BrotliOutputStream::new));

Usage

http.post("/events")
        .contentType(MediaType.APPLICATION_JSON)
        .body(asList(events))
        .call(pass())
        .join();

All request bodies will be compressed using the configured compression method using chunked transfer-encoding.

If there is already a Content-Encoding specified on the request, the plugin does nothing.

Limitations

  • You must only configure a single RequestCompressionPlugin as only a single encoding is applied currently.
  • Starting with Spring 4.3 the Netty4ClientHttpRequestFactory unconditionally adds a Content-Length header, which breaks if used together with RequestCompressionPlugin. Use riptide-httpclient instead.

Getting Help

If you have questions, concerns, bug reports, etc., please file an issue in this repository's Issue Tracker.

Getting Involved/Contributing

To contribute, simply make a pull request and add a brief description (1-2 sentences) of your addition or change. For more details, check the contribution guidelines.