I'm consuming a REST api using the RestBuilder plugin. I get a response where the body is compressed:
Content-Encoding=[gzip]
Does groovy/Grails provide any easy access / native methods for decoding gzip compression? The only thing I found is the native Java zip api (ex. GZIPInputStream). Does someone have a better idea?
Spring and HttpComponents will handle the decoding automatically:
HttpComponentsClientHttpRequestFactory clientHttpRequestFactory = new HttpComponentsClientHttpRequestFactory(HttpClientBuilder.create().build());
RestTemplate restTemplate = new RestTemplate(clientHttpRequestFactory);
ResponseEntity<String> response = restTemplate.exchange(
"some/url/", HttpMethod.GET, new HttpEntity<Object>(requestHeaders),
String.class);