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:
java.io.Closeable,java.lang.AutoCloseable,ManagedHttpClientConnection,HttpClientConnection,HttpConnection,HttpInetConnection,HttpContext
public class DefaultManagedHttpClientConnection extends DefaultBHttpClientConnection implements ManagedHttpClientConnection, HttpContext
DefaultManagedHttpClientConnectionimplementation.- Since:
- 4.3
-
-
Field Summary
-
Fields inherited from interface org.apache.http.protocol.HttpContext
RESERVED_PREFIX
-
-
Constructor Summary
Constructors Constructor Description DefaultManagedHttpClientConnection(java.lang.String id, int bufferSize)DefaultManagedHttpClientConnection(java.lang.String id, int bufferSize, int fragmentSizeHint, java.nio.charset.CharsetDecoder charDecoder, java.nio.charset.CharsetEncoder charEncoder, MessageConstraints constraints, ContentLengthStrategy incomingContentStrategy, ContentLengthStrategy outgoingContentStrategy, HttpMessageWriterFactory<HttpRequest> requestWriterFactory, HttpMessageParserFactory<HttpResponse> responseParserFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbind(java.net.Socket socket)Binds this connection to the given socket.java.lang.ObjectgetAttribute(java.lang.String id)Obtains attribute with the given name.java.lang.StringgetId()Returns connection ID which is expected to be unique for the life span of the connection manager.java.net.SocketgetSocket()Returns the underlying socket.javax.net.ssl.SSLSessiongetSSLSession()Obtains the SSL session of the underlying connection, if any.java.lang.ObjectremoveAttribute(java.lang.String id)Removes attribute with the given name from the context.voidsetAttribute(java.lang.String id, java.lang.Object obj)Sets value of the attribute with the given name.voidshutdown()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 Detail
-
DefaultManagedHttpClientConnection
public DefaultManagedHttpClientConnection(java.lang.String id, int bufferSize, int fragmentSizeHint, java.nio.charset.CharsetDecoder charDecoder, java.nio.charset.CharsetEncoder charEncoder, MessageConstraints constraints, ContentLengthStrategy incomingContentStrategy, ContentLengthStrategy outgoingContentStrategy, HttpMessageWriterFactory<HttpRequest> requestWriterFactory, HttpMessageParserFactory<HttpResponse> responseParserFactory)
-
DefaultManagedHttpClientConnection
public DefaultManagedHttpClientConnection(java.lang.String id, int bufferSize)
-
-
Method Detail
-
getId
public java.lang.String getId()
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
-
shutdown
public void shutdown() throws java.io.IOExceptionDescription copied from interface:HttpConnectionForce-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:
shutdownin interfaceHttpConnection- Overrides:
shutdownin classBHttpConnectionBase- Throws:
java.io.IOException
-
getAttribute
public java.lang.Object getAttribute(java.lang.String id)
Description copied from interface:HttpContextObtains attribute with the given name.- Specified by:
getAttributein interfaceHttpContext- Parameters:
id- the attribute name.- Returns:
- attribute value, or
nullif not set.
-
removeAttribute
public java.lang.Object removeAttribute(java.lang.String id)
Description copied from interface:HttpContextRemoves attribute with the given name from the context.- Specified by:
removeAttributein interfaceHttpContext- Parameters:
id- the attribute name.- Returns:
- attribute value, or
nullif not set.
-
setAttribute
public void setAttribute(java.lang.String id, java.lang.Object obj)Description copied from interface:HttpContextSets value of the attribute with the given name.- Specified by:
setAttributein interfaceHttpContext- Parameters:
id- the attribute name.obj- the attribute value.
-
bind
public void bind(java.net.Socket socket) throws java.io.IOExceptionDescription 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- Overrides:
bindin classDefaultBHttpClientConnection- Parameters:
socket- the socket to bind the connection to.- Throws:
java.io.IOException
-
getSocket
public java.net.Socket getSocket()
Description copied from interface:ManagedHttpClientConnectionReturns the underlying socket.- Specified by:
getSocketin interfaceManagedHttpClientConnection
-
getSSLSession
public javax.net.ssl.SSLSession getSSLSession()
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
-
-