ManagedHttpClientConnectionFactory.@Deprecated public class DefaultClientConnection extends org.apache.http.impl.SocketHttpClientConnection implements OperatedClientConnection, ManagedHttpClientConnection, org.apache.http.protocol.HttpContext
| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<java.lang.String,java.lang.Object> |
attributes
Deprecated.
connection specific attributes
|
private boolean |
connSecure
Deprecated.
Whether this connection is secure.
|
private org.apache.commons.logging.Log |
headerLog
Deprecated.
|
private org.apache.commons.logging.Log |
log
Deprecated.
|
private boolean |
shutdown
Deprecated.
True if this connection was shutdown.
|
private java.net.Socket |
socket
Deprecated.
The unconnected socket
|
private org.apache.http.HttpHost |
targetHost
Deprecated.
The target host of this connection.
|
private org.apache.commons.logging.Log |
wireLog
Deprecated.
|
| Constructor and Description |
|---|
DefaultClientConnection()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
bind(java.net.Socket socket)
Deprecated.
Binds this connection to the given socket.
|
void |
close()
Deprecated.
|
protected org.apache.http.io.HttpMessageParser<org.apache.http.HttpResponse> |
createResponseParser(org.apache.http.io.SessionInputBuffer buffer,
org.apache.http.HttpResponseFactory responseFactory,
org.apache.http.params.HttpParams params)
Deprecated.
|
protected org.apache.http.io.SessionInputBuffer |
createSessionInputBuffer(java.net.Socket socket,
int bufferSize,
org.apache.http.params.HttpParams params)
Deprecated.
|
protected org.apache.http.io.SessionOutputBuffer |
createSessionOutputBuffer(java.net.Socket socket,
int bufferSize,
org.apache.http.params.HttpParams params)
Deprecated.
|
java.lang.Object |
getAttribute(java.lang.String id)
Deprecated.
|
java.lang.String |
getId()
Deprecated.
Returns connection ID which is expected to be unique
for the life span of the connection manager.
|
java.net.Socket |
getSocket()
Deprecated.
Obtains the socket for this connection.
|
javax.net.ssl.SSLSession |
getSSLSession()
Deprecated.
Obtains the SSL session of the underlying connection, if any.
|
org.apache.http.HttpHost |
getTargetHost()
Deprecated.
Obtains the target host for this connection.
|
boolean |
isSecure()
Deprecated.
Indicates whether this connection is secure.
|
void |
openCompleted(boolean secure,
org.apache.http.params.HttpParams params)
Deprecated.
Signals that the connection has been successfully open.
|
void |
opening(java.net.Socket sock,
org.apache.http.HttpHost target)
Deprecated.
Signals that this connection is in the process of being open.
|
org.apache.http.HttpResponse |
receiveResponseHeader()
Deprecated.
|
java.lang.Object |
removeAttribute(java.lang.String id)
Deprecated.
|
void |
sendRequestHeader(org.apache.http.HttpRequest request)
Deprecated.
|
void |
setAttribute(java.lang.String id,
java.lang.Object obj)
Deprecated.
|
void |
shutdown()
Deprecated.
Force-closes this connection.
|
void |
update(java.net.Socket sock,
org.apache.http.HttpHost target,
boolean secure,
org.apache.http.params.HttpParams params)
Deprecated.
Updates this connection.
|
assertNotOpen, assertOpen, bind, getLocalAddress, getLocalPort, getRemoteAddress, getRemotePort, getSocketTimeout, isOpen, setSocketTimeout, toStringcreateConnectionMetrics, createEntityDeserializer, createEntitySerializer, createHttpResponseFactory, createRequestWriter, doFlush, flush, getMetrics, init, isEof, isResponseAvailable, isStale, receiveResponseEntity, sendRequestEntityclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitflush, isResponseAvailable, receiveResponseEntity, sendRequestEntityprivate final org.apache.commons.logging.Log log
private final org.apache.commons.logging.Log headerLog
private final org.apache.commons.logging.Log wireLog
private volatile java.net.Socket socket
private org.apache.http.HttpHost targetHost
private boolean connSecure
private volatile boolean shutdown
private final java.util.Map<java.lang.String,java.lang.Object> attributes
public java.lang.String getId()
ManagedHttpClientConnectiongetId in interface ManagedHttpClientConnectionpublic final org.apache.http.HttpHost getTargetHost()
OperatedClientConnection
The return value is well-defined only while the connection is open.
It may change even while the connection is open,
because of an update.
getTargetHost in interface OperatedClientConnectionpublic final boolean isSecure()
OperatedClientConnectionupdate.isSecure in interface OperatedClientConnectiontrue if this connection is secure,
false otherwisepublic final java.net.Socket getSocket()
OperatedClientConnectionupdate.getSocket in interface ManagedHttpClientConnectiongetSocket in interface OperatedClientConnectiongetSocket in class org.apache.http.impl.SocketHttpClientConnectiontarget hostpublic javax.net.ssl.SSLSession getSSLSession()
ManagedHttpClientConnectionSSLSocket, the SSL session of
that socket is obtained. This is a potentially blocking operation.getSSLSession in interface ManagedHttpClientConnectionnull otherwisepublic void opening(java.net.Socket sock,
org.apache.http.HttpHost target)
throws java.io.IOException
OperatedClientConnection
By calling this method, the connection can be re-initialized
with a new Socket instance before OperatedClientConnection.openCompleted(boolean, org.apache.http.params.HttpParams) is called.
This enabled the connection to close that socket if
shutdown
is called before it is fully open. Closing an unconnected socket
will interrupt a thread that is blocked on the connect.
Otherwise, that thread will either time out on the connect,
or it returns successfully and then opens this connection
which was just shut down.
This method can be called multiple times if the connection is layered over another protocol. Note: This method will not close the previously used socket. It is the caller's responsibility to close that socket if it is no longer required.
The caller must invoke OperatedClientConnection.openCompleted(boolean, org.apache.http.params.HttpParams) in order to complete
the process.
opening in interface OperatedClientConnectionsock - the unconnected socket which is about to
be connected.target - the target host of this connectionjava.io.IOExceptionpublic void openCompleted(boolean secure,
org.apache.http.params.HttpParams params)
throws java.io.IOException
OperatedClientConnectionopenCompleted in interface OperatedClientConnectionsecure - true if this connection is secure, for
example if an SSLSocket is used, or
false if it is not secureparams - parameters for this connection. The parameters will
be used when creating dependent objects, for example
to determine buffer sizes.java.io.IOExceptionpublic void shutdown()
throws java.io.IOException
opening was already called but
openCompleted was not), the associated
socket that is being connected to a remote address will be closed.
That will interrupt a thread that is blocked on connecting
the socket.
If the connection is not yet open, this will prevent the connection
from being opened.shutdown in interface org.apache.http.HttpConnectionshutdown in class org.apache.http.impl.SocketHttpClientConnectionjava.io.IOException - in case of a problempublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface org.apache.http.HttpConnectionclose in class org.apache.http.impl.SocketHttpClientConnectionjava.io.IOExceptionprotected org.apache.http.io.SessionInputBuffer createSessionInputBuffer(java.net.Socket socket,
int bufferSize,
org.apache.http.params.HttpParams params)
throws java.io.IOException
createSessionInputBuffer in class org.apache.http.impl.SocketHttpClientConnectionjava.io.IOExceptionprotected org.apache.http.io.SessionOutputBuffer createSessionOutputBuffer(java.net.Socket socket,
int bufferSize,
org.apache.http.params.HttpParams params)
throws java.io.IOException
createSessionOutputBuffer in class org.apache.http.impl.SocketHttpClientConnectionjava.io.IOExceptionprotected org.apache.http.io.HttpMessageParser<org.apache.http.HttpResponse> createResponseParser(org.apache.http.io.SessionInputBuffer buffer,
org.apache.http.HttpResponseFactory responseFactory,
org.apache.http.params.HttpParams params)
createResponseParser in class org.apache.http.impl.AbstractHttpClientConnectionpublic void bind(java.net.Socket socket)
throws java.io.IOException
ManagedHttpClientConnectionbind in interface ManagedHttpClientConnectionsocket - the socket to bind the connection to.java.io.IOExceptionpublic void update(java.net.Socket sock,
org.apache.http.HttpHost target,
boolean secure,
org.apache.http.params.HttpParams params)
throws java.io.IOException
OperatedClientConnectionNote: Updating the connection will not close the previously used socket. It is the caller's responsibility to close that socket if it is no longer required.
update in interface OperatedClientConnectionsock - the new socket for communicating with the target host,
or null to continue using the old socket.
If null is passed, helper objects that
depend on the socket should be re-used. In that case,
some changes in the parameters will not take effect.target - the new target host of this connectionsecure - true if this connection is now secure,
false if it is not secureparams - new parameters for this connectionjava.io.IOExceptionpublic org.apache.http.HttpResponse receiveResponseHeader()
throws org.apache.http.HttpException,
java.io.IOException
receiveResponseHeader in interface org.apache.http.HttpClientConnectionreceiveResponseHeader in class org.apache.http.impl.AbstractHttpClientConnectionorg.apache.http.HttpExceptionjava.io.IOExceptionpublic void sendRequestHeader(org.apache.http.HttpRequest request)
throws org.apache.http.HttpException,
java.io.IOException
sendRequestHeader in interface org.apache.http.HttpClientConnectionsendRequestHeader in class org.apache.http.impl.AbstractHttpClientConnectionorg.apache.http.HttpExceptionjava.io.IOExceptionpublic java.lang.Object getAttribute(java.lang.String id)
getAttribute in interface org.apache.http.protocol.HttpContextpublic java.lang.Object removeAttribute(java.lang.String id)
removeAttribute in interface org.apache.http.protocol.HttpContextpublic void setAttribute(java.lang.String id,
java.lang.Object obj)
setAttribute in interface org.apache.http.protocol.HttpContext