public class

DefaultNHttpServerConnection

extends NHttpConnectionBase
implements NHttpServerIOTarget
java.lang.Object
   ↳ org.apache.http.impl.nio.NHttpConnectionBase
     ↳ org.apache.http.impl.nio.DefaultNHttpServerConnection

Class Overview

Default implementation of the NHttpServerConnection 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 NHttpMessageParser<HttpRequest> requestParser
protected final NHttpMessageWriter<HttpResponse> responseWriter
[Expand]
Inherited Fields
From class org.apache.http.impl.nio.NHttpConnectionBase
Public Constructors
DefaultNHttpServerConnection(IOSession session, HttpRequestFactory requestFactory, ByteBufferAllocator allocator, HttpParams params)
Creates a new instance of this class given the underlying I/O session.
Public Methods
void consumeInput(NHttpServiceHandler handler)
Triggered when the connection is ready to consume input.
boolean isResponseSubmitted()
Returns true if an HTTP response has been submitted to the client.
void produceOutput(NHttpServiceHandler handler)
Triggered when the connection is ready to produce output.
void resetInput()
Resets output state.
void resetOutput()
Resets input state.
void submitResponse(HttpResponse response)
Submits {link @HttpResponse} to be sent to the client.
String toString()
Protected Methods
NHttpMessageParser<HttpRequest> createRequestParser(SessionInputBuffer buffer, HttpRequestFactory requestFactory, HttpParams params)
Creates an instance of NHttpMessageParser to be used by this connection for parsing incoming HttpRequest messages.
NHttpMessageWriter<HttpResponse> createResponseWriter(SessionOutputBuffer buffer, HttpParams params)
Creates an instance of NHttpMessageWriter to be used by this connection for writing out outgoing 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.NHttpConnection
From interface org.apache.http.nio.NHttpServerConnection
From interface org.apache.http.nio.NHttpServerIOTarget
From interface org.apache.http.nio.reactor.SessionBufferStatus

Fields

protected final NHttpMessageParser<HttpRequest> requestParser

protected final NHttpMessageWriter<HttpResponse> responseWriter

Public Constructors

public DefaultNHttpServerConnection (IOSession session, HttpRequestFactory requestFactory, ByteBufferAllocator allocator, HttpParams params)

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

Parameters
session the underlying I/O session.
requestFactory HTTP request factory.
allocator byte buffer allocator.
params HTTP parameters.

Public Methods

public void consumeInput (NHttpServiceHandler handler)

Triggered when the connection is ready to consume input.

Parameters
handler the server protocol handler.

public boolean isResponseSubmitted ()

Returns true if an HTTP response has been submitted to the client.

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

public void produceOutput (NHttpServiceHandler handler)

Triggered when the connection is ready to produce output.

Parameters
handler the server protocol handler.

public void resetInput ()

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

public void resetOutput ()

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

public void submitResponse (HttpResponse response)

Submits {link @HttpResponse} to be sent to the client.

Parameters
response HTTP response
Throws
HttpException
IOException

public String toString ()

Protected Methods

protected NHttpMessageParser<HttpRequest> createRequestParser (SessionInputBuffer buffer, HttpRequestFactory requestFactory, HttpParams params)

Creates an instance of NHttpMessageParser to be used by this connection for parsing incoming HttpRequest 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.

protected NHttpMessageWriter<HttpResponse> createResponseWriter (SessionOutputBuffer buffer, HttpParams params)

Creates an instance of NHttpMessageWriter to be used by this connection for writing out outgoing HttpResponse 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.