Class HttpClientBase
- java.lang.Object
-
- org.apache.lucene.replicator.http.HttpClientBase
-
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
HttpReplicator
@Deprecated public abstract class HttpClientBase extends Object implements Closeable
Deprecated.use org.apache.lucene.replicator.nrt insteadBase class for Http clients.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_CONNECTION_TIMEOUTDeprecated.Default connection timeout for this client, in milliseconds.static intDEFAULT_SO_TIMEOUTDeprecated.Default socket timeout for this client, in milliseconds.protected StringurlDeprecated.The URL stting to execute requests against.
-
Constructor Summary
Constructors Modifier Constructor Description protectedHttpClientBase(String host, int port, String path, org.apache.http.conn.HttpClientConnectionManager conMgr, org.apache.http.client.config.RequestConfig defaultConfig)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()Deprecated.protected <T> TdoAction(org.apache.http.HttpResponse response, boolean consume, Callable<T> call)Deprecated.Do a specific action and validate after the action that the status is still OK, and if not, attempt to extract the actual server side exception.protected <T> TdoAction(org.apache.http.HttpResponse response, Callable<T> call)Deprecated.Same asdoAction(HttpResponse, boolean, Callable)but always do consume at the end.protected voidensureOpen()Deprecated.ThrowsAlreadyClosedExceptionif this client is already closed.protected org.apache.http.HttpResponseexecuteGET(String request, String... params)Deprecated.internal: execute a request and return its result Theparamsargument is treated as: name1,value1,name2,value2,...protected org.apache.http.HttpResponseexecutePOST(String request, org.apache.http.HttpEntity entity, String... params)Deprecated.internal: execute a request and return its result Theparamsargument is treated as: name1,value1,name2,value2,...protected booleanisClosed()Deprecated.Returns true iff this instance wasclosed, otherwise returns false.InputStreamresponseInputStream(org.apache.http.HttpResponse response)Deprecated.Internal utility: input stream of the provided responseInputStreamresponseInputStream(org.apache.http.HttpResponse response, boolean consume)Deprecated.Internal utility: input stream of the provided response, which optionally consumes the response's resources when the input stream is exhausted.protected voidthrowKnownError(org.apache.http.HttpResponse response, org.apache.http.StatusLine statusLine)Deprecated.protected voidverifyStatus(org.apache.http.HttpResponse response)Deprecated.Internal: response status after invocation, and in case or error attempt to read the exception sent by the server.
-
-
-
Field Detail
-
DEFAULT_CONNECTION_TIMEOUT
public static final int DEFAULT_CONNECTION_TIMEOUT
Deprecated.Default connection timeout for this client, in milliseconds.- See Also:
- Constant Field Values
-
DEFAULT_SO_TIMEOUT
public static final int DEFAULT_SO_TIMEOUT
Deprecated.Default socket timeout for this client, in milliseconds.- See Also:
- Constant Field Values
-
url
protected final String url
Deprecated.The URL stting to execute requests against.
-
-
Constructor Detail
-
HttpClientBase
protected HttpClientBase(String host, int port, String path, org.apache.http.conn.HttpClientConnectionManager conMgr, org.apache.http.client.config.RequestConfig defaultConfig)
Deprecated.- Parameters:
conMgr- connection manager to use for this http client. NOTE:The providedHttpClientConnectionManagerwill not beHttpClientConnectionManager.shutdown()by this class.defaultConfig- the defaultRequestConfigto set on the client. Ifnulla default config is created w/ the default connection and socket timeouts.
-
-
Method Detail
-
ensureOpen
protected final void ensureOpen() throws AlreadyClosedExceptionDeprecated.ThrowsAlreadyClosedExceptionif this client is already closed.- Throws:
AlreadyClosedException
-
verifyStatus
protected void verifyStatus(org.apache.http.HttpResponse response) throws IOExceptionDeprecated.Internal: response status after invocation, and in case or error attempt to read the exception sent by the server.- Throws:
IOException
-
throwKnownError
protected void throwKnownError(org.apache.http.HttpResponse response, org.apache.http.StatusLine statusLine) throws IOExceptionDeprecated.- Throws:
IOException
-
executePOST
protected org.apache.http.HttpResponse executePOST(String request, org.apache.http.HttpEntity entity, String... params) throws IOException
Deprecated.internal: execute a request and return its result Theparamsargument is treated as: name1,value1,name2,value2,...- Throws:
IOException
-
executeGET
protected org.apache.http.HttpResponse executeGET(String request, String... params) throws IOException
Deprecated.internal: execute a request and return its result Theparamsargument is treated as: name1,value1,name2,value2,...- Throws:
IOException
-
responseInputStream
public InputStream responseInputStream(org.apache.http.HttpResponse response) throws IOException
Deprecated.Internal utility: input stream of the provided response- Throws:
IOException
-
responseInputStream
public InputStream responseInputStream(org.apache.http.HttpResponse response, boolean consume) throws IOException
Deprecated.Internal utility: input stream of the provided response, which optionally consumes the response's resources when the input stream is exhausted.- Throws:
IOException
-
isClosed
protected final boolean isClosed()
Deprecated.
-
doAction
protected <T> T doAction(org.apache.http.HttpResponse response, Callable<T> call) throws IOExceptionDeprecated.Same asdoAction(HttpResponse, boolean, Callable)but always do consume at the end.- Throws:
IOException
-
doAction
protected <T> T doAction(org.apache.http.HttpResponse response, boolean consume, Callable<T> call) throws IOExceptionDeprecated.Do a specific action and validate after the action that the status is still OK, and if not, attempt to extract the actual server side exception. Optionally release the response at exit, depending onconsumeparameter.- Throws:
IOException
-
close
public void close() throws IOExceptionDeprecated.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-