Class ManagedClientConnectionImpl
- java.lang.Object
-
- org.apache.http.impl.conn.ManagedClientConnectionImpl
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,ConnectionReleaseTrigger,HttpRoutedConnection,ManagedClientConnection,ManagedHttpClientConnection,org.apache.http.HttpClientConnection,org.apache.http.HttpConnection,org.apache.http.HttpInetConnection
@Deprecated class ManagedClientConnectionImpl extends java.lang.Object implements ManagedClientConnection
Deprecated.(4.3) useManagedHttpClientConnectionFactory.- Since:
- 4.2
-
-
Field Summary
Fields Modifier and Type Field Description private longdurationDeprecated.private ClientConnectionManagermanagerDeprecated.private ClientConnectionOperatoroperatorDeprecated.private HttpPoolEntrypoolEntryDeprecated.private booleanreusableDeprecated.
-
Constructor Summary
Constructors Constructor Description ManagedClientConnectionImpl(ClientConnectionManager manager, ClientConnectionOperator operator, HttpPoolEntry entry)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidabortConnection()Deprecated.Releases the connection without the option of keep-alive.voidbind(java.net.Socket socket)Deprecated.Binds this connection to the given socket.voidclose()Deprecated.(package private) HttpPoolEntrydetach()Deprecated.private OperatedClientConnectionensureConnection()Deprecated.private HttpPoolEntryensurePoolEntry()Deprecated.voidflush()Deprecated.java.lang.ObjectgetAttribute(java.lang.String id)Deprecated.private OperatedClientConnectiongetConnection()Deprecated.java.lang.StringgetId()Deprecated.Returns connection ID which is expected to be unique for the life span of the connection manager.java.net.InetAddressgetLocalAddress()Deprecated.intgetLocalPort()Deprecated.ClientConnectionManagergetManager()Deprecated.org.apache.http.HttpConnectionMetricsgetMetrics()Deprecated.(package private) HttpPoolEntrygetPoolEntry()Deprecated.java.net.InetAddressgetRemoteAddress()Deprecated.intgetRemotePort()Deprecated.HttpRoutegetRoute()Deprecated.Obtains the current route of this connection.java.net.SocketgetSocket()Deprecated.Returns the underlying socket.intgetSocketTimeout()Deprecated.javax.net.ssl.SSLSessiongetSSLSession()Deprecated.Obtains the SSL session of the underlying connection, if any.java.lang.ObjectgetState()Deprecated.Returns the state object associated with this connection.booleanisMarkedReusable()Deprecated.Indicates whether this connection is in a reusable communication state.booleanisOpen()Deprecated.booleanisResponseAvailable(int timeout)Deprecated.booleanisSecure()Deprecated.Indicates whether this connection is secure.booleanisStale()Deprecated.voidlayerProtocol(org.apache.http.protocol.HttpContext context, org.apache.http.params.HttpParams params)Deprecated.Layers a new protocol on top of atunnelledconnection.voidmarkReusable()Deprecated.Marks this connection as being in a reusable communication state.voidopen(HttpRoute route, org.apache.http.protocol.HttpContext context, org.apache.http.params.HttpParams params)Deprecated.Opens this connection according to the given route.voidreceiveResponseEntity(org.apache.http.HttpResponse response)Deprecated.org.apache.http.HttpResponsereceiveResponseHeader()Deprecated.voidreleaseConnection()Deprecated.Releases the connection with the option of keep-alive.java.lang.ObjectremoveAttribute(java.lang.String id)Deprecated.voidsendRequestEntity(org.apache.http.HttpEntityEnclosingRequest request)Deprecated.voidsendRequestHeader(org.apache.http.HttpRequest request)Deprecated.voidsetAttribute(java.lang.String id, java.lang.Object obj)Deprecated.voidsetIdleDuration(long duration, java.util.concurrent.TimeUnit unit)Deprecated.Sets the duration that this connection can remain idle before it is reused.voidsetSocketTimeout(int timeout)Deprecated.voidsetState(java.lang.Object state)Deprecated.Assigns a state object to this connection.voidshutdown()Deprecated.voidtunnelProxy(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.voidtunnelTarget(boolean secure, org.apache.http.params.HttpParams params)Deprecated.Indicates that a tunnel to the target has been established.voidunmarkReusable()Deprecated.Marks this connection as not being in a reusable state.
-
-
-
Field Detail
-
manager
private final ClientConnectionManager manager
Deprecated.
-
operator
private final ClientConnectionOperator operator
Deprecated.
-
poolEntry
private volatile HttpPoolEntry poolEntry
Deprecated.
-
reusable
private volatile boolean reusable
Deprecated.
-
duration
private volatile long duration
Deprecated.
-
-
Constructor Detail
-
ManagedClientConnectionImpl
ManagedClientConnectionImpl(ClientConnectionManager manager, ClientConnectionOperator operator, HttpPoolEntry entry)
Deprecated.
-
-
Method Detail
-
getId
public java.lang.String getId()
Deprecated.Description copied from interface:ManagedHttpClientConnectionReturns connection ID which is expected to be unique for the life span of the connection manager.- Specified by:
getIdin interfaceManagedHttpClientConnection
-
getPoolEntry
HttpPoolEntry getPoolEntry()
Deprecated.
-
detach
HttpPoolEntry detach()
Deprecated.
-
getManager
public ClientConnectionManager getManager()
Deprecated.
-
getConnection
private OperatedClientConnection getConnection()
Deprecated.
-
ensureConnection
private OperatedClientConnection ensureConnection()
Deprecated.
-
ensurePoolEntry
private HttpPoolEntry ensurePoolEntry()
Deprecated.
-
close
public void close() throws java.io.IOExceptionDeprecated.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceorg.apache.http.HttpConnection- Throws:
java.io.IOException
-
shutdown
public void shutdown() throws java.io.IOExceptionDeprecated.- Specified by:
shutdownin interfaceorg.apache.http.HttpConnection- Throws:
java.io.IOException
-
isOpen
public boolean isOpen()
Deprecated.- Specified by:
isOpenin interfaceorg.apache.http.HttpConnection
-
isStale
public boolean isStale()
Deprecated.- Specified by:
isStalein interfaceorg.apache.http.HttpConnection
-
setSocketTimeout
public void setSocketTimeout(int timeout)
Deprecated.- Specified by:
setSocketTimeoutin interfaceorg.apache.http.HttpConnection
-
getSocketTimeout
public int getSocketTimeout()
Deprecated.- Specified by:
getSocketTimeoutin interfaceorg.apache.http.HttpConnection
-
getMetrics
public org.apache.http.HttpConnectionMetrics getMetrics()
Deprecated.- Specified by:
getMetricsin interfaceorg.apache.http.HttpConnection
-
flush
public void flush() throws java.io.IOExceptionDeprecated.- Specified by:
flushin interfaceorg.apache.http.HttpClientConnection- Throws:
java.io.IOException
-
isResponseAvailable
public boolean isResponseAvailable(int timeout) throws java.io.IOExceptionDeprecated.- Specified by:
isResponseAvailablein interfaceorg.apache.http.HttpClientConnection- Throws:
java.io.IOException
-
receiveResponseEntity
public void receiveResponseEntity(org.apache.http.HttpResponse response) throws org.apache.http.HttpException, java.io.IOExceptionDeprecated.- Specified by:
receiveResponseEntityin interfaceorg.apache.http.HttpClientConnection- Throws:
org.apache.http.HttpExceptionjava.io.IOException
-
receiveResponseHeader
public org.apache.http.HttpResponse receiveResponseHeader() throws org.apache.http.HttpException, java.io.IOExceptionDeprecated.- Specified by:
receiveResponseHeaderin interfaceorg.apache.http.HttpClientConnection- Throws:
org.apache.http.HttpExceptionjava.io.IOException
-
sendRequestEntity
public void sendRequestEntity(org.apache.http.HttpEntityEnclosingRequest request) throws org.apache.http.HttpException, java.io.IOExceptionDeprecated.- Specified by:
sendRequestEntityin interfaceorg.apache.http.HttpClientConnection- Throws:
org.apache.http.HttpExceptionjava.io.IOException
-
sendRequestHeader
public void sendRequestHeader(org.apache.http.HttpRequest request) throws org.apache.http.HttpException, java.io.IOExceptionDeprecated.- Specified by:
sendRequestHeaderin interfaceorg.apache.http.HttpClientConnection- Throws:
org.apache.http.HttpExceptionjava.io.IOException
-
getLocalAddress
public java.net.InetAddress getLocalAddress()
Deprecated.- Specified by:
getLocalAddressin interfaceorg.apache.http.HttpInetConnection
-
getLocalPort
public int getLocalPort()
Deprecated.- Specified by:
getLocalPortin interfaceorg.apache.http.HttpInetConnection
-
getRemoteAddress
public java.net.InetAddress getRemoteAddress()
Deprecated.- Specified by:
getRemoteAddressin interfaceorg.apache.http.HttpInetConnection
-
getRemotePort
public int getRemotePort()
Deprecated.- Specified by:
getRemotePortin interfaceorg.apache.http.HttpInetConnection
-
isSecure
public boolean isSecure()
Deprecated.Description copied from interface:ManagedClientConnectionIndicates 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:
isSecurein interfaceHttpRoutedConnection- Specified by:
isSecurein interfaceManagedClientConnection- Returns:
trueif this connection is secure,falseotherwise
-
bind
public void bind(java.net.Socket socket) throws java.io.IOExceptionDeprecated.Description copied from interface:ManagedHttpClientConnectionBinds 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:
bindin interfaceManagedHttpClientConnection- Parameters:
socket- the socket to bind the connection to.- Throws:
java.io.IOException
-
getSocket
public java.net.Socket getSocket()
Deprecated.Description copied from interface:ManagedHttpClientConnectionReturns the underlying socket.- Specified by:
getSocketin interfaceManagedHttpClientConnection
-
getSSLSession
public javax.net.ssl.SSLSession getSSLSession()
Deprecated.Description copied from interface:ManagedClientConnectionObtains 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:
getSSLSessionin interfaceHttpRoutedConnection- Specified by:
getSSLSessionin interfaceManagedClientConnection- Specified by:
getSSLSessionin interfaceManagedHttpClientConnection- Returns:
- the underlying SSL session if available,
nullotherwise
-
getAttribute
public java.lang.Object getAttribute(java.lang.String id)
Deprecated.
-
removeAttribute
public java.lang.Object removeAttribute(java.lang.String id)
Deprecated.
-
setAttribute
public void setAttribute(java.lang.String id, java.lang.Object obj)Deprecated.
-
getRoute
public HttpRoute getRoute()
Deprecated.Description copied from interface:ManagedClientConnectionObtains the current route of this connection.- Specified by:
getRoutein interfaceHttpRoutedConnection- Specified by:
getRoutein interfaceManagedClientConnection- Returns:
- the route established so far, or
nullif not connected
-
open
public void open(HttpRoute route, org.apache.http.protocol.HttpContext context, org.apache.http.params.HttpParams params) throws java.io.IOException
Deprecated.Description copied from interface:ManagedClientConnectionOpens this connection according to the given route.- Specified by:
openin 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:
java.io.IOException- in case of a problem
-
tunnelTarget
public void tunnelTarget(boolean secure, org.apache.http.params.HttpParams params) throws java.io.IOExceptionDeprecated.Description copied from interface:ManagedClientConnectionIndicates that a tunnel to the target has been established. The route is the one previously passed toopen. Subsequently,layerProtocolcan 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:
tunnelTargetin interfaceManagedClientConnection- Parameters:
secure-trueif the tunnel should be considered secure,falseotherwiseparams- the parameters for tunnelling this connection- Throws:
java.io.IOException- in case of a problem
-
tunnelProxy
public void tunnelProxy(org.apache.http.HttpHost next, boolean secure, org.apache.http.params.HttpParams params) throws java.io.IOExceptionDeprecated.Description copied from interface:ManagedClientConnectionIndicates 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:
tunnelProxyin 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-trueif the connection should be considered secure,falseotherwiseparams- the parameters for tunnelling this connection- Throws:
java.io.IOException- in case of a problem
-
layerProtocol
public void layerProtocol(org.apache.http.protocol.HttpContext context, org.apache.http.params.HttpParams params) throws java.io.IOExceptionDeprecated.Description copied from interface:ManagedClientConnectionLayers a new protocol on top of atunnelledconnection. 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:
layerProtocolin interfaceManagedClientConnection- Parameters:
context- the context for layering on top of this connectionparams- the parameters for layering on top of this connection- Throws:
java.io.IOException- in case of a problem
-
getState
public java.lang.Object getState()
Deprecated.Description copied from interface:ManagedClientConnectionReturns the state object associated with this connection.- Specified by:
getStatein interfaceManagedClientConnection- Returns:
- The state object
-
setState
public void setState(java.lang.Object state)
Deprecated.Description copied from interface:ManagedClientConnectionAssigns a state object to this connection. Connection managers may make use of the connection state when allocating persistent connections.- Specified by:
setStatein interfaceManagedClientConnection- Parameters:
state- The state object
-
markReusable
public void markReusable()
Deprecated.Description copied from interface:ManagedClientConnectionMarks 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
routemismatch, the connection being closed, or other circumstances might prevent reuse.- Specified by:
markReusablein interfaceManagedClientConnection
-
unmarkReusable
public void unmarkReusable()
Deprecated.Description copied from interface:ManagedClientConnectionMarks 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:
unmarkReusablein interfaceManagedClientConnection
-
isMarkedReusable
public boolean isMarkedReusable()
Deprecated.Description copied from interface:ManagedClientConnectionIndicates whether this connection is in a reusable communication state. SeemarkReusableandunmarkReusablefor details.- Specified by:
isMarkedReusablein interfaceManagedClientConnection- Returns:
trueif this connection is marked as being in a reusable communication state,falseotherwise
-
setIdleDuration
public void setIdleDuration(long duration, java.util.concurrent.TimeUnit unit)Deprecated.Description copied from interface:ManagedClientConnectionSets 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:
setIdleDurationin interfaceManagedClientConnection
-
releaseConnection
public void releaseConnection()
Deprecated.Description copied from interface:ConnectionReleaseTriggerReleases 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. UseabortConnectionfor a hard release. The connection may be reused as specified by the duration.- Specified by:
releaseConnectionin interfaceConnectionReleaseTrigger
-
abortConnection
public void abortConnection()
Deprecated.Description copied from interface:ConnectionReleaseTriggerReleases 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:
abortConnectionin interfaceConnectionReleaseTrigger
-
-