com.netflix.niws.client.http
Class RestClient
java.lang.Object
com.netflix.client.LoadBalancerContext<S,T>
com.netflix.client.AbstractLoadBalancerAwareClient<com.netflix.client.http.HttpRequest,com.netflix.client.http.HttpResponse>
com.netflix.niws.client.http.RestClient
- All Implemented Interfaces:
- com.netflix.client.IClient<com.netflix.client.http.HttpRequest,com.netflix.client.http.HttpResponse>, com.netflix.client.IClientConfigAware
public class RestClient
- extends com.netflix.client.AbstractLoadBalancerAwareClient<com.netflix.client.http.HttpRequest,com.netflix.client.http.HttpResponse>
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.
| Fields inherited from class com.netflix.client.LoadBalancerContext |
clientName, errorHandler, maxAutoRetries, maxAutoRetriesNextServer, vipAddresses |
| Methods inherited from class com.netflix.client.AbstractLoadBalancerAwareClient |
executeOnSingleServer, executeWithLoadBalancer |
| Methods inherited from class com.netflix.client.LoadBalancerContext |
computeFinalUriWithLoadBalancer, generateNIWSException, getClientName, getDeepestCause, getErrorHandler, getExecuteTracer, getLoadBalancer, getMaxAutoRetries, getMaxAutoRetriesNextServer, getNumberRetriesOnSameServer, getRetriesNextServer, getServerStats, handleSameServerRetry, isOkToRetryOnAllOperations, isPresentAsCause, isRetriable, noteOpenConnection, noteRequestCompletion, setErrorHandler, setLoadBalancer, setMaxAutoRetries, setMaxAutoRetriesNextServer, setOkToRetryOnAllOperations |
| 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.LoadBalancerContext<com.netflix.client.http.HttpRequest,com.netflix.client.http.HttpResponse>
apacheHttpClientSpecificInitialization
protected com.sun.jersey.api.client.Client apacheHttpClientSpecificInitialization()
resetSSLSocketFactory
public void resetSSLSocketFactory(AbstractSslContextFactory abstractContextFactory)
getKeyStore
public java.security.KeyStore getKeyStore()
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 com.netflix.client.http.HttpResponse execute(com.netflix.client.http.HttpRequest task)
throws java.lang.Exception
- Throws:
java.lang.Exception
getDefaultPortFromScheme
protected int getDefaultPortFromScheme(java.lang.String scheme)
- Overrides:
getDefaultPortFromScheme in class com.netflix.client.LoadBalancerContext<com.netflix.client.http.HttpRequest,com.netflix.client.http.HttpResponse>
deriveSchemeAndPortFromPartialUri
protected com.netflix.util.Pair<java.lang.String,java.lang.Integer> deriveSchemeAndPortFromPartialUri(com.netflix.client.http.HttpRequest task)
- Overrides:
deriveSchemeAndPortFromPartialUri in class com.netflix.client.LoadBalancerContext<com.netflix.client.http.HttpRequest,com.netflix.client.http.HttpResponse>
isRetriableException
protected boolean isRetriableException(java.lang.Throwable e)
- Specified by:
isRetriableException in class com.netflix.client.AbstractLoadBalancerAwareClient<com.netflix.client.http.HttpRequest,com.netflix.client.http.HttpResponse>
isCircuitBreakerException
protected boolean isCircuitBreakerException(java.lang.Throwable e)
- Specified by:
isCircuitBreakerException in class com.netflix.client.AbstractLoadBalancerAwareClient<com.netflix.client.http.HttpRequest,com.netflix.client.http.HttpResponse>
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.LoadBalancerContext<com.netflix.client.http.HttpRequest,com.netflix.client.http.HttpResponse>
- Throws:
java.net.URISyntaxException
com.netflix.client.ClientException