public class AGHTTPClient extends Object implements AutoCloseable
Uses an unlimited pool of connections to allow safe, concurrent access.
Also contains methods for accessing AG services that operate above the repository level - such as managing repositories.
Modifier and Type | Field and Description |
---|---|
static String |
PROP_HTTP_NUM_RETRIES
Number of times an HTTP GET request is automatically retried,
not counting the initial (failed) attempt, in case of errors
caused by a connection timeout.
|
Constructor and Description |
---|
AGHTTPClient(String serverURL) |
AGHTTPClient(String serverURL,
org.apache.http.conn.HttpClientConnectionManager manager) |
AGHTTPClient(String serverURL,
org.apache.http.conn.HttpClientConnectionManager manager,
org.apache.http.config.SocketConfig socketConfig) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
delete(String url,
org.apache.http.Header[] headers,
org.apache.http.NameValuePair[] params,
AGResponseHandler handler) |
void |
deleteCatalog(String catalogURL) |
void |
deleteRepository(String repositoryURL) |
String[] |
generateURIs(String repositoryURL,
String namespace,
int amount) |
void |
get(String url,
org.apache.http.Header[] headers,
org.apache.http.NameValuePair[] params,
AGResponseHandler handler) |
String[] |
getBlankNodes(String repositoryURL,
int amount) |
org.apache.http.client.HttpClient |
getHttpClient() |
List<String> |
getListOfStrings(String url) |
String |
getServerURL() |
String |
getString(String url) |
String[] |
getStringArray(String url) |
TupleQueryResult |
getTupleQueryResult(String url) |
String[] |
getUsernameAndPassword()
Retrieve the username and password previously set by setUsernameAndPassword.
|
String |
openSession(String spec,
boolean autocommit) |
void |
post(String url,
org.apache.http.Header[] headers,
org.apache.http.NameValuePair[] params,
org.apache.http.HttpEntity requestEntity,
AGResponseHandler handler) |
void |
put(String url,
org.apache.http.Header[] headers,
org.apache.http.NameValuePair[] params,
org.apache.http.HttpEntity requestEntity,
AGResponseHandler handler) |
void |
putCatalog(String catalogURL) |
void |
putRepository(String repositoryURL) |
void |
setMasqueradeAsUser(String user)
Sets the AG user for X-Masquerade-As-User requests.
|
void |
setUsernameAndPassword(String username,
String password)
Set the username and password for authentication with the remote server.
|
String |
toString() |
public static final String PROP_HTTP_NUM_RETRIES
public AGHTTPClient(String serverURL, org.apache.http.conn.HttpClientConnectionManager manager, org.apache.http.config.SocketConfig socketConfig)
public AGHTTPClient(String serverURL, org.apache.http.conn.HttpClientConnectionManager manager)
public AGHTTPClient(String serverURL)
public String getServerURL()
public org.apache.http.client.HttpClient getHttpClient()
public void post(String url, org.apache.http.Header[] headers, org.apache.http.NameValuePair[] params, org.apache.http.HttpEntity requestEntity, AGResponseHandler handler) throws AGHttpException
AGHttpException
public void get(String url, org.apache.http.Header[] headers, org.apache.http.NameValuePair[] params, AGResponseHandler handler) throws AGHttpException
AGHttpException
public void delete(String url, org.apache.http.Header[] headers, org.apache.http.NameValuePair[] params, AGResponseHandler handler) throws AGHttpException
AGHttpException
public void put(String url, org.apache.http.Header[] headers, org.apache.http.NameValuePair[] params, org.apache.http.HttpEntity requestEntity, AGResponseHandler handler) throws AGHttpException
AGHttpException
public void setUsernameAndPassword(String username, String password)
username
- the usernamepassword
- the passwordpublic String[] getUsernameAndPassword()
public void setMasqueradeAsUser(String user)
For AG superusers only. This allows AG superusers to run requests as another user in a dedicated session.
user
- the user for X-Masquerade-As-User requestspublic void putCatalog(String catalogURL) throws AGHttpException
AGHttpException
public void deleteCatalog(String catalogURL) throws AGHttpException
AGHttpException
public void putRepository(String repositoryURL) throws AGHttpException
AGHttpException
public void deleteRepository(String repositoryURL) throws AGHttpException
AGHttpException
public TupleQueryResult getTupleQueryResult(String url) throws AGHttpException
AGHttpException
public String[] getBlankNodes(String repositoryURL, int amount) throws AGHttpException
AGHttpException
public String getString(String url) throws AGHttpException
AGHttpException
public String[] getStringArray(String url) throws AGHttpException
AGHttpException
public List<String> getListOfStrings(String url) throws AGHttpException
AGHttpException
public String openSession(String spec, boolean autocommit) throws AGHttpException
AGHttpException
public void close()
close
in interface AutoCloseable
public String[] generateURIs(String repositoryURL, String namespace, int amount) throws AGHttpException
AGHttpException
Copyright © 2024 Franz Inc.. All rights reserved.