Package org.apache.http.impl.conn
Class DefaultManagedHttpClientConnection
java.lang.Object
org.apache.http.impl.BHttpConnectionBase
org.apache.http.impl.DefaultBHttpClientConnection
org.apache.http.impl.conn.DefaultManagedHttpClientConnection
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ManagedHttpClientConnection
,HttpClientConnection
,HttpConnection
,HttpInetConnection
,HttpContext
public class DefaultManagedHttpClientConnection
extends DefaultBHttpClientConnection
implements ManagedHttpClientConnection, HttpContext
Default
ManagedHttpClientConnection
implementation.- Since:
- 4.3
-
Field Summary
Fields inherited from interface org.apache.http.protocol.HttpContext
RESERVED_PREFIX
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultManagedHttpClientConnection
(String id, int bufferSize) DefaultManagedHttpClientConnection
(String id, int bufferSize, int fragmentSizeHint, CharsetDecoder charDecoder, CharsetEncoder charEncoder, MessageConstraints constraints, ContentLengthStrategy incomingContentStrategy, ContentLengthStrategy outgoingContentStrategy, HttpMessageWriterFactory<HttpRequest> requestWriterFactory, HttpMessageParserFactory<HttpResponse> responseParserFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Binds this connection to the given socket.getAttribute
(String id) Obtains attribute with the given name.getId()
Returns connection ID which is expected to be unique for the life span of the connection manager.Returns the underlying socket.Obtains the SSL session of the underlying connection, if any.Removes attribute with the given name from the context.void
setAttribute
(String id, Object obj) Sets value of the attribute with the given name.void
shutdown()
Force-closes this connection.Methods inherited from class org.apache.http.impl.DefaultBHttpClientConnection
flush, isResponseAvailable, receiveResponseEntity, receiveResponseHeader, sendRequestEntity, sendRequestHeader
Methods inherited from class org.apache.http.impl.BHttpConnectionBase
close, getLocalAddress, getLocalPort, getMetrics, getRemoteAddress, getRemotePort, getSocketTimeout, isOpen, isStale, setSocketTimeout, toString
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.http.HttpClientConnection
flush, isResponseAvailable, receiveResponseEntity, receiveResponseHeader, sendRequestEntity, sendRequestHeader
Methods inherited from interface org.apache.http.HttpConnection
close, getMetrics, getSocketTimeout, isOpen, isStale, setSocketTimeout
Methods inherited from interface org.apache.http.HttpInetConnection
getLocalAddress, getLocalPort, getRemoteAddress, getRemotePort
-
Constructor Details
-
DefaultManagedHttpClientConnection
public DefaultManagedHttpClientConnection(String id, int bufferSize, int fragmentSizeHint, CharsetDecoder charDecoder, CharsetEncoder charEncoder, MessageConstraints constraints, ContentLengthStrategy incomingContentStrategy, ContentLengthStrategy outgoingContentStrategy, HttpMessageWriterFactory<HttpRequest> requestWriterFactory, HttpMessageParserFactory<HttpResponse> responseParserFactory) -
DefaultManagedHttpClientConnection
-
-
Method Details
-
getId
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
-
shutdown
Description copied from interface:HttpConnection
Force-closes this connection. This is the only method of a connection which may be called from a different thread to terminate the connection. This method will not attempt to flush the transmitter's internal buffer prior to closing the underlying socket.- Specified by:
shutdown
in interfaceHttpConnection
- Overrides:
shutdown
in classBHttpConnectionBase
- Throws:
IOException
-
getAttribute
Description copied from interface:HttpContext
Obtains attribute with the given name.- Specified by:
getAttribute
in interfaceHttpContext
- Parameters:
id
- the attribute name.- Returns:
- attribute value, or
null
if not set.
-
removeAttribute
Description copied from interface:HttpContext
Removes attribute with the given name from the context.- Specified by:
removeAttribute
in interfaceHttpContext
- Parameters:
id
- the attribute name.- Returns:
- attribute value, or
null
if not set.
-
setAttribute
Description copied from interface:HttpContext
Sets value of the attribute with the given name.- Specified by:
setAttribute
in interfaceHttpContext
- Parameters:
id
- the attribute name.obj
- the attribute value.
-
bind
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
- Overrides:
bind
in classDefaultBHttpClientConnection
- Parameters:
socket
- the socket to bind the connection to.- Throws:
IOException
-
getSocket
Description copied from interface:ManagedHttpClientConnection
Returns the underlying socket.- Specified by:
getSocket
in interfaceManagedHttpClientConnection
-
getSSLSession
Description copied from interface:ManagedHttpClientConnection
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.- Specified by:
getSSLSession
in interfaceManagedHttpClientConnection
- Returns:
- the underlying SSL session if available,
null
otherwise
-