org.apache.http.HttpConnection implementations
and provides functionality common to both client and server HTTP connections.
| Modifier and Type | Field and Description |
|---|---|
| private final HttpConnectionMetricsImpl | |
| private final SessionInputBufferImpl | |
| private final ContentLengthStrategy | |
| private final MessageConstraints | |
| private final SessionOutputBufferImpl | |
| private final ContentLengthStrategy | |
| private final AtomicReference |
| Access | Constructor and Description |
|---|---|
| protected | BHttpConnectionBase(final int
buffer size. Must be a positive number. bufferSize, final int fragment size hint. fragmentSizeHint, final CharsetDecoder decoder to be used for decoding HTTP protocol elements.
If charDecoder, final CharsetEncoder null simple type cast will be used for byte to char conversion.encoder to be used for encoding HTTP protocol elements.
If charEncoder, final MessageConstraints null simple type cast will be used for char to byte conversion.Message constraints. If messageConstraints, final ContentLengthStrategy null
MessageConstraints#DEFAULT will be used.incoming content length strategy. If incomingContentStrategy, final ContentLengthStrategy null
LaxContentLengthStrategy#INSTANCE will be used.outgoing content length strategy. If outgoingContentStrategy)null
StrictContentLengthStrategy#INSTANCE will be used.Creates new instance of BHttpConnectionBase. |
| Modifier and Type | Method and Description |
|---|---|
| protected boolean | |
| protected void | |
| public void | |
| protected InputStream | |
| protected OutputStream | |
| protected void | |
| protected void | |
| private int | |
| public InetAddress | |
| public int | |
| public HttpConnectionMetrics | getMetrics()
Implements org. |
| public InetAddress | |
| public int | |
| protected SessionInputBuffer | |
| protected SessionOutputBuffer | |
| protected Socket | |
| protected InputStream | |
| protected OutputStream | |
| public int | getSocketTimeout()
Implements org. |
| protected void | |
| protected void | |
| public boolean | |
| public boolean | isStale()
Implements org. |
| protected HttpEntity | |
| protected OutputStream | |
| public void | setSocketTimeout(final int
timeout value in milliseconds timeout)Implements org. |
| public void | |
| public String |
| connMetrics | back to summary |
|---|---|
| private final HttpConnectionMetricsImpl connMetrics | |
| inBuffer | back to summary |
|---|---|
| private final SessionInputBufferImpl inBuffer | |
| incomingContentStrategy | back to summary |
|---|---|
| private final ContentLengthStrategy incomingContentStrategy | |
| messageConstraints | back to summary |
|---|---|
| private final MessageConstraints messageConstraints | |
| outbuffer | back to summary |
|---|---|
| private final SessionOutputBufferImpl outbuffer | |
| outgoingContentStrategy | back to summary |
|---|---|
| private final ContentLengthStrategy outgoingContentStrategy | |
| socketHolder | back to summary |
|---|---|
| private final AtomicReference<Socket> socketHolder | |
| BHttpConnectionBase | back to summary |
|---|---|
| protected BHttpConnectionBase(final int bufferSize, final int fragmentSizeHint, final CharsetDecoder charDecoder, final CharsetEncoder charEncoder, final MessageConstraints messageConstraints, final ContentLengthStrategy incomingContentStrategy, final ContentLengthStrategy outgoingContentStrategy) Creates new instance of BHttpConnectionBase.
| |
| awaitInput | back to summary |
|---|---|
| protected boolean awaitInput(final int timeout) throws IOException | |
| bind | back to summary |
|---|---|
| protected void bind(final Socket socket) throws IOException Binds this connection to the given
After this method's execution the connection status will be reported
as open and the
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Implements org. Doc from org. Closes this connection gracefully.
This method will attempt to flush the internal output
buffer prior to closing the underlying socket.
This method MUST NOT be called from a different thread to force
shutdown of the connection. Use
| |
| createInputStream | back to summary |
|---|---|
| protected InputStream createInputStream(final long len, final SessionInputBuffer inBuffer) | |
| createOutputStream | back to summary |
|---|---|
| protected OutputStream createOutputStream(final long len, final SessionOutputBuffer outbuffer) | |
| doFlush | back to summary |
|---|---|
| protected void doFlush() throws IOException | |
| ensureOpen | back to summary |
|---|---|
| protected void ensureOpen() throws IOException | |
| fillInputBuffer | back to summary |
|---|---|
| private int fillInputBuffer(final int timeout) throws IOException | |
| getLocalAddress | back to summary |
|---|---|
| public InetAddress getLocalAddress() Implements org.
| |
| getLocalPort | back to summary |
|---|---|
| public int getLocalPort() Implements org.
| |
| getMetrics | back to summary |
|---|---|
| public HttpConnectionMetrics getMetrics() Implements org. Doc from org. Returns a collection of connection metrics.
| |
| getRemoteAddress | back to summary |
|---|---|
| public InetAddress getRemoteAddress() Implements org.
| |
| getRemotePort | back to summary |
|---|---|
| public int getRemotePort() Implements org.
| |
| getSessionInputBuffer | back to summary |
|---|---|
| protected SessionInputBuffer getSessionInputBuffer() | |
| getSessionOutputBuffer | back to summary |
|---|---|
| protected SessionOutputBuffer getSessionOutputBuffer() | |
| getSocket | back to summary |
|---|---|
| protected Socket getSocket() | |
| getSocketInputStream | back to summary |
|---|---|
| protected InputStream getSocketInputStream(final Socket socket) throws IOException | |
| getSocketOutputStream | back to summary |
|---|---|
| protected OutputStream getSocketOutputStream(final Socket socket) throws IOException | |
| getSocketTimeout | back to summary |
|---|---|
| public int getSocketTimeout() Implements org. Doc from org. Returns the socket timeout value.
| |
| incrementRequestCount | back to summary |
|---|---|
| protected void incrementRequestCount() | |
| incrementResponseCount | back to summary |
|---|---|
| protected void incrementResponseCount() | |
| isOpen | back to summary |
|---|---|
| public boolean isOpen() Implements org. Doc from org. Checks if this connection is open.
| |
| isStale | back to summary |
|---|---|
| public boolean isStale() Implements org. Doc from org. Checks whether this connection has gone down. Network connections may get closed during some time of inactivity for several reasons. The next time a read is attempted on such a connection it will throw an IOException. This method tries to alleviate this inconvenience by trying to find out if a connection is still usable. Implementations may do that by attempting a read with a very small timeout. Thus this method may block for a small amount of time before returning a result. It is therefore an expensive operation.
| |
| prepareInput | back to summary |
|---|---|
| protected HttpEntity prepareInput(final HttpMessage message) throws HttpException | |
| prepareOutput | back to summary |
|---|---|
| protected OutputStream prepareOutput(final HttpMessage message) throws HttpException | |
| setSocketTimeout | back to summary |
|---|---|
| public void setSocketTimeout(final int timeout) Implements org. Doc from org. Sets the socket timeout value.
| |
| shutdown | back to summary |
|---|---|
| public void shutdown() throws IOException Implements org. Doc from org. 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.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |