title: Uncompress GZIP http-response (using jersey client api, java)
body: <p>Could someone tell me what I need to do in order to uncompress a GZIP content when getting the response from some Http-call.</p>
  
  <p>To make the call I use the Jersey Client API, see code below:</p>
  
  <pre><code>String baseURI = "http://api.stackoverflow.com/1.1/answers/7539863?body=true&amp;comments=false";
  ClientConfig config = new DefaultClientConfig();
  Client client = Client.create(config);
  WebResource wr = client.resource(baseURI); 
  ClientResponse response = null;
  response = wr.get(ClientResponse.class);
  String response_data = response.getEntity(String.class);
  
  System.out.println(response_data);
  </code></pre>
  
  <p>However the output is GZIP’d and looks like:</p>
  
  <pre><code>{J?J??t??`$?@??????....
  </code></pre>
  
  <p>It would be good if I could implement the following: </p>
  
  <ul>
  <li>being able to detect whether content is GZIP’d or not; </li>
  <li>If not, process like normal in a String; if, so uncompress and get the content in String</li>
  </ul>