|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.http.impl.AbstractHttpClientConnection
DefaultBHttpClientConnection
@Deprecated public abstract class AbstractHttpClientConnection
Abstract client-side HTTP connection capable of transmitting and receiving
data using arbitrary SessionInputBuffer
and
SessionOutputBuffer
implementations.
The following parameters can be used to customize the behavior of this class:
CoreProtocolPNames.STRICT_TRANSFER_ENCODING
CoreConnectionPNames.MAX_HEADER_COUNT
CoreConnectionPNames.MAX_LINE_LENGTH
Constructor Summary | |
---|---|
AbstractHttpClientConnection()
Deprecated. Creates an instance of this class. |
Method Summary | |
---|---|
protected abstract void |
assertOpen()
Deprecated. Asserts if the connection is open. |
protected HttpConnectionMetricsImpl |
createConnectionMetrics(HttpTransportMetrics inTransportMetric,
HttpTransportMetrics outTransportMetric)
Deprecated. |
protected EntityDeserializer |
createEntityDeserializer()
Deprecated. Creates an instance of EntityDeserializer with the
LaxContentLengthStrategy implementation to be used for
de-serializing entities received over this connection. |
protected EntitySerializer |
createEntitySerializer()
Deprecated. Creates an instance of EntitySerializer with the
StrictContentLengthStrategy implementation to be used for
serializing HTTP entities sent over this connection. |
protected HttpResponseFactory |
createHttpResponseFactory()
Deprecated. Creates an instance of DefaultHttpResponseFactory to be used
for creating HttpResponse objects received by over this
connection. |
protected HttpMessageWriter<HttpRequest> |
createRequestWriter(SessionOutputBuffer buffer,
HttpParams params)
Deprecated. Creates an instance of HttpMessageWriter to be used for
writing out HTTP requests sent over this connection. |
protected HttpMessageParser<HttpResponse> |
createResponseParser(SessionInputBuffer buffer,
HttpResponseFactory responseFactory,
HttpParams params)
Deprecated. Creates an instance of HttpMessageParser to be used for parsing
HTTP responses received over this connection. |
protected void |
doFlush()
Deprecated. |
void |
flush()
Deprecated. Writes out all pending buffered data over the open connection. |
HttpConnectionMetrics |
getMetrics()
Deprecated. Returns a collection of connection metrics. |
protected void |
init(SessionInputBuffer sessionInputBuffer,
SessionOutputBuffer sessionOutputBuffer,
HttpParams params)
Deprecated. Initializes this connection object with SessionInputBuffer and
SessionOutputBuffer instances to be used for sending and
receiving data. |
protected boolean |
isEof()
Deprecated. |
boolean |
isResponseAvailable(int timeout)
Deprecated. Checks if response data is available from the connection. |
boolean |
isStale()
Deprecated. Checks whether this connection has gone down. |
void |
receiveResponseEntity(HttpResponse response)
Deprecated. Receives the next response entity available from this connection and attaches it to an existing HttpResponse object. |
HttpResponse |
receiveResponseHeader()
Deprecated. Receives the request line and headers of the next response available from this connection. |
void |
sendRequestEntity(HttpEntityEnclosingRequest request)
Deprecated. Sends the request entity over the connection. |
void |
sendRequestHeader(HttpRequest request)
Deprecated. Sends the request line and all headers over the connection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.http.HttpConnection |
---|
close, getSocketTimeout, isOpen, setSocketTimeout, shutdown |
Constructor Detail |
---|
public AbstractHttpClientConnection()
This constructor will invoke createEntityDeserializer()
and createEntitySerializer()
methods in order to initialize
HTTP entity serializer and deserializer implementations for this
connection.
Method Detail |
---|
protected abstract void assertOpen() throws IllegalStateException
IllegalStateException
- if the connection is not open.protected EntityDeserializer createEntityDeserializer()
EntityDeserializer
with the
LaxContentLengthStrategy
implementation to be used for
de-serializing entities received over this connection.
This method can be overridden in a super class in order to create
instances of EntityDeserializer
using a custom
ContentLengthStrategy
.
protected EntitySerializer createEntitySerializer()
EntitySerializer
with the
StrictContentLengthStrategy
implementation to be used for
serializing HTTP entities sent over this connection.
This method can be overridden in a super class in order to create
instances of EntitySerializer
using a custom
ContentLengthStrategy
.
protected HttpResponseFactory createHttpResponseFactory()
DefaultHttpResponseFactory
to be used
for creating HttpResponse
objects received by over this
connection.
This method can be overridden in a super class in order to provide
a different implementation of the HttpResponseFactory
interface.
protected HttpMessageParser<HttpResponse> createResponseParser(SessionInputBuffer buffer, HttpResponseFactory responseFactory, HttpParams params)
HttpMessageParser
to be used for parsing
HTTP responses received over this connection.
This method can be overridden in a super class in order to provide
a different implementation of the HttpMessageParser
interface or
to pass a different implementation of the
LineParser
to the the
DefaultHttpResponseParser
constructor.
buffer
- the session input buffer.responseFactory
- the HTTP response factory.params
- HTTP parameters.
protected HttpMessageWriter<HttpRequest> createRequestWriter(SessionOutputBuffer buffer, HttpParams params)
HttpMessageWriter
to be used for
writing out HTTP requests sent over this connection.
This method can be overridden in a super class in order to provide
a different implementation of the HttpMessageWriter
interface or
to pass a different implementation of
LineFormatter
to the the default implementation
HttpRequestWriter
.
buffer
- the session output bufferparams
- HTTP parameters
protected HttpConnectionMetricsImpl createConnectionMetrics(HttpTransportMetrics inTransportMetric, HttpTransportMetrics outTransportMetric)
protected void init(SessionInputBuffer sessionInputBuffer, SessionOutputBuffer sessionOutputBuffer, HttpParams params)
SessionInputBuffer
and
SessionOutputBuffer
instances to be used for sending and
receiving data. These session buffers can be bound to any arbitrary
physical output medium.
This method will invoke createHttpResponseFactory()
,
createRequestWriter(SessionOutputBuffer, HttpParams)
and createResponseParser(SessionInputBuffer, HttpResponseFactory, HttpParams)
methods to initialize HTTP request writer and response parser for this
connection.
sessionInputBuffer
- the session input buffer.sessionOutputBuffer
- the session output buffer.params
- HTTP parameters.public boolean isResponseAvailable(int timeout) throws IOException
HttpClientConnection
isResponseAvailable
in interface HttpClientConnection
timeout
- the maximum time in milliseconds to wait for data
timeout
milliseconds.
IOException
- if an error happens on the connectionpublic void sendRequestHeader(HttpRequest request) throws HttpException, IOException
HttpClientConnection
sendRequestHeader
in interface HttpClientConnection
request
- the request whose headers to send.
HttpException
- in case of HTTP protocol violation
IOException
- in case of an I/O errorpublic void sendRequestEntity(HttpEntityEnclosingRequest request) throws HttpException, IOException
HttpClientConnection
sendRequestEntity
in interface HttpClientConnection
request
- the request whose entity to send.
HttpException
- in case of HTTP protocol violation
IOException
- in case of an I/O errorprotected void doFlush() throws IOException
IOException
public void flush() throws IOException
HttpClientConnection
flush
in interface HttpClientConnection
IOException
- in case of an I/O errorpublic HttpResponse receiveResponseHeader() throws HttpException, IOException
HttpClientConnection
receiveResponseHeader
in interface HttpClientConnection
HttpException
- in case of HTTP protocol violation
IOException
- in case of an I/O errorpublic void receiveResponseEntity(HttpResponse response) throws HttpException, IOException
HttpClientConnection
receiveResponseEntity
in interface HttpClientConnection
response
- the response to attach the entity to
HttpException
- in case of HTTP protocol violation
IOException
- in case of an I/O errorprotected boolean isEof()
public boolean isStale()
HttpConnection
isStale
in interface HttpConnection
true
if attempts to use this connection are
likely to succeed, or false
if they are likely
to fail and this connection should be closedpublic HttpConnectionMetrics getMetrics()
HttpConnection
getMetrics
in interface HttpConnection
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |