@Deprecated @NotThreadSafe public abstract class AbstractClientConnAdapter extends java.lang.Object implements ManagedClientConnection, HttpContext
operated to
managed client connections.
Read and write methods are delegated to the wrapped connection.
Operations affecting the connection state have to be implemented
by derived classes. Operations for querying the connection state
are delegated to the wrapped connection if there is one, or
return a default value if there is none.
This adapter tracks the checkpoints for reusable communication states,
as indicated by markReusable and queried by
isMarkedReusable.
All send and receive operations will automatically clear the mark.
Connection release calls are delegated to the connection manager,
if there is one. abortConnection will
clear the reusability mark first. The connection manager is
expected to tolerate multiple calls to the release method.
RESERVED_PREFIX| 限定符 | 构造器和说明 |
|---|---|
protected |
AbstractClientConnAdapter(ClientConnectionManager mgr,
OperatedClientConnection conn)
已过时。
Creates a new connection adapter.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
abortConnection()
已过时。
Releases the connection without the option of keep-alive.
|
protected void |
assertNotAborted()
已过时。
(4.1) use
assertValid(OperatedClientConnection) |
protected void |
assertValid(OperatedClientConnection wrappedConn)
已过时。
Asserts that there is a valid wrapped connection to delegate to.
|
protected void |
detach()
已过时。
Detaches this adapter from the wrapped connection.
|
void |
flush()
已过时。
Writes out all pending buffered data over the open connection.
|
java.lang.Object |
getAttribute(java.lang.String id)
已过时。
Obtains attribute with the given name.
|
java.net.InetAddress |
getLocalAddress()
已过时。
|
int |
getLocalPort()
已过时。
|
protected ClientConnectionManager |
getManager()
已过时。
|
HttpConnectionMetrics |
getMetrics()
已过时。
Returns a collection of connection metrics.
|
java.net.InetAddress |
getRemoteAddress()
已过时。
|
int |
getRemotePort()
已过时。
|
int |
getSocketTimeout()
已过时。
Returns the socket timeout value.
|
javax.net.ssl.SSLSession |
getSSLSession()
已过时。
Obtains the SSL session of the underlying connection, if any.
|
protected OperatedClientConnection |
getWrappedConnection()
已过时。
|
boolean |
isMarkedReusable()
已过时。
Indicates whether this connection is in a reusable communication state.
|
boolean |
isOpen()
已过时。
Checks if this connection is open.
|
protected boolean |
isReleased()
已过时。
|
boolean |
isResponseAvailable(int timeout)
已过时。
Checks if response data is available from the connection.
|
boolean |
isSecure()
已过时。
Indicates whether this connection is secure.
|
boolean |
isStale()
已过时。
Checks whether this connection has gone down.
|
void |
markReusable()
已过时。
Marks this connection as being in a reusable communication state.
|
void |
receiveResponseEntity(HttpResponse response)
已过时。
Receives the next response entity available from this connection and
attaches it to an existing HttpResponse object.
|
HttpResponse |
receiveResponseHeader()
已过时。
Receives the request line and headers of the next response available from
this connection.
|
void |
releaseConnection()
已过时。
Releases the connection with the option of keep-alive.
|
java.lang.Object |
removeAttribute(java.lang.String id)
已过时。
Removes attribute with the given name from the context.
|
void |
sendRequestEntity(HttpEntityEnclosingRequest request)
已过时。
Sends the request entity over the connection.
|
void |
sendRequestHeader(HttpRequest request)
已过时。
Sends the request line and all headers over the connection.
|
void |
setAttribute(java.lang.String id,
java.lang.Object obj)
已过时。
Sets value of the attribute with the given name.
|
void |
setIdleDuration(long duration,
java.util.concurrent.TimeUnit unit)
已过时。
Sets the duration that this connection can remain idle before it is
reused.
|
void |
setSocketTimeout(int timeout)
已过时。
Sets the socket timeout value.
|
void |
unmarkReusable()
已过时。
Marks this connection as not being in a reusable state.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetRoute, getState, layerProtocol, open, setState, tunnelProxy, tunnelTargetbind, getId, getSocketclose, shutdownprotected AbstractClientConnAdapter(ClientConnectionManager mgr, OperatedClientConnection conn)
marked as reusable.mgr - the connection manager, or nullconn - the connection to wrap, or nullprotected void detach()
protected OperatedClientConnection getWrappedConnection()
protected ClientConnectionManager getManager()
protected final void assertNotAborted()
throws java.io.InterruptedIOException
assertValid(OperatedClientConnection)java.io.InterruptedIOExceptionprotected boolean isReleased()
protected final void assertValid(OperatedClientConnection wrappedConn) throws ConnectionShutdownException
ConnectionShutdownException - if there is no wrapped connection
or connection has been abortedpublic boolean isOpen()
HttpConnectionisOpen 在接口中 HttpConnectionpublic boolean isStale()
HttpConnectionisStale 在接口中 HttpConnectiontrue if attempts to use this connection are
likely to succeed, or false if they are likely
to fail and this connection should be closedpublic void setSocketTimeout(int timeout)
HttpConnectionsetSocketTimeout 在接口中 HttpConnectiontimeout - timeout value in millisecondspublic int getSocketTimeout()
HttpConnectiongetSocketTimeout 在接口中 HttpConnection0 if timeout is disabled or -1 if
timeout is undefined.public HttpConnectionMetrics getMetrics()
HttpConnectiongetMetrics 在接口中 HttpConnectionpublic void flush()
throws java.io.IOException
HttpClientConnectionflush 在接口中 HttpClientConnectionjava.io.IOException - in case of an I/O errorpublic boolean isResponseAvailable(int timeout)
throws java.io.IOException
HttpClientConnectionisResponseAvailable 在接口中 HttpClientConnectiontimeout - the maximum time in milliseconds to wait for datatimeout milliseconds.java.io.IOException - if an error happens on the connectionpublic void receiveResponseEntity(HttpResponse response) throws HttpException, java.io.IOException
HttpClientConnectionreceiveResponseEntity 在接口中 HttpClientConnectionresponse - the response to attach the entity toHttpException - in case of HTTP protocol violationjava.io.IOException - in case of an I/O errorpublic HttpResponse receiveResponseHeader() throws HttpException, java.io.IOException
HttpClientConnectionreceiveResponseHeader 在接口中 HttpClientConnectionHttpException - in case of HTTP protocol violationjava.io.IOException - in case of an I/O errorpublic void sendRequestEntity(HttpEntityEnclosingRequest request) throws HttpException, java.io.IOException
HttpClientConnectionsendRequestEntity 在接口中 HttpClientConnectionrequest - the request whose entity to send.HttpException - in case of HTTP protocol violationjava.io.IOException - in case of an I/O errorpublic void sendRequestHeader(HttpRequest request) throws HttpException, java.io.IOException
HttpClientConnectionsendRequestHeader 在接口中 HttpClientConnectionrequest - the request whose headers to send.HttpException - in case of HTTP protocol violationjava.io.IOException - in case of an I/O errorpublic java.net.InetAddress getLocalAddress()
getLocalAddress 在接口中 HttpInetConnectionpublic int getLocalPort()
getLocalPort 在接口中 HttpInetConnectionpublic java.net.InetAddress getRemoteAddress()
getRemoteAddress 在接口中 HttpInetConnectionpublic int getRemotePort()
getRemotePort 在接口中 HttpInetConnectionpublic boolean isSecure()
ManagedClientConnectionisSecure 在接口中 HttpRoutedConnectionisSecure 在接口中 ManagedClientConnectiontrue if this connection is secure,
false otherwisepublic javax.net.ssl.SSLSession getSSLSession()
ManagedClientConnectionSSLSocket, the SSL session of
that socket is obtained. This is a potentially blocking operation.
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 extension hand, SSL sockets may be considered insecure,
for example depending on the chosen cipher suite.getSSLSession 在接口中 HttpRoutedConnectiongetSSLSession 在接口中 ManagedClientConnectiongetSSLSession 在接口中 ManagedHttpClientConnectionnull otherwisepublic void markReusable()
ManagedClientConnectionroute mismatch, the connection being closed,
or extension circumstances might prevent reuse.markReusable 在接口中 ManagedClientConnectionpublic void unmarkReusable()
ManagedClientConnectionreuse strategy.
markReusable.unmarkReusable 在接口中 ManagedClientConnectionpublic boolean isMarkedReusable()
ManagedClientConnectionmarkReusable and
unmarkReusable for details.isMarkedReusable 在接口中 ManagedClientConnectiontrue if this connection is marked as being in
a reusable communication state,
false otherwisepublic void setIdleDuration(long duration,
java.util.concurrent.TimeUnit unit)
ManagedClientConnectionsetIdleDuration 在接口中 ManagedClientConnectionpublic void releaseConnection()
ConnectionReleaseTriggerabortConnection for a hard release. The
connection may be reused as specified by the duration.releaseConnection 在接口中 ConnectionReleaseTriggerpublic void abortConnection()
ConnectionReleaseTriggerConnectionReleaseTrigger.releaseConnection() for a graceful release.abortConnection 在接口中 ConnectionReleaseTriggerpublic java.lang.Object getAttribute(java.lang.String id)
HttpContextgetAttribute 在接口中 HttpContextid - the attribute name.null if not set.public java.lang.Object removeAttribute(java.lang.String id)
HttpContextremoveAttribute 在接口中 HttpContextid - the attribute name.null if not set.public void setAttribute(java.lang.String id,
java.lang.Object obj)
HttpContextsetAttribute 在接口中 HttpContextid - the attribute name.obj - the attribute value.