public class

DefaultNHttpClientConnection

extends NHttpConnectionBase
implements NHttpClientIOTarget
java.lang.Object
   ↳ org.apache.http.impl.nio.NHttpConnectionBase
     ↳ org.apache.http.impl.nio.DefaultNHttpClientConnection

Class Overview

Default implementation of the NHttpClientConnection interface.

The following parameters can be used to customize the behavior of this class:

Summary

[Expand]
Inherited Constants
From interface org.apache.http.nio.NHttpConnection
Fields
protected final NHttpMessageWriter<HttpRequest> requestWriter
protected final NHttpMessageParser<HttpResponse> responseParser
[Expand]
Inherited Fields
From class org.apache.http.impl.nio.NHttpConnectionBase
Public Constructors
DefaultNHttpClientConnection(IOSession session, HttpResponseFactory responseFactory, ByteBufferAllocator allocator, HttpParams params)
Creates a new instance of this class given the underlying I/O session.
Public Methods
void consumeInput(NHttpClientHandler handler)
Triggered when the connection is ready to consume input.
boolean isRequestSubmitted()
Returns true if an HTTP request has been submitted to the target server.
void produceOutput(NHttpClientHandler handler)
Triggered when the connection is ready to produce output.
void resetInput()
Resets output state.
void resetOutput()
Resets input state.
void submitRequest(HttpRequest request)
Submits HttpRequest to be sent to the target server.
String toString()
Protected Methods
NHttpMessageWriter<HttpRequest> createRequestWriter(SessionOutputBuffer buffer, HttpParams params)
Creates an instance of NHttpMessageWriter to be used by this connection for writing out outgoing HttpRequest messages.
NHttpMessageParser<HttpResponse> createResponseParser(SessionInputBuffer buffer, HttpResponseFactory responseFactory, HttpParams params)
Creates an instance of NHttpMessageParser to be used by this connection for parsing incoming HttpResponse messages.
[Expand]
Inherited Methods
From class org.apache.http.impl.nio.NHttpConnectionBase
From class java.lang.Object
From interface org.apache.http.HttpConnection
From interface org.apache.http.HttpInetConnection
From interface org.apache.http.nio.IOControl
From interface org.apache.http.nio.NHttpClientConnection
From interface org.apache.http.nio.NHttpClientIOTarget
From interface org.apache.http.nio.NHttpConnection
From interface org.apache.http.nio.reactor.SessionBufferStatus

Fields

protected final NHttpMessageWriter<HttpRequest> requestWriter

protected final NHttpMessageParser<HttpResponse> responseParser

Public Constructors

public DefaultNHttpClientConnection (IOSession session, HttpResponseFactory responseFactory, ByteBufferAllocator allocator, HttpParams params)

Creates a new instance of this class given the underlying I/O session.

Parameters
session the underlying I/O session.
responseFactory HTTP response factory.
allocator byte buffer allocator.
params HTTP parameters.

Public Methods

public void consumeInput (NHttpClientHandler handler)

Triggered when the connection is ready to consume input.

Parameters
handler the client protocol handler.

public boolean isRequestSubmitted ()

Returns true if an HTTP request has been submitted to the target server.

Returns
  • true if an HTTP request has been submitted, false otherwise.

public void produceOutput (NHttpClientHandler handler)

Triggered when the connection is ready to produce output.

Parameters
handler the client protocol handler.

public void resetInput ()

Resets output state. This method can be used to prematurely terminate processing of the incoming HTTP response.

public void resetOutput ()

Resets input state. This method can be used to prematurely terminate processing of the outgoing HTTP request.

public void submitRequest (HttpRequest request)

Submits HttpRequest to be sent to the target server.

Parameters
request HTTP request
Throws
HttpException
IOException

public String toString ()

Protected Methods

protected NHttpMessageWriter<HttpRequest> createRequestWriter (SessionOutputBuffer buffer, HttpParams params)

Creates an instance of 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.

Returns
  • HTTP response parser.

protected NHttpMessageParser<HttpResponse> createResponseParser (SessionInputBuffer buffer, HttpResponseFactory responseFactory, HttpParams params)

Creates an instance of 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.

Returns
  • HTTP response parser.