org.apache.http.impl
Class DefaultBHttpClientConnection

java.lang.Object
  extended by org.apache.http.impl.BHttpConnectionBase
      extended by org.apache.http.impl.DefaultBHttpClientConnection
All Implemented Interfaces:
org.apache.http.HttpClientConnection, org.apache.http.HttpConnection, org.apache.http.HttpInetConnection
Direct Known Subclasses:
DefaultManagedHttpClientConnection

@NotThreadSafe
public class DefaultBHttpClientConnection
extends BHttpConnectionBase
implements org.apache.http.HttpClientConnection

Default implementation of HttpClientConnection.

Since:
4.3

Constructor Summary
DefaultBHttpClientConnection(int buffersize)
           
DefaultBHttpClientConnection(int buffersize, java.nio.charset.CharsetDecoder chardecoder, java.nio.charset.CharsetEncoder charencoder, MessageConstraints constraints)
           
DefaultBHttpClientConnection(int buffersize, int fragmentSizeHint, java.nio.charset.CharsetDecoder chardecoder, java.nio.charset.CharsetEncoder charencoder, MessageConstraints constraints, org.apache.http.entity.ContentLengthStrategy incomingContentStrategy, org.apache.http.entity.ContentLengthStrategy outgoingContentStrategy, HttpMessageWriterFactory<org.apache.http.HttpRequest> requestWriterFactory, HttpMessageParserFactory<org.apache.http.HttpResponse> responseParserFactory)
          Creates new instance of DefaultBHttpClientConnection.
 
Method Summary
 void bind(java.net.Socket socket)
          Binds this connection to the given Socket.
 void flush()
           
 boolean isResponseAvailable(int timeout)
           
protected  void onRequestSubmitted(org.apache.http.HttpRequest request)
           
protected  void onResponseReceived(org.apache.http.HttpResponse response)
           
 void receiveResponseEntity(org.apache.http.HttpResponse response)
           
 org.apache.http.HttpResponse receiveResponseHeader()
           
 void sendRequestEntity(org.apache.http.HttpEntityEnclosingRequest request)
           
 void sendRequestHeader(org.apache.http.HttpRequest request)
           
 
Methods inherited from class org.apache.http.impl.BHttpConnectionBase
awaitInput, close, createInputStream, createOutputStream, doFlush, ensureOpen, getLocalAddress, getLocalPort, getMetrics, getRemoteAddress, getRemotePort, getSessionInputBuffer, getSessionOutputBuffer, getSocket, getSocketInputStream, getSocketOutputStream, getSocketTimeout, incrementRequestCount, incrementResponseCount, isOpen, isStale, prepareInput, prepareOutput, setSocketTimeout, shutdown, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.http.HttpConnection
close, getMetrics, getSocketTimeout, isOpen, isStale, setSocketTimeout, shutdown
 

Constructor Detail

DefaultBHttpClientConnection

public DefaultBHttpClientConnection(int buffersize,
                                    int fragmentSizeHint,
                                    java.nio.charset.CharsetDecoder chardecoder,
                                    java.nio.charset.CharsetEncoder charencoder,
                                    MessageConstraints constraints,
                                    org.apache.http.entity.ContentLengthStrategy incomingContentStrategy,
                                    org.apache.http.entity.ContentLengthStrategy outgoingContentStrategy,
                                    HttpMessageWriterFactory<org.apache.http.HttpRequest> requestWriterFactory,
                                    HttpMessageParserFactory<org.apache.http.HttpResponse> responseParserFactory)
Creates new instance of DefaultBHttpClientConnection.

Parameters:
buffersize - buffer size. Must be a positive number.
fragmentSizeHint - fragment size hint.
chardecoder - decoder to be used for decoding HTTP protocol elements. If null simple type cast will be used for byte to char conversion.
charencoder - encoder to be used for encoding HTTP protocol elements. If null simple type cast will be used for char to byte conversion.
constraints - Message constraints. If null MessageConstraints.DEFAULT will be used.
incomingContentStrategy - incoming content length strategy. If null LaxContentLengthStrategyHC4.INSTANCE will be used.
outgoingContentStrategy - outgoing content length strategy. If null StrictContentLengthStrategyHC4.INSTANCE will be used.
requestWriterFactory - request writer factory. If null DefaultHttpRequestWriterFactory.INSTANCE will be used.
responseParserFactory - response parser factory. If null DefaultHttpResponseParserFactory.INSTANCE will be used.

DefaultBHttpClientConnection

public DefaultBHttpClientConnection(int buffersize,
                                    java.nio.charset.CharsetDecoder chardecoder,
                                    java.nio.charset.CharsetEncoder charencoder,
                                    MessageConstraints constraints)

DefaultBHttpClientConnection

public DefaultBHttpClientConnection(int buffersize)
Method Detail

onResponseReceived

protected void onResponseReceived(org.apache.http.HttpResponse response)

onRequestSubmitted

protected void onRequestSubmitted(org.apache.http.HttpRequest request)

bind

public void bind(java.net.Socket socket)
          throws java.io.IOException
Description copied from class: BHttpConnectionBase
Binds this connection to the given Socket. This socket will be used by the connection to send and receive data.

After this method's execution the connection status will be reported as open and the BHttpConnectionBase.isOpen() will return true.

Overrides:
bind in class BHttpConnectionBase
Parameters:
socket - the socket.
Throws:
java.io.IOException - in case of an I/O error.

isResponseAvailable

public boolean isResponseAvailable(int timeout)
                            throws java.io.IOException
Specified by:
isResponseAvailable in interface org.apache.http.HttpClientConnection
Throws:
java.io.IOException

sendRequestHeader

public void sendRequestHeader(org.apache.http.HttpRequest request)
                       throws org.apache.http.HttpException,
                              java.io.IOException
Specified by:
sendRequestHeader in interface org.apache.http.HttpClientConnection
Throws:
org.apache.http.HttpException
java.io.IOException

sendRequestEntity

public void sendRequestEntity(org.apache.http.HttpEntityEnclosingRequest request)
                       throws org.apache.http.HttpException,
                              java.io.IOException
Specified by:
sendRequestEntity in interface org.apache.http.HttpClientConnection
Throws:
org.apache.http.HttpException
java.io.IOException

receiveResponseHeader

public org.apache.http.HttpResponse receiveResponseHeader()
                                                   throws org.apache.http.HttpException,
                                                          java.io.IOException
Specified by:
receiveResponseHeader in interface org.apache.http.HttpClientConnection
Throws:
org.apache.http.HttpException
java.io.IOException

receiveResponseEntity

public void receiveResponseEntity(org.apache.http.HttpResponse response)
                           throws org.apache.http.HttpException,
                                  java.io.IOException
Specified by:
receiveResponseEntity in interface org.apache.http.HttpClientConnection
Throws:
org.apache.http.HttpException
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface org.apache.http.HttpClientConnection
Throws:
java.io.IOException