com.netflix.niws.client.http
Class RestClient
java.lang.Object
com.netflix.client.AbstractLoadBalancerAwareClient<HttpClientRequest,HttpClientResponse>
com.netflix.niws.client.http.RestClient
- All Implemented Interfaces:
- com.netflix.client.IClient<HttpClientRequest,HttpClientResponse>, com.netflix.client.IClientConfigAware
public class RestClient
- extends com.netflix.client.AbstractLoadBalancerAwareClient<HttpClientRequest,HttpClientResponse>
A client that is essentially a wrapper around Jersey client. By default, it uses HttpClient for underlying HTTP communication.
Application can set its own Jersey client with this class, but doing so will void all client configurations set in IClientConfig
.
Methods inherited from class com.netflix.client.AbstractLoadBalancerAwareClient |
computeFinalUriWithLoadBalancer, executeOnSingleServer, executeWithLoadBalancer, getClientName, getLoadBalancer, noteOpenConnection, noteRequestCompletion, noteResponseReceived, setLoadBalancer |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RestClient
public RestClient()
RestClient
public RestClient(com.netflix.client.config.IClientConfig ncc)
RestClient
public RestClient(com.sun.jersey.api.client.Client jerseyClient)
initWithNiwsConfig
public void initWithNiwsConfig(com.netflix.client.config.IClientConfig clientConfig)
- Specified by:
initWithNiwsConfig
in interface com.netflix.client.IClientConfigAware
- Overrides:
initWithNiwsConfig
in class com.netflix.client.AbstractLoadBalancerAwareClient<HttpClientRequest,HttpClientResponse>
apacheHttpClientSpecificInitialization
protected com.sun.jersey.api.client.Client apacheHttpClientSpecificInitialization()
getResource
public static java.net.URL getResource(java.lang.String resourceName)
getJerseyClient
public com.sun.jersey.api.client.Client getJerseyClient()
setJerseyClient
public void setJerseyClient(com.sun.jersey.api.client.Client c)
execute
public HttpClientResponse execute(HttpClientRequest task)
throws java.lang.Exception
- Throws:
java.lang.Exception
getDefaultPort
protected int getDefaultPort()
- Specified by:
getDefaultPort
in class com.netflix.client.AbstractLoadBalancerAwareClient<HttpClientRequest,HttpClientResponse>
deriveSchemeAndPortFromPartialUri
protected com.netflix.util.Pair<java.lang.String,java.lang.Integer> deriveSchemeAndPortFromPartialUri(HttpClientRequest task)
- Specified by:
deriveSchemeAndPortFromPartialUri
in class com.netflix.client.AbstractLoadBalancerAwareClient<HttpClientRequest,HttpClientResponse>
isRetriableException
protected boolean isRetriableException(java.lang.Exception e)
- Specified by:
isRetriableException
in class com.netflix.client.AbstractLoadBalancerAwareClient<HttpClientRequest,HttpClientResponse>
isCircuitBreakerException
protected boolean isCircuitBreakerException(java.lang.Exception e)
- Specified by:
isCircuitBreakerException
in class com.netflix.client.AbstractLoadBalancerAwareClient<HttpClientRequest,HttpClientResponse>
deriveHostAndPortFromVipAddress
protected com.netflix.util.Pair<java.lang.String,java.lang.Integer> deriveHostAndPortFromVipAddress(java.lang.String vipAddress)
throws java.net.URISyntaxException,
com.netflix.client.ClientException
- Overrides:
deriveHostAndPortFromVipAddress
in class com.netflix.client.AbstractLoadBalancerAwareClient<HttpClientRequest,HttpClientResponse>
- Throws:
java.net.URISyntaxException
com.netflix.client.ClientException