|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.http.impl.nio.NHttpConnectionBase org.apache.http.impl.nio.DefaultNHttpClientConnection
public class DefaultNHttpClientConnection
Default implementation of the NHttpClientConnection
interface.
Field Summary | |
---|---|
protected NHttpMessageWriter<HttpRequest> |
requestWriter
|
protected NHttpMessageParser<HttpResponse> |
responseParser
|
Fields inherited from class org.apache.http.impl.nio.NHttpConnectionBase |
---|
connMetrics, contentDecoder, contentEncoder, context, hasBufferedInput, hasBufferedOutput, inbuf, incomingContentStrategy, inTransportMetrics, outbuf, outgoingContentStrategy, outTransportMetrics, remote, request, response, session, status |
Fields inherited from interface org.apache.http.nio.NHttpConnection |
---|
ACTIVE, CLOSED, CLOSING |
Method Summary | |
---|---|
void |
consumeInput(NHttpClientEventHandler handler)
|
void |
consumeInput(NHttpClientHandler handler)
Triggered when the connection is ready to consume input. |
protected NHttpMessageWriter<HttpRequest> |
createRequestWriter(SessionOutputBuffer buffer,
HttpParams params)
Deprecated. (4.3) use constructor. |
protected NHttpMessageParser<HttpResponse> |
createResponseParser(SessionInputBuffer buffer,
HttpResponseFactory responseFactory,
HttpParams params)
Deprecated. (4.3) use constructor. |
boolean |
isRequestSubmitted()
Returns true if an HTTP request has been submitted to the
target server. |
protected void |
onRequestSubmitted(HttpRequest request)
|
protected void |
onResponseReceived(HttpResponse response)
|
void |
produceOutput(NHttpClientEventHandler handler)
|
void |
produceOutput(NHttpClientHandler handler)
Triggered when the connection is ready to produce output. |
void |
resetInput()
Resets input state. |
void |
resetOutput()
Resets output state. |
void |
submitRequest(HttpRequest request)
Submits HttpRequest to be sent to the target server. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.http.nio.NHttpConnection |
---|
getContext, getHttpRequest, getHttpResponse, getStatus |
Methods inherited from interface org.apache.http.HttpConnection |
---|
close, getMetrics, getSocketTimeout, isOpen, isStale, setSocketTimeout, shutdown |
Methods inherited from interface org.apache.http.nio.IOControl |
---|
requestInput, requestOutput, shutdown, suspendInput, suspendOutput |
Field Detail |
---|
protected final NHttpMessageParser<HttpResponse> responseParser
protected final NHttpMessageWriter<HttpRequest> requestWriter
Constructor Detail |
---|
@Deprecated public DefaultNHttpClientConnection(IOSession session, HttpResponseFactory responseFactory, ByteBufferAllocator allocator, HttpParams params)
DefaultNHttpClientConnection(
IOSession, int, int, ByteBufferAllocator, CharsetDecoder, CharsetEncoder,
MessageConstraints, ContentLengthStrategy, ContentLengthStrategy,
NHttpMessageWriterFactory, NHttpMessageParserFactory)
session
- the underlying I/O session.responseFactory
- HTTP response factory.allocator
- byte buffer allocator.params
- HTTP parameters.public DefaultNHttpClientConnection(IOSession session, int bufferSize, int fragmentSizeHint, ByteBufferAllocator allocator, CharsetDecoder charDecoder, CharsetEncoder charEncoder, MessageConstraints constraints, ContentLengthStrategy incomingContentStrategy, ContentLengthStrategy outgoingContentStrategy, NHttpMessageWriterFactory<HttpRequest> requestWriterFactory, NHttpMessageParserFactory<HttpResponse> responseParserFactory)
session
- the underlying I/O session.bufferSize
- buffer size. Must be a positive number.fragmentSizeHint
- fragment size hint.allocator
- memory allocator.
If null
HeapByteBufferAllocator.INSTANCE
will be used.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
LaxContentLengthStrategy.INSTANCE
will be used.outgoingContentStrategy
- outgoing content length strategy. If null
StrictContentLengthStrategy.INSTANCE
will be used.public DefaultNHttpClientConnection(IOSession session, int bufferSize, CharsetDecoder charDecoder, CharsetEncoder charEncoder, MessageConstraints constraints)
public DefaultNHttpClientConnection(IOSession session, int bufferSize)
Method Detail |
---|
@Deprecated protected NHttpMessageParser<HttpResponse> createResponseParser(SessionInputBuffer buffer, HttpResponseFactory responseFactory, HttpParams params)
NHttpMessageParser
to be used
by this connection for parsing incoming HttpResponse
messages.
This method can be overridden in a super class in order to provide
a different implementation of the NHttpMessageParser
interface.
@Deprecated protected NHttpMessageWriter<HttpRequest> createRequestWriter(SessionOutputBuffer buffer, HttpParams params)
NHttpMessageWriter
to be used
by this connection for writing out outgoing HttpRequest
messages.
This method can be overridden by a super class in order to provide
a different implementation of the NHttpMessageWriter
interface.
protected void onResponseReceived(HttpResponse response)
protected void onRequestSubmitted(HttpRequest request)
public void resetInput()
NHttpClientConnection
resetInput
in interface NHttpClientConnection
public void resetOutput()
NHttpClientConnection
resetOutput
in interface NHttpClientConnection
public void consumeInput(NHttpClientEventHandler handler)
public void produceOutput(NHttpClientEventHandler handler)
public void submitRequest(HttpRequest request) throws IOException, HttpException
NHttpClientConnection
HttpRequest
to be sent to the target server.
submitRequest
in interface NHttpClientConnection
request
- HTTP request
IOException
- if I/O error occurs while submitting the request
HttpException
- if the HTTP request violates the HTTP protocol.public boolean isRequestSubmitted()
NHttpClientConnection
true
if an HTTP request has been submitted to the
target server.
isRequestSubmitted
in interface NHttpClientConnection
true
if an HTTP request has been submitted,
false
otherwise.public void consumeInput(NHttpClientHandler handler)
NHttpClientIOTarget
consumeInput
in interface NHttpClientIOTarget
handler
- the client protocol handler.public void produceOutput(NHttpClientHandler handler)
NHttpClientIOTarget
produceOutput
in interface NHttpClientIOTarget
handler
- the client protocol handler.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |