Class Executor
- java.lang.Object
-
- org.apache.hc.client5.http.fluent.Executor
-
public class Executor extends java.lang.ObjectExecutor forRequests.A connection pool with maximum 100 connections per route and a total maximum of 200 connections is used internally.
- Since:
- 4.2
-
-
Field Summary
Fields Modifier and Type Field Description private static CloseableHttpClientASYNC_CLIENTprivate AuthCacheauthCacheprivate static CloseableHttpClientCLIENTprivate CookieStorecookieStoreprivate CredentialsStorecredentialsStoreprivate CloseableHttpClienthttpclientprivate static java.util.concurrent.locks.ReentrantLockLOCK
-
Constructor Summary
Constructors Constructor Description Executor(CloseableHttpClient httpclient)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Executorauth(java.lang.String host, Credentials credentials)Executorauth(AuthScope authScope, Credentials credentials)Executorauth(org.apache.hc.core5.http.HttpHost host, java.lang.String username, char[] password)Executorauth(org.apache.hc.core5.http.HttpHost host, java.lang.String username, char[] password, java.lang.String workstation, java.lang.String domain)Deprecated.Executorauth(org.apache.hc.core5.http.HttpHost host, Credentials credentials)ExecutorauthPreemptive(java.lang.String host)ExecutorauthPreemptive(org.apache.hc.core5.http.HttpHost host)ExecutorauthPreemptiveProxy(java.lang.String proxy)ExecutorauthPreemptiveProxy(org.apache.hc.core5.http.HttpHost proxy)ExecutorclearAuth()ExecutorclearCookies()Responseexecute(Request request)Executes the request.(package private) static CloseableHttpClientGET_ASYNC_CLIENT()(package private) static CloseableHttpClientGET_CLASSIC_CLIENT()static ExecutornewInstance()static ExecutornewInstance(CloseableHttpAsyncClient httpclient)This feature is considered experimental and may be discontinued in the future.static ExecutornewInstance(CloseableHttpClient httpclient)Executoruse(CredentialsStore credentialsStore)Executoruse(CookieStore cookieStore)
-
-
-
Field Detail
-
LOCK
private static final java.util.concurrent.locks.ReentrantLock LOCK
-
CLIENT
private static volatile CloseableHttpClient CLIENT
-
ASYNC_CLIENT
private static volatile CloseableHttpClient ASYNC_CLIENT
-
httpclient
private final CloseableHttpClient httpclient
-
authCache
private final AuthCache authCache
-
credentialsStore
private volatile CredentialsStore credentialsStore
-
cookieStore
private volatile CookieStore cookieStore
-
-
Constructor Detail
-
Executor
Executor(CloseableHttpClient httpclient)
-
-
Method Detail
-
GET_CLASSIC_CLIENT
static CloseableHttpClient GET_CLASSIC_CLIENT()
-
GET_ASYNC_CLIENT
static CloseableHttpClient GET_ASYNC_CLIENT()
-
newInstance
public static Executor newInstance()
-
newInstance
public static Executor newInstance(CloseableHttpClient httpclient)
-
newInstance
@Experimental public static Executor newInstance(CloseableHttpAsyncClient httpclient)
This feature is considered experimental and may be discontinued in the future.- Since:
- 5.5
-
use
public Executor use(CredentialsStore credentialsStore)
- Returns:
- this instance.
- Since:
- 4.5
-
auth
public Executor auth(AuthScope authScope, Credentials credentials)
-
auth
public Executor auth(org.apache.hc.core5.http.HttpHost host, Credentials credentials)
-
auth
public Executor auth(java.lang.String host, Credentials credentials)
- Returns:
- this instance.
- Since:
- 4.4
-
authPreemptive
public Executor authPreemptive(org.apache.hc.core5.http.HttpHost host)
-
authPreemptive
public Executor authPreemptive(java.lang.String host)
- Returns:
- this instance.
- Since:
- 4.4
-
authPreemptiveProxy
public Executor authPreemptiveProxy(org.apache.hc.core5.http.HttpHost proxy)
-
authPreemptiveProxy
public Executor authPreemptiveProxy(java.lang.String proxy)
- Returns:
- this instance.
- Since:
- 4.4
-
auth
public Executor auth(org.apache.hc.core5.http.HttpHost host, java.lang.String username, char[] password)
-
auth
@Deprecated public Executor auth(org.apache.hc.core5.http.HttpHost host, java.lang.String username, char[] password, java.lang.String workstation, java.lang.String domain)
Deprecated.- Returns:
- this instance.
-
clearAuth
public Executor clearAuth()
-
use
public Executor use(CookieStore cookieStore)
- Returns:
- this instance.
- Since:
- 4.5
-
clearCookies
public Executor clearCookies()
-
execute
public Response execute(Request request) throws java.io.IOException
Executes the request. Please Note that response content must be processed or discarded usingResponse.discardContent(), otherwise the connection used for the request might not be released to the pool.- Throws:
java.io.IOException- See Also:
Response.handleResponse(org.apache.hc.core5.http.io.HttpClientResponseHandler),Response.discardContent()
-
-