AGHTTPClient (agraph-java-client 5.0.4-SNAPSHOT API)
Description: declaration: package: com.franz.agraph.http, class: AGHTTPClient

Package com.franz.agraph.http

# Class AGHTTPClient

java.lang.Object
com.franz.agraph.http.AGHTTPClient

All Implemented Interfaces:
  `AutoCloseable`

public class AGHTTPClient extends Object implements AutoCloseable
Class responsible for handling HTTP connections.

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.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final 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 Summary

  Constructors
  Constructor
  Description
  `AGHTTPClient(String serverURL)`
  `AGHTTPClient(String serverURL, HttpClientConnectionManager manager)`
  `AGHTTPClient(String serverURL, HttpClientConnectionManager manager, org.apache.http.config.SocketConfig socketConfig)`

- ## Method Summary

  Modifier and Type
  Method
  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)`
  `HttpClient`
  `getHttpClient()`
  `List<String>`
  `getListOfStrings(String url)`
  `String`
  `getServerURL()`
  `String`
  `getString(String url)`
  `String[]`
  `getStringArray(String url)`
  `org.eclipse.rdf4j.query.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()`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### PROP_HTTP_NUM_RETRIES

    public static final 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. Disabling this by setting it to 0 will expose "Connection reset" and "HTTP 408 Client timeout" errors. A value of 1 should enough to hide these supposedly harmless errors if the network is otherwise stable.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### AGHTTPClient

    public AGHTTPClient(String serverURL, HttpClientConnectionManager manager, org.apache.http.config.SocketConfig socketConfig)

  - ### AGHTTPClient

    public AGHTTPClient(String serverURL, HttpClientConnectionManager manager)

  - ### AGHTTPClient

    public AGHTTPClient(String serverURL)

- ## Method Details

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### getServerURL

    public String getServerURL()

  - ### getHttpClient

    public HttpClient getHttpClient()

  - ### post

    public void post(String url, org.apache.http.Header[] headers, org.apache.http.NameValuePair[] params, org.apache.http.HttpEntity requestEntity, AGResponseHandler handler) throws AGHttpException
    Throws:
      `AGHttpException`

  - ### get

    public void get(String url, org.apache.http.Header[] headers, org.apache.http.NameValuePair[] params, AGResponseHandler handler) throws AGHttpException
    Throws:
      `AGHttpException`

  - ### delete

    public void delete(String url, org.apache.http.Header[] headers, org.apache.http.NameValuePair[] params, AGResponseHandler handler) throws AGHttpException
    Throws:
      `AGHttpException`

  - ### put

    public void put(String url, org.apache.http.Header[] headers, org.apache.http.NameValuePair[] params, org.apache.http.HttpEntity requestEntity, AGResponseHandler handler) throws AGHttpException
    Throws:
      `AGHttpException`

  - ### setUsernameAndPassword

    public void setUsernameAndPassword(String username, String password)
    Set the username and password for authentication with the remote server.
    Parameters:
      `username` - the username
      `password` - the password

  - ### getUsernameAndPassword

    public String[] getUsernameAndPassword()
    Retrieve the username and password previously set by setUsernameAndPassword.
    Returns:
      An array of two Strings. The first element is the username (or null) and the second element is the password (or null).

  - ### setMasqueradeAsUser

    public void setMasqueradeAsUser(String user)
    Sets the AG user for X-Masquerade-As-User requests.

    For AG superusers only. This allows AG superusers to run requests as another user in a dedicated session.

    Parameters:
      `user` - the user for X-Masquerade-As-User requests

  - ### putCatalog

    public void putCatalog(String catalogURL) throws AGHttpException
    Throws:
      `AGHttpException`

  - ### deleteCatalog

    public void deleteCatalog(String catalogURL) throws AGHttpException
    Throws:
      `AGHttpException`

  - ### putRepository

    public void putRepository(String repositoryURL) throws AGHttpException
    Throws:
      `AGHttpException`

  - ### deleteRepository

    public void deleteRepository(String repositoryURL) throws AGHttpException
    Throws:
      `AGHttpException`

  - ### getTupleQueryResult

    public org.eclipse.rdf4j.query.TupleQueryResult getTupleQueryResult(String url) throws AGHttpException
    Throws:
      `AGHttpException`

  - ### getBlankNodes

    public String[] getBlankNodes(String repositoryURL, int amount) throws AGHttpException
    Throws:
      `AGHttpException`

  - ### getString

    public String getString(String url) throws AGHttpException
    Throws:
      `AGHttpException`

  - ### getStringArray

    public String[] getStringArray(String url) throws AGHttpException
    Throws:
      `AGHttpException`

  - ### getListOfStrings

    public List<String> getListOfStrings(String url) throws AGHttpException
    Throws:
      `AGHttpException`

  - ### openSession

    public String openSession(String spec, boolean autocommit) throws AGHttpException
    Throws:
      `AGHttpException`

  - ### close

    public void close()
    Specified by:
      `close` in interface `AutoCloseable`

  - ### generateURIs

    public String[] generateURIs(String repositoryURL, String namespace, int amount) throws AGHttpException
    Throws:
      `AGHttpException`