title: Setting request timeout for JAX-RS 2.0 Client API
body: <p>I have written simple REST web service client class which uses the JAX-RS 2.0 client API to make REST requests. I am trying to figure out how to set a request timeout for each invocation. Here is the code for a request:</p>
  
  <pre><code>Client client = ClientBuilder.newBuilder().build();
  WebTarget resourceTarget = client.target(restServiceUrl)
          .path("{regsysID}/{appointmentID}/")
          .resolveTemplate("regsysID", regSysId)
          .resolveTemplate("appointmentID", apptId);
  
  Invocation invocation = resourceTarget.request(MediaType.APPLICATION_JSON).buildPut(null);
  String createSessionJson = invocation.invoke(String.class);
  </code></pre>