Class ManagedClientConnectionImpl
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ConnectionReleaseTrigger
,HttpRoutedConnection
,ManagedClientConnection
,ManagedHttpClientConnection
,org.apache.http.HttpClientConnection
,org.apache.http.HttpConnection
,org.apache.http.HttpInetConnection
- Since:
- 4.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate long
Deprecated.private final ClientConnectionManager
Deprecated.private final ClientConnectionOperator
Deprecated.private HttpPoolEntry
Deprecated.private boolean
Deprecated. -
Constructor Summary
ConstructorsConstructorDescriptionManagedClientConnectionImpl
(ClientConnectionManager manager, ClientConnectionOperator operator, HttpPoolEntry entry) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Deprecated.Releases the connection without the option of keep-alive.void
Deprecated.Binds this connection to the given socket.void
close()
Deprecated.(package private) HttpPoolEntry
detach()
Deprecated.private OperatedClientConnection
Deprecated.private HttpPoolEntry
Deprecated.void
flush()
Deprecated.getAttribute
(String id) Deprecated.private OperatedClientConnection
Deprecated.getId()
Deprecated.Returns connection ID which is expected to be unique for the life span of the connection manager.Deprecated.int
Deprecated.Deprecated.org.apache.http.HttpConnectionMetrics
Deprecated.(package private) HttpPoolEntry
Deprecated.Deprecated.int
Deprecated.getRoute()
Deprecated.Obtains the current route of this connection.Deprecated.Returns the underlying socket.int
Deprecated.Deprecated.Obtains the SSL session of the underlying connection, if any.getState()
Deprecated.Returns the state object associated with this connection.boolean
Deprecated.Indicates whether this connection is in a reusable communication state.boolean
isOpen()
Deprecated.boolean
isResponseAvailable
(int timeout) Deprecated.boolean
isSecure()
Deprecated.Indicates whether this connection is secure.boolean
isStale()
Deprecated.void
layerProtocol
(org.apache.http.protocol.HttpContext context, org.apache.http.params.HttpParams params) Deprecated.Layers a new protocol on top of atunnelled
connection.void
Deprecated.Marks this connection as being in a reusable communication state.void
open
(HttpRoute route, org.apache.http.protocol.HttpContext context, org.apache.http.params.HttpParams params) Deprecated.Opens this connection according to the given route.void
receiveResponseEntity
(org.apache.http.HttpResponse response) Deprecated.org.apache.http.HttpResponse
Deprecated.void
Deprecated.Releases the connection with the option of keep-alive.Deprecated.void
sendRequestEntity
(org.apache.http.HttpEntityEnclosingRequest request) Deprecated.void
sendRequestHeader
(org.apache.http.HttpRequest request) Deprecated.void
setAttribute
(String id, Object obj) Deprecated.void
setIdleDuration
(long duration, TimeUnit unit) Deprecated.Sets the duration that this connection can remain idle before it is reused.void
setSocketTimeout
(int timeout) Deprecated.void
Deprecated.Assigns a state object to this connection.void
shutdown()
Deprecated.void
tunnelProxy
(org.apache.http.HttpHost next, boolean secure, org.apache.http.params.HttpParams params) Deprecated.Indicates that a tunnel to an intermediate proxy has been established.void
tunnelTarget
(boolean secure, org.apache.http.params.HttpParams params) Deprecated.Indicates that a tunnel to the target has been established.void
Deprecated.Marks this connection as not being in a reusable state.
-
Field Details
-
manager
Deprecated. -
operator
Deprecated. -
poolEntry
Deprecated. -
reusable
private volatile boolean reusableDeprecated. -
duration
private volatile long durationDeprecated.
-
-
Constructor Details
-
ManagedClientConnectionImpl
ManagedClientConnectionImpl(ClientConnectionManager manager, ClientConnectionOperator operator, HttpPoolEntry entry) Deprecated.
-
-
Method Details
-
getId
Deprecated.Description copied from interface:ManagedHttpClientConnection
Returns connection ID which is expected to be unique for the life span of the connection manager.- Specified by:
getId
in interfaceManagedHttpClientConnection
-
getPoolEntry
HttpPoolEntry getPoolEntry()Deprecated. -
detach
HttpPoolEntry detach()Deprecated. -
getManager
Deprecated. -
getConnection
Deprecated. -
ensureConnection
Deprecated. -
ensurePoolEntry
Deprecated. -
close
Deprecated.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceorg.apache.http.HttpConnection
- Throws:
IOException
-
shutdown
Deprecated.- Specified by:
shutdown
in interfaceorg.apache.http.HttpConnection
- Throws:
IOException
-
isOpen
public boolean isOpen()Deprecated.- Specified by:
isOpen
in interfaceorg.apache.http.HttpConnection
-
isStale
public boolean isStale()Deprecated.- Specified by:
isStale
in interfaceorg.apache.http.HttpConnection
-
setSocketTimeout
public void setSocketTimeout(int timeout) Deprecated.- Specified by:
setSocketTimeout
in interfaceorg.apache.http.HttpConnection
-
getSocketTimeout
public int getSocketTimeout()Deprecated.- Specified by:
getSocketTimeout
in interfaceorg.apache.http.HttpConnection
-
getMetrics
public org.apache.http.HttpConnectionMetrics getMetrics()Deprecated.- Specified by:
getMetrics
in interfaceorg.apache.http.HttpConnection
-
flush
Deprecated.- Specified by:
flush
in interfaceorg.apache.http.HttpClientConnection
- Throws:
IOException
-
isResponseAvailable
Deprecated.- Specified by:
isResponseAvailable
in interfaceorg.apache.http.HttpClientConnection
- Throws:
IOException
-
receiveResponseEntity
public void receiveResponseEntity(org.apache.http.HttpResponse response) throws org.apache.http.HttpException, IOException Deprecated.- Specified by:
receiveResponseEntity
in interfaceorg.apache.http.HttpClientConnection
- Throws:
org.apache.http.HttpException
IOException
-
receiveResponseHeader
public org.apache.http.HttpResponse receiveResponseHeader() throws org.apache.http.HttpException, IOExceptionDeprecated.- Specified by:
receiveResponseHeader
in interfaceorg.apache.http.HttpClientConnection
- Throws:
org.apache.http.HttpException
IOException
-
sendRequestEntity
public void sendRequestEntity(org.apache.http.HttpEntityEnclosingRequest request) throws org.apache.http.HttpException, IOException Deprecated.- Specified by:
sendRequestEntity
in interfaceorg.apache.http.HttpClientConnection
- Throws:
org.apache.http.HttpException
IOException
-
sendRequestHeader
public void sendRequestHeader(org.apache.http.HttpRequest request) throws org.apache.http.HttpException, IOException Deprecated.- Specified by:
sendRequestHeader
in interfaceorg.apache.http.HttpClientConnection
- Throws:
org.apache.http.HttpException
IOException
-
getLocalAddress
Deprecated.- Specified by:
getLocalAddress
in interfaceorg.apache.http.HttpInetConnection
-
getLocalPort
public int getLocalPort()Deprecated.- Specified by:
getLocalPort
in interfaceorg.apache.http.HttpInetConnection
-
getRemoteAddress
Deprecated.- Specified by:
getRemoteAddress
in interfaceorg.apache.http.HttpInetConnection
-
getRemotePort
public int getRemotePort()Deprecated.- Specified by:
getRemotePort
in interfaceorg.apache.http.HttpInetConnection
-
isSecure
public boolean isSecure()Deprecated.Description copied from interface:ManagedClientConnection
Indicates whether this connection is secure. The return value is well-defined only while the connection is open. It may change even while the connection is open.- Specified by:
isSecure
in interfaceHttpRoutedConnection
- Specified by:
isSecure
in interfaceManagedClientConnection
- Returns:
true
if this connection is secure,false
otherwise
-
bind
Deprecated.Description copied from interface:ManagedHttpClientConnection
Binds this connection to the given socket. The connection is considered open if it is bound and the underlying socket is connection to a remote host.- Specified by:
bind
in interfaceManagedHttpClientConnection
- Parameters:
socket
- the socket to bind the connection to.- Throws:
IOException
-
getSocket
Deprecated.Description copied from interface:ManagedHttpClientConnection
Returns the underlying socket.- Specified by:
getSocket
in interfaceManagedHttpClientConnection
-
getSSLSession
Deprecated.Description copied from interface:ManagedClientConnection
Obtains the SSL session of the underlying connection, if any. If this connection is open, and the underlying socket is anSSLSocket
, the SSL session of that socket is obtained. This is a potentially blocking operation.Note: Whether the underlying socket is an SSL socket can not necessarily be determined via
ManagedClientConnection.isSecure()
. Plain sockets may be considered secure, for example if they are connected to a known host in the same network segment. On the other hand, SSL sockets may be considered insecure, for example depending on the chosen cipher suite.- Specified by:
getSSLSession
in interfaceHttpRoutedConnection
- Specified by:
getSSLSession
in interfaceManagedClientConnection
- Specified by:
getSSLSession
in interfaceManagedHttpClientConnection
- Returns:
- the underlying SSL session if available,
null
otherwise
-
getAttribute
Deprecated. -
removeAttribute
Deprecated. -
setAttribute
Deprecated. -
getRoute
Deprecated.Description copied from interface:ManagedClientConnection
Obtains the current route of this connection.- Specified by:
getRoute
in interfaceHttpRoutedConnection
- Specified by:
getRoute
in interfaceManagedClientConnection
- Returns:
- the route established so far, or
null
if not connected
-
open
public void open(HttpRoute route, org.apache.http.protocol.HttpContext context, org.apache.http.params.HttpParams params) throws IOException Deprecated.Description copied from interface:ManagedClientConnection
Opens this connection according to the given route.- Specified by:
open
in interfaceManagedClientConnection
- Parameters:
route
- the route along which to open. It will be opened to the first proxy if present, or directly to the target.context
- the context for opening this connectionparams
- the parameters for opening this connection- Throws:
IOException
- in case of a problem
-
tunnelTarget
public void tunnelTarget(boolean secure, org.apache.http.params.HttpParams params) throws IOException Deprecated.Description copied from interface:ManagedClientConnection
Indicates that a tunnel to the target has been established. The route is the one previously passed toopen
. Subsequently,layerProtocol
can be called to layer the TLS/SSL protocol on top of the tunnelled connection.Note: In HttpClient 3, a call to the corresponding method would automatically trigger the layering of the TLS/SSL protocol. This is not the case anymore, you can establish a tunnel without layering a new protocol over the connection.
- Specified by:
tunnelTarget
in interfaceManagedClientConnection
- Parameters:
secure
-true
if the tunnel should be considered secure,false
otherwiseparams
- the parameters for tunnelling this connection- Throws:
IOException
- in case of a problem
-
tunnelProxy
public void tunnelProxy(org.apache.http.HttpHost next, boolean secure, org.apache.http.params.HttpParams params) throws IOException Deprecated.Description copied from interface:ManagedClientConnection
Indicates that a tunnel to an intermediate proxy has been established. This is used exclusively for so-called proxy chains, where a request has to pass through multiple proxies before reaching the target. In that case, all proxies but the last need to be tunnelled when establishing the connection. Tunnelling of the last proxy to the target is optional and would be indicated viaManagedClientConnection.tunnelTarget(boolean, org.apache.http.params.HttpParams)
.- Specified by:
tunnelProxy
in interfaceManagedClientConnection
- Parameters:
next
- the proxy to which the tunnel was established. This is not the proxy through which the tunnel was established, but the new end point of the tunnel. The tunnel does not yet reach to the target, useManagedClientConnection.tunnelTarget(boolean, org.apache.http.params.HttpParams)
to indicate an end-to-end tunnel.secure
-true
if the connection should be considered secure,false
otherwiseparams
- the parameters for tunnelling this connection- Throws:
IOException
- in case of a problem
-
layerProtocol
public void layerProtocol(org.apache.http.protocol.HttpContext context, org.apache.http.params.HttpParams params) throws IOException Deprecated.Description copied from interface:ManagedClientConnection
Layers a new protocol on top of atunnelled
connection. This is typically used to create a TLS/SSL connection through a proxy. The route is the one previously passed toopen
. It is not guaranteed that the layered connection issecure
.- Specified by:
layerProtocol
in interfaceManagedClientConnection
- Parameters:
context
- the context for layering on top of this connectionparams
- the parameters for layering on top of this connection- Throws:
IOException
- in case of a problem
-
getState
Deprecated.Description copied from interface:ManagedClientConnection
Returns the state object associated with this connection.- Specified by:
getState
in interfaceManagedClientConnection
- Returns:
- The state object
-
setState
Deprecated.Description copied from interface:ManagedClientConnection
Assigns a state object to this connection. Connection managers may make use of the connection state when allocating persistent connections.- Specified by:
setState
in interfaceManagedClientConnection
- Parameters:
state
- The state object
-
markReusable
public void markReusable()Deprecated.Description copied from interface:ManagedClientConnection
Marks this connection as being in a reusable communication state. The checkpoints for reuseable communication states (in the absence of pipelining) are before sending a request and after receiving the response in its entirety. The connection will automatically clear the checkpoint when used for communication. A call to this method indicates that the next checkpoint has been reached.A reusable communication state is necessary but not sufficient for the connection to be reused. A
route
mismatch, the connection being closed, or other circumstances might prevent reuse.- Specified by:
markReusable
in interfaceManagedClientConnection
-
unmarkReusable
public void unmarkReusable()Deprecated.Description copied from interface:ManagedClientConnection
Marks this connection as not being in a reusable state. This can be used immediately before releasing this connection to prevent its reuse. Reasons for preventing reuse include error conditions and the evaluation of areuse strategy
.Note: It is not necessary to call here before writing to or reading from this connection. Communication attempts will automatically unmark the state as non-reusable. It can then be switched back using
markReusable
.- Specified by:
unmarkReusable
in interfaceManagedClientConnection
-
isMarkedReusable
public boolean isMarkedReusable()Deprecated.Description copied from interface:ManagedClientConnection
Indicates whether this connection is in a reusable communication state. SeemarkReusable
andunmarkReusable
for details.- Specified by:
isMarkedReusable
in interfaceManagedClientConnection
- Returns:
true
if this connection is marked as being in a reusable communication state,false
otherwise
-
setIdleDuration
Deprecated.Description copied from interface:ManagedClientConnection
Sets the duration that this connection can remain idle before it is reused. The connection should not be used again if this time elapses. The idle duration must be reset after each request sent over this connection. The elapsed time starts counting when the connection is released, which is typically after the headers (and any response body, if present) is fully consumed.- Specified by:
setIdleDuration
in interfaceManagedClientConnection
-
releaseConnection
public void releaseConnection()Deprecated.Description copied from interface:ConnectionReleaseTrigger
Releases the connection with the option of keep-alive. This is a "graceful" release and may cause IO operations for consuming the remainder of a response entity. UseabortConnection
for a hard release. The connection may be reused as specified by the duration.- Specified by:
releaseConnection
in interfaceConnectionReleaseTrigger
-
abortConnection
public void abortConnection()Deprecated.Description copied from interface:ConnectionReleaseTrigger
Releases the connection without the option of keep-alive. This is a "hard" release that implies a shutdown of the connection. UseConnectionReleaseTrigger.releaseConnection()
for a graceful release.- Specified by:
abortConnection
in interfaceConnectionReleaseTrigger
-
ManagedHttpClientConnectionFactory
.