title: Configuring proxy for JAX-RS 2.0 client API
body: <p>I have an application that is running on a Java EE 7 application server (WildFly), that queries another service using REST resources.</p>
  
  <p>In previous applications I have used the Jersey 1.x client API. Access to the REST service is granted through a web proxy.</p>
  
  <p>In Jersey I create the <code>Client</code> instance like this:</p>
  
  <pre class="lang-java prettyprint-override"><code>public Client create() {
  
      Client client;
      if ( proxyConfiguration != null &amp;&amp; proxyConfiguration.getHost() != null &amp;&amp; !proxyConfiguration.getHost().trim().isEmpty() ) {
          HttpURLConnectionFactory urlConnectionFactory = new ProxyUrlConnectionFactory( proxyConfiguration );
          client = new Client( new URLConnectionClientHandler( urlConnectionFactory ), clientConfig );
      } else {
          client = Client.create( clientConfig );
      }
  
      return client;
  }
  </code></pre>
  
  <p>Running on a Java EE 7 application server I wanted to use the JAX-RS 2.0 client API which is provided by the application server.</p>
  
  <p>Now I am having a really hard time to find information on how to configure the JAX-RS 2.0 client in a platform independent way. Setting the <code>http.proxyHost</code> and <code>http.proxyPort</code> system properties had no effect in WildFly (I would prefer to not configure it globally anyway).</p>
  
  <p>Does anyone know how to solve this?</p>