title: JAX-RS jersey Client: Reading the Response with status code
body: <p>I am using this code for invoking a jersey JAX-RS service using a jersey client.</p>
  
  <pre><code>public static void main(String[] args) {
      ClientConfig config = new DefaultClientConfig();
      Client client = Client.create(config);
  
      WebResource service = client.resource(getBaseURI());
  
      String msg = service.path("rest").path("ExceptionDemo").path("user").queryParam("id", "001").get(String.class);     
      System.out.println(msg);
  
  }
  
  private static URI getBaseURI() {
      return UriBuilder.fromUri("http://localhost:8045/ExceptionHanlding").build();
  }
  </code></pre>
  
  <p>This code works fine when the Response status code is 200. But for anything other than 200, this code throws an exception.</p>
  
  <p>How to modify this code so that based on the status code of the response it performs some action?</p>