Implementing clients that use the Apache Wink REST client
You can use the Apache Wink REST client to send requests and process responses from RESTful services. You can use the client API in Java™ programs to communicate with web services.
About this task
By default, the Apache Wink client uses the java.net.HttpURLConnection class from the Java runtime environment for issuing requests and processing responses. The Apache Wink client can also use Apache HttpClient 4.0 as the underlying client transport.
You can also use JAX-RS entity providers to help serialize request entities or deserialize response entities. The standard JAX-RS providers that are used in the JAX-RS server-side services are provided with the client.
You can configure the Apache Wink REST client programmatically or by setting Java Virtual Machine (JVM) properties.
To implement an Apache Wink REST client, you must first create an org.apache.wink.client.ClientConfig object that is then used to construct an org.apache.wink.client.RestClient. You can change the configuration settings for the RestClient object programmatically, or you can use JVM properties to modify the default ClientConfig object values.
- wink.client.readTimeout
This property specifies how long the RestClient object waits (in milliseconds) for a response to requests before timing out. A value of 0 means that the client waits for an unlimited amount of time and will not timeout.
The default value is 60,000 milliseconds.
- wink.client.connectTimeout
This property specifies how long the RestClient object waits (in milliseconds) before it times out while attempting to connect to the target resource. A value of 0 means that the client waits for an unlimited amount of time and will not timeout.
The default value is 60,000 milliseconds.
You can programmatically alter any values for the RestClient object that you specify by using JVM properties. The programmatic values take precedence over any JVM property values.
Procedure
Results
You have implemented a JAX-RS client using the Apache Wink REST client that can issue requests to a JAX-RS application.