|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.http.impl.nio.NHttpConnectionBase
org.apache.http.impl.nio.DefaultNHttpServerConnection
public class DefaultNHttpServerConnection
Default implementation of the NHttpServerConnection
interface.
The following parameters can be used to customize the behavior of this class:
CoreProtocolPNames.HTTP_ELEMENT_CHARSET
CoreConnectionPNames.SOCKET_BUFFER_SIZE
CoreConnectionPNames.MAX_HEADER_COUNT
CoreConnectionPNames.MAX_LINE_LENGTH
Field Summary | |
---|---|
protected NHttpMessageParser<HttpRequest> |
requestParser
|
protected NHttpMessageWriter<HttpResponse> |
responseWriter
|
Fields inherited from class org.apache.http.impl.nio.NHttpConnectionBase |
---|
connMetrics, contentDecoder, contentEncoder, context, hasBufferedInput, hasBufferedOutput, inbuf, incomingContentStrategy, inTransportMetrics, outbuf, outgoingContentStrategy, outTransportMetrics, request, response, session, status |
Fields inherited from interface org.apache.http.nio.NHttpConnection |
---|
ACTIVE, CLOSED, CLOSING |
Constructor Summary | |
---|---|
DefaultNHttpServerConnection(IOSession session,
HttpRequestFactory requestFactory,
ByteBufferAllocator allocator,
HttpParams params)
Creates a new instance of this class given the underlying I/O session. |
Method Summary | |
---|---|
void |
consumeInput(NHttpServiceHandler handler)
Triggered when the connection is ready to consume input. |
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. |
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. |
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()
|
Methods inherited from class org.apache.http.impl.nio.NHttpConnectionBase |
---|
assertNotClosed, close, createConnectionMetrics, createContentDecoder, createContentEncoder, createTransportMetrics, getContext, getHttpRequest, getHttpResponse, getLocalAddress, getLocalPort, getMetrics, getRemoteAddress, getRemotePort, getSocketTimeout, getStatus, hasBufferedInput, hasBufferedOutput, isOpen, isStale, prepareDecoder, prepareEncoder, requestInput, requestOutput, setSocketTimeout, shutdown, suspendInput, suspendOutput |
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<HttpRequest> requestParser
protected final NHttpMessageWriter<HttpResponse> responseWriter
Constructor Detail |
---|
public DefaultNHttpServerConnection(IOSession session, HttpRequestFactory requestFactory, ByteBufferAllocator allocator, HttpParams params)
session
- the underlying I/O session.requestFactory
- HTTP request factory.allocator
- byte buffer allocator.params
- HTTP parameters.Method Detail |
---|
protected NHttpMessageParser<HttpRequest> createRequestParser(SessionInputBuffer buffer, HttpRequestFactory requestFactory, HttpParams params)
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.
protected NHttpMessageWriter<HttpResponse> createResponseWriter(SessionOutputBuffer buffer, HttpParams params)
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.
public void resetInput()
NHttpServerConnection
resetInput
in interface NHttpServerConnection
public void resetOutput()
NHttpServerConnection
resetOutput
in interface NHttpServerConnection
public void consumeInput(NHttpServiceHandler handler)
NHttpServerIOTarget
consumeInput
in interface NHttpServerIOTarget
handler
- the server protocol handler.public void produceOutput(NHttpServiceHandler handler)
NHttpServerIOTarget
produceOutput
in interface NHttpServerIOTarget
handler
- the server protocol handler.public void submitResponse(HttpResponse response) throws IOException, HttpException
NHttpServerConnection
submitResponse
in interface NHttpServerConnection
response
- HTTP response
IOException
- if I/O error occurs while submitting the response
HttpException
- if the HTTP response violates the HTTP protocol.public boolean isResponseSubmitted()
NHttpServerConnection
true
if an HTTP response has been submitted to the
client.
isResponseSubmitted
in interface NHttpServerConnection
true
if an HTTP response has been submitted,
false
otherwise.public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |