use of io.dropwizard.jersey.gzip.GZipDecoder in project dropwizard by dropwizard.
the class JerseyClientBuilder method build.
private Client build(String name, ExecutorService threadPool, ObjectMapper objectMapper, Validator validator) {
if (!configuration.isGzipEnabled()) {
apacheHttpClientBuilder.disableContentCompression(true);
}
final Client client = ClientBuilder.newClient(buildConfig(name, threadPool, objectMapper, validator));
client.register(new JerseyIgnoreRequestUserAgentHeaderFilter());
// Tie the client to server lifecycle
if (environment != null) {
environment.lifecycle().manage(new Managed() {
@Override
public void start() throws Exception {
}
@Override
public void stop() throws Exception {
client.close();
}
});
}
if (configuration.isGzipEnabled()) {
client.register(new GZipDecoder());
client.register(new ConfiguredGZipEncoder(configuration.isGzipEnabledForRequests()));
}
return client;
}
Aggregations