| Modifier and Type | Field and Description |
|---|---|
static org.apache.http.Header[] |
EMPTY_HEADER_ARRAY |
| Constructor and Description |
|---|
Client()
Default Constructor
|
Client(Cluster cluster)
Constructor This constructor will create an object using the old faulty load balancing logic.
|
Client(Cluster cluster,
boolean sslEnabled)
Constructor This constructor will create an object using the old faulty load balancing logic.
|
Client(Cluster cluster,
org.apache.hadoop.conf.Configuration conf,
boolean sslEnabled)
Constructor This constructor will create an object using the old faulty load balancing logic.
|
Client(Cluster cluster,
org.apache.hadoop.conf.Configuration conf,
boolean sslEnabled,
Optional<KeyStore> trustStore,
Optional<String> userName,
Optional<String> password,
Optional<String> bearerToken) |
Client(Cluster cluster,
org.apache.hadoop.conf.Configuration conf,
boolean sslEnabled,
Optional<KeyStore> trustStore,
Optional<String> userName,
Optional<String> password,
Optional<String> bearerToken,
Optional<org.apache.http.conn.HttpClientConnectionManager> connManager)
Constructor that accepts an optional trustStore and authentication information for either BASIC
or BEARER authentication in sticky mode, which does not use the old faulty load balancing
logic, and enables correct session handling.
|
Client(Cluster cluster,
org.apache.hadoop.conf.Configuration conf,
String trustStorePath,
Optional<String> trustStorePassword,
Optional<String> trustStoreType)
Constructor, allowing to define custom trust store (only for SSL connections).
|
Client(Cluster cluster,
String trustStorePath,
Optional<String> trustStorePassword,
Optional<String> trustStoreType)
Constructor, allowing to define custom trust store (only for SSL connections) This constructor
will create an object using the old faulty load balancing logic.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addExtraHeader(String name,
String value)
Add extra headers.
|
void |
close() |
Response |
delete(Cluster cluster,
String path)
Send a DELETE request
|
Response |
delete(Cluster cluster,
String path,
org.apache.http.Header extraHdr)
Send a DELETE request
|
Response |
delete(String path)
Send a DELETE request
|
Response |
delete(String path,
org.apache.http.Header extraHdr)
Send a DELETE request
|
org.apache.http.HttpResponse |
execute(Cluster cluster,
org.apache.http.client.methods.HttpUriRequest method,
org.apache.http.Header[] headers,
String path)
Execute a transaction method.
|
org.apache.http.HttpResponse |
executePathOnly(Cluster cluster,
org.apache.http.client.methods.HttpUriRequest method,
org.apache.http.Header[] headers,
String path)
Execute a transaction method given only the path.
|
org.apache.http.HttpResponse |
executeURI(org.apache.http.client.methods.HttpUriRequest method,
org.apache.http.Header[] headers,
String uri)
Execute a transaction method given a complete URI.
|
Response |
get(Cluster cluster,
String path)
Send a GET request
|
Response |
get(Cluster c,
String path,
org.apache.http.Header[] headers)
Send a GET request
|
Response |
get(Cluster cluster,
String path,
String accept)
Send a GET request
|
Response |
get(String path)
Send a GET request
|
Response |
get(String path,
org.apache.http.Header[] headers)
Send a GET request
|
Response |
get(String path,
String accept)
Send a GET request
|
Cluster |
getCluster()
Returns the cluster definition
|
String |
getExtraHeader(String name)
Get an extra header value.
|
Map<String,String> |
getExtraHeaders()
Get all extra headers (read-only).
|
org.apache.http.client.HttpClient |
getHttpClient()
Returns the wrapped HttpClient
|
static byte[] |
getResponseBody(org.apache.http.HttpResponse resp)
Returns the response body of the HTTPResponse, if any, as an array of bytes.
|
Response |
head(Cluster cluster,
String path,
org.apache.http.Header[] headers)
Send a HEAD request
|
Response |
head(String path)
Send a HEAD request
|
boolean |
isSticky()
The default behaviour is load balancing by sending each request to a random host.
|
static KeyStore |
loadTruststore(String trustStorePath,
Optional<String> trustStorePassword,
Optional<String> trustStoreType)
Loads a trustStore from the local fileSystem.
|
Response |
post(Cluster cluster,
String path,
org.apache.http.Header[] headers,
byte[] content)
Send a POST request
|
Response |
post(Cluster cluster,
String path,
String contentType,
byte[] content)
Send a POST request
|
Response |
post(Cluster cluster,
String path,
String contentType,
byte[] content,
org.apache.http.Header extraHdr)
Send a POST request
|
Response |
post(String path,
org.apache.http.Header[] headers,
byte[] content)
Send a POST request
|
Response |
post(String path,
String contentType,
byte[] content)
Send a POST request
|
Response |
post(String path,
String contentType,
byte[] content,
org.apache.http.Header extraHdr)
Send a POST request
|
Response |
put(Cluster cluster,
String path,
org.apache.http.Header[] headers,
byte[] content)
Send a PUT request
|
Response |
put(Cluster cluster,
String path,
String contentType,
byte[] content)
Send a PUT request
|
Response |
put(Cluster cluster,
String path,
String contentType,
byte[] content,
org.apache.http.Header extraHdr)
Send a PUT request
|
Response |
put(String path,
org.apache.http.Header[] headers,
byte[] content)
Send a PUT request
|
Response |
put(String path,
String contentType,
byte[] content)
Send a PUT request
|
Response |
put(String path,
String contentType,
byte[] content,
org.apache.http.Header extraHdr)
Send a PUT request
|
void |
removeExtraHeader(String name)
Remove an extra header.
|
void |
setCluster(Cluster cluster) |
void |
setSticky(boolean sticky)
The default behaviour is load balancing by sending each request to a random host.
|
void |
shutdown()
Shut down the client.
|
public static final org.apache.http.Header[] EMPTY_HEADER_ARRAY
public Client()
public Client(Cluster cluster)
cluster - the cluster definitionpublic Client(Cluster cluster, boolean sslEnabled)
cluster - the cluster definitionsslEnabled - enable SSL or notpublic Client(Cluster cluster, org.apache.hadoop.conf.Configuration conf, boolean sslEnabled)
cluster - the cluster definitionconf - ConfigurationsslEnabled - enable SSL or notpublic Client(Cluster cluster, String trustStorePath, Optional<String> trustStorePassword, Optional<String> trustStoreType)
cluster - the cluster definitiontrustStorePath - custom trust store to use for SSL connectionstrustStorePassword - password to use for custom trust storetrustStoreType - type of custom trust storeorg.apache.hadoop.hbase.rest.client.Client.ClientTrustStoreInitializationException - if the trust store file can not be loaded@InterfaceAudience.Private public Client(Cluster cluster, org.apache.hadoop.conf.Configuration conf, boolean sslEnabled, Optional<KeyStore> trustStore, Optional<String> userName, Optional<String> password, Optional<String> bearerToken, Optional<org.apache.http.conn.HttpClientConnectionManager> connManager)
cluster - the cluster definitionconf - HBase/Hadoop configurationsslEnabled - use HTTPStrustStore - the optional trustStore objectuserName - for BASIC authpassword - for BASIC authbearerToken - for BEAERER authpublic Client(Cluster cluster, org.apache.hadoop.conf.Configuration conf, boolean sslEnabled, Optional<KeyStore> trustStore, Optional<String> userName, Optional<String> password, Optional<String> bearerToken)
public Client(Cluster cluster, org.apache.hadoop.conf.Configuration conf, String trustStorePath, Optional<String> trustStorePassword, Optional<String> trustStoreType)
cluster - the cluster definitionconf - HBase/Hadoop ConfigurationtrustStorePath - custom trust store to use for SSL connectionstrustStorePassword - password to use for custom trust storetrustStoreType - type of custom trust storeorg.apache.hadoop.hbase.rest.client.Client.ClientTrustStoreInitializationException - if the trust store file can not be loadedpublic static KeyStore loadTruststore(String trustStorePath, Optional<String> trustStorePassword, Optional<String> trustStoreType)
public void shutdown()
public org.apache.http.client.HttpClient getHttpClient()
public void addExtraHeader(String name, String value)
public String getExtraHeader(String name)
public Map<String,String> getExtraHeaders()
public void removeExtraHeader(String name)
public org.apache.http.HttpResponse executePathOnly(Cluster cluster, org.apache.http.client.methods.HttpUriRequest method, org.apache.http.Header[] headers, String path) throws IOException
cluster - the cluster definitionmethod - the transaction methodheaders - HTTP header values to sendpath - the properly urlencoded pathIOExceptionpublic org.apache.http.HttpResponse executeURI(org.apache.http.client.methods.HttpUriRequest method, org.apache.http.Header[] headers, String uri) throws IOException
method - the transaction methodheaders - HTTP header values to senduri - a properly urlencoded URIIOExceptionpublic org.apache.http.HttpResponse execute(Cluster cluster, org.apache.http.client.methods.HttpUriRequest method, org.apache.http.Header[] headers, String path) throws IOException
cluster - the cluster definitionmethod - the HTTP methodheaders - HTTP header values to sendpath - the properly urlencoded path or URIIOExceptionpublic Cluster getCluster()
public void setCluster(Cluster cluster)
cluster - the cluster definitionpublic boolean isSticky()
public void setSticky(boolean sticky)
sticky - whether subsequent requests will use the same hostpublic Response head(String path) throws IOException
path - the path or URIIOExceptionpublic Response head(Cluster cluster, String path, org.apache.http.Header[] headers) throws IOException
cluster - the cluster definitionpath - the path or URIheaders - the HTTP headers to include in the requestIOExceptionpublic Response get(String path) throws IOException
path - the path or URIIOExceptionpublic Response get(Cluster cluster, String path) throws IOException
cluster - the cluster definitionpath - the path or URIIOExceptionpublic Response get(String path, String accept) throws IOException
path - the path or URIaccept - Accept header valueIOExceptionpublic Response get(Cluster cluster, String path, String accept) throws IOException
cluster - the cluster definitionpath - the path or URIaccept - Accept header valueIOExceptionpublic Response get(String path, org.apache.http.Header[] headers) throws IOException
path - the path or URIheaders - the HTTP headers to include in the request, Accept must be suppliedIOExceptionpublic static byte[] getResponseBody(org.apache.http.HttpResponse resp) throws IOException
resp - HttpResponseIOException - If an I/O (transport) problem occurs while obtaining the response body.public Response get(Cluster c, String path, org.apache.http.Header[] headers) throws IOException
c - the cluster definitionpath - the path or URIheaders - the HTTP headers to include in the requestIOExceptionpublic Response put(String path, String contentType, byte[] content) throws IOException
path - the path or URIcontentType - the content MIME typecontent - the content bytesIOExceptionpublic Response put(String path, String contentType, byte[] content, org.apache.http.Header extraHdr) throws IOException
path - the path or URIcontentType - the content MIME typecontent - the content bytesextraHdr - extra Header to sendIOExceptionpublic Response put(Cluster cluster, String path, String contentType, byte[] content) throws IOException
cluster - the cluster definitionpath - the path or URIcontentType - the content MIME typecontent - the content bytesIOException - for errorpublic Response put(Cluster cluster, String path, String contentType, byte[] content, org.apache.http.Header extraHdr) throws IOException
cluster - the cluster definitionpath - the path or URIcontentType - the content MIME typecontent - the content bytesextraHdr - additional Header to sendIOException - for errorpublic Response put(String path, org.apache.http.Header[] headers, byte[] content) throws IOException
path - the path or URIheaders - the HTTP headers to include, Content-Type must be suppliedcontent - the content bytesIOExceptionpublic Response put(Cluster cluster, String path, org.apache.http.Header[] headers, byte[] content) throws IOException
cluster - the cluster definitionpath - the path or URIheaders - the HTTP headers to include, Content-Type must be suppliedcontent - the content bytesIOExceptionpublic Response post(String path, String contentType, byte[] content) throws IOException
path - the path or URIcontentType - the content MIME typecontent - the content bytesIOExceptionpublic Response post(String path, String contentType, byte[] content, org.apache.http.Header extraHdr) throws IOException
path - the path or URIcontentType - the content MIME typecontent - the content bytesextraHdr - additional Header to sendIOExceptionpublic Response post(Cluster cluster, String path, String contentType, byte[] content) throws IOException
cluster - the cluster definitionpath - the path or URIcontentType - the content MIME typecontent - the content bytesIOException - for errorpublic Response post(Cluster cluster, String path, String contentType, byte[] content, org.apache.http.Header extraHdr) throws IOException
cluster - the cluster definitionpath - the path or URIcontentType - the content MIME typecontent - the content bytesextraHdr - additional Header to sendIOException - for errorpublic Response post(String path, org.apache.http.Header[] headers, byte[] content) throws IOException
path - the path or URIheaders - the HTTP headers to include, Content-Type must be suppliedcontent - the content bytesIOExceptionpublic Response post(Cluster cluster, String path, org.apache.http.Header[] headers, byte[] content) throws IOException
cluster - the cluster definitionpath - the path or URIheaders - the HTTP headers to include, Content-Type must be suppliedcontent - the content bytesIOExceptionpublic Response delete(String path) throws IOException
path - the path or URIIOExceptionpublic Response delete(String path, org.apache.http.Header extraHdr) throws IOException
path - the path or URIextraHdr - additional Header to sendIOExceptionpublic Response delete(Cluster cluster, String path) throws IOException
cluster - the cluster definitionpath - the path or URIIOException - for errorpublic Response delete(Cluster cluster, String path, org.apache.http.Header extraHdr) throws IOException
cluster - the cluster definitionpath - the path or URIIOException - for errorpublic void close()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.