title: How to set timeout to JAX-RS client with CXF
body: <p>I am working on a Rest Client and I am using <strong>CXF</strong> with <strong>JAX-RS</strong>. </p>
  
  <p>The problem that I have is that I cannot find any way to override the default timeout values of the client. </p>
  
  <p><strong>A simple client:</strong></p>
  
  <pre><code>Client client = ClientBuilder.newClient();
  WebTarget target = client.target("http://localhost:8080/MyApp");
  target = target.path("jsp/Test.jsp");
  Response response = target.request().get();
  </code></pre>
  
  <p>I have read that there are two timeout properties in <strong>CXF</strong> called <code>ReceiveTimeout</code> and <code>ConnectionTimeout</code> but I have not managed to find a way to set them in my client. </p>
  
  <p>I have tried <code>client.property("ReceiveTimeout", 5000);</code> but it doesn't work. </p>
  
  <p>I have seen examples of using an <strong>xml</strong> configuration file to configure the client but I prefer not to take that path if it is possible. </p>
  
  <p>Any ideas?</p>