Class DefaultClientConnection
- All Implemented Interfaces:
Closeable,AutoCloseable,ManagedHttpClientConnection,OperatedClientConnection,org.apache.http.HttpClientConnection,org.apache.http.HttpConnection,org.apache.http.HttpInetConnection,org.apache.http.protocol.HttpContext
- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionDeprecated.connection specific attributesprivate booleanDeprecated.Whether this connection is secure.private final org.apache.commons.logging.LogDeprecated.private final org.apache.commons.logging.LogDeprecated.private booleanDeprecated.True if this connection was shutdown.private SocketDeprecated.The unconnected socketprivate org.apache.http.HttpHostDeprecated.The target host of this connection.private final org.apache.commons.logging.LogDeprecated.Fields inherited from interface org.apache.http.protocol.HttpContext
RESERVED_PREFIX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated.Binds this connection to the given socket.voidclose()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.SessionInputBuffercreateSessionInputBuffer(Socket socket, int bufferSize, org.apache.http.params.HttpParams params) Deprecated.protected org.apache.http.io.SessionOutputBuffercreateSessionOutputBuffer(Socket socket, int bufferSize, org.apache.http.params.HttpParams params) Deprecated.getAttribute(String id) Deprecated.getId()Deprecated.Returns connection ID which is expected to be unique for the life span of the connection manager.final SocketDeprecated.Obtains the socket for this connection.Deprecated.Obtains the SSL session of the underlying connection, if any.final org.apache.http.HttpHostDeprecated.Obtains the target host for this connection.final booleanisSecure()Deprecated.Indicates whether this connection is secure.voidopenCompleted(boolean secure, org.apache.http.params.HttpParams params) Deprecated.Signals that the connection has been successfully open.voidDeprecated.Signals that this connection is in the process of being open.org.apache.http.HttpResponseDeprecated.Deprecated.voidsendRequestHeader(org.apache.http.HttpRequest request) Deprecated.voidsetAttribute(String id, Object obj) Deprecated.voidshutdown()Deprecated.Force-closes this connection.voidupdate(Socket sock, org.apache.http.HttpHost target, boolean secure, org.apache.http.params.HttpParams params) Deprecated.Updates this connection.Methods inherited from class org.apache.http.impl.SocketHttpClientConnection
assertNotOpen, assertOpen, bind, getLocalAddress, getLocalPort, getRemoteAddress, getRemotePort, getSocketTimeout, isOpen, setSocketTimeout, toStringMethods inherited from class org.apache.http.impl.AbstractHttpClientConnection
createConnectionMetrics, createEntityDeserializer, createEntitySerializer, createHttpResponseFactory, createRequestWriter, doFlush, flush, getMetrics, init, isEof, isResponseAvailable, isStale, receiveResponseEntity, sendRequestEntityMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.http.HttpClientConnection
flush, isResponseAvailable, receiveResponseEntity, sendRequestEntityMethods inherited from interface org.apache.http.HttpConnection
getMetrics, getSocketTimeout, isOpen, isStale, setSocketTimeoutMethods inherited from interface org.apache.http.HttpInetConnection
getLocalAddress, getLocalPort, getRemoteAddress, getRemotePort
-
Field Details
-
log
private final org.apache.commons.logging.Log logDeprecated. -
headerLog
private final org.apache.commons.logging.Log headerLogDeprecated. -
wireLog
private final org.apache.commons.logging.Log wireLogDeprecated. -
socket
Deprecated.The unconnected socket -
targetHost
private org.apache.http.HttpHost targetHostDeprecated.The target host of this connection. -
connSecure
private boolean connSecureDeprecated.Whether this connection is secure. -
shutdown
private volatile boolean shutdownDeprecated.True if this connection was shutdown. -
attributes
Deprecated.connection specific attributes
-
-
Constructor Details
-
DefaultClientConnection
public DefaultClientConnection()Deprecated.
-
-
Method Details
-
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
-
getTargetHost
public final org.apache.http.HttpHost getTargetHost()Deprecated.Description copied from interface:OperatedClientConnectionObtains the target host for this connection. If the connection is to a proxy but not tunnelled, this is the proxy. If the connection is tunnelled through a proxy, this is the target of the tunnel.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.- Specified by:
getTargetHostin interfaceOperatedClientConnection- Returns:
- the host to which this connection is opened
-
isSecure
public final boolean isSecure()Deprecated.Description copied from interface:OperatedClientConnectionIndicates 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, because of anupdate.- Specified by:
isSecurein interfaceOperatedClientConnection- Returns:
trueif this connection is secure,falseotherwise
-
getSocket
Deprecated.Description copied from interface:OperatedClientConnectionObtains the socket for this connection. The return value is well-defined only while the connection is open. It may change even while the connection is open, because of anupdate.- Specified by:
getSocketin interfaceManagedHttpClientConnection- Specified by:
getSocketin interfaceOperatedClientConnection- Overrides:
getSocketin classorg.apache.http.impl.SocketHttpClientConnection- Returns:
- the socket for communicating with the
target host
-
getSSLSession
Deprecated.Description copied from interface:ManagedHttpClientConnectionObtains 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.- Specified by:
getSSLSessionin interfaceManagedHttpClientConnection- Returns:
- the underlying SSL session if available,
nullotherwise
-
opening
Deprecated.Description copied from interface:OperatedClientConnectionSignals that this connection is in the process of being open.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 ifshutdownis 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.- Specified by:
openingin interfaceOperatedClientConnection- Parameters:
sock- the unconnected socket which is about to be connected.target- the target host of this connection- Throws:
IOException
-
openCompleted
public void openCompleted(boolean secure, org.apache.http.params.HttpParams params) throws IOException Deprecated.Description copied from interface:OperatedClientConnectionSignals that the connection has been successfully open. An attempt to call this method on an open connection will cause an exception.- Specified by:
openCompletedin interfaceOperatedClientConnection- Parameters:
secure-trueif this connection is secure, for example if anSSLSocketis used, orfalseif it is not secureparams- parameters for this connection. The parameters will be used when creating dependent objects, for example to determine buffer sizes.- Throws:
IOException
-
shutdown
Deprecated.Force-closes this connection. If the connection is still in the process of being open (the methodopeningwas already called butopenCompletedwas 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.- Specified by:
shutdownin interfaceorg.apache.http.HttpConnection- Overrides:
shutdownin classorg.apache.http.impl.SocketHttpClientConnection- Throws:
IOException- in case of a problem
-
close
Deprecated.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceorg.apache.http.HttpConnection- Overrides:
closein classorg.apache.http.impl.SocketHttpClientConnection- Throws:
IOException
-
createSessionInputBuffer
protected org.apache.http.io.SessionInputBuffer createSessionInputBuffer(Socket socket, int bufferSize, org.apache.http.params.HttpParams params) throws IOException Deprecated.- Overrides:
createSessionInputBufferin classorg.apache.http.impl.SocketHttpClientConnection- Throws:
IOException
-
createSessionOutputBuffer
protected org.apache.http.io.SessionOutputBuffer createSessionOutputBuffer(Socket socket, int bufferSize, org.apache.http.params.HttpParams params) throws IOException Deprecated.- Overrides:
createSessionOutputBufferin classorg.apache.http.impl.SocketHttpClientConnection- Throws:
IOException
-
createResponseParser
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.- Overrides:
createResponseParserin classorg.apache.http.impl.AbstractHttpClientConnection
-
bind
Deprecated.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:
IOException
-
update
public void update(Socket sock, org.apache.http.HttpHost target, boolean secure, org.apache.http.params.HttpParams params) throws IOException Deprecated.Description copied from interface:OperatedClientConnectionUpdates this connection. A connection can be updated only while it is open. Updates are used for example when a tunnel has been established, or when a TLS/SSL connection has been layered on top of a plain socket connection.Note: 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.
- Specified by:
updatein interfaceOperatedClientConnection- Parameters:
sock- the new socket for communicating with the target host, ornullto continue using the old socket. Ifnullis 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-trueif this connection is now secure,falseif it is not secureparams- new parameters for this connection- Throws:
IOException
-
receiveResponseHeader
public org.apache.http.HttpResponse receiveResponseHeader() throws org.apache.http.HttpException, IOExceptionDeprecated.- Specified by:
receiveResponseHeaderin interfaceorg.apache.http.HttpClientConnection- Overrides:
receiveResponseHeaderin classorg.apache.http.impl.AbstractHttpClientConnection- Throws:
org.apache.http.HttpExceptionIOException
-
sendRequestHeader
public void sendRequestHeader(org.apache.http.HttpRequest request) throws org.apache.http.HttpException, IOException Deprecated.- Specified by:
sendRequestHeaderin interfaceorg.apache.http.HttpClientConnection- Overrides:
sendRequestHeaderin classorg.apache.http.impl.AbstractHttpClientConnection- Throws:
org.apache.http.HttpExceptionIOException
-
getAttribute
Deprecated.- Specified by:
getAttributein interfaceorg.apache.http.protocol.HttpContext
-
removeAttribute
Deprecated.- Specified by:
removeAttributein interfaceorg.apache.http.protocol.HttpContext
-
setAttribute
Deprecated.- Specified by:
setAttributein interfaceorg.apache.http.protocol.HttpContext
-
ManagedHttpClientConnectionFactory.