public class DefaultBHttpServerConnection extends BHttpConnectionBase implements HttpServerConnection
HttpServerConnection
.Constructor and Description |
---|
DefaultBHttpServerConnection(int bufferSize) |
DefaultBHttpServerConnection(int bufferSize,
CharsetDecoder charDecoder,
CharsetEncoder charEncoder,
MessageConstraints constraints) |
DefaultBHttpServerConnection(int bufferSize,
int fragmentSizeHint,
CharsetDecoder charDecoder,
CharsetEncoder charEncoder,
MessageConstraints constraints,
ContentLengthStrategy incomingContentStrategy,
ContentLengthStrategy outgoingContentStrategy,
HttpMessageParserFactory<HttpRequest> requestParserFactory,
HttpMessageWriterFactory<HttpResponse> responseWriterFactory)
Creates new instance of DefaultBHttpServerConnection.
|
Modifier and Type | Method and Description |
---|---|
void |
bind(Socket socket)
Binds this connection to the given
Socket . |
void |
flush()
Sends all pending buffered data over this connection.
|
protected void |
onRequestReceived(HttpRequest request) |
protected void |
onResponseSubmitted(HttpResponse response) |
void |
receiveRequestEntity(HttpEntityEnclosingRequest request)
Receives the next request entity available from this connection and attaches it to
an existing request.
|
HttpRequest |
receiveRequestHeader()
Receives the request line and all headers available from this connection.
|
void |
sendResponseEntity(HttpResponse response)
Sends the response entity of a response over this connection.
|
void |
sendResponseHeader(HttpResponse response)
Sends the response line and headers of a response over this connection.
|
awaitInput, close, createInputStream, createOutputStream, doFlush, ensureOpen, getLocalAddress, getLocalPort, getMetrics, getRemoteAddress, getRemotePort, getSessionInputBuffer, getSessionOutputBuffer, getSocket, getSocketInputStream, getSocketOutputStream, getSocketTimeout, incrementRequestCount, incrementResponseCount, isOpen, isStale, prepareInput, prepareOutput, setSocketTimeout, shutdown, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
close, getMetrics, getSocketTimeout, isOpen, isStale, setSocketTimeout, shutdown
public DefaultBHttpServerConnection(int bufferSize, int fragmentSizeHint, CharsetDecoder charDecoder, CharsetEncoder charEncoder, MessageConstraints constraints, ContentLengthStrategy incomingContentStrategy, ContentLengthStrategy outgoingContentStrategy, HttpMessageParserFactory<HttpRequest> requestParserFactory, HttpMessageWriterFactory<HttpResponse> responseWriterFactory)
bufferSize
- buffer size. Must be a positive number.fragmentSizeHint
- fragment size hint.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
DisallowIdentityContentLengthStrategy.INSTANCE
will be used.outgoingContentStrategy
- outgoing content length strategy. If null
StrictContentLengthStrategy.INSTANCE
will be used.requestParserFactory
- request parser factory. If null
DefaultHttpRequestParserFactory.INSTANCE
will be used.responseWriterFactory
- response writer factory. If null
DefaultHttpResponseWriterFactory.INSTANCE
will be used.public DefaultBHttpServerConnection(int bufferSize, CharsetDecoder charDecoder, CharsetEncoder charEncoder, MessageConstraints constraints)
public DefaultBHttpServerConnection(int bufferSize)
protected void onRequestReceived(HttpRequest request)
protected void onResponseSubmitted(HttpResponse response)
public void bind(Socket socket) throws IOException
BHttpConnectionBase
Socket
. This socket will be
used by the connection to send and receive data.
After this method's execution the connection status will be reported
as open and the BHttpConnectionBase.isOpen()
will return true
.
bind
in class BHttpConnectionBase
socket
- the socket.IOException
- in case of an I/O error.public HttpRequest receiveRequestHeader() throws HttpException, IOException
HttpServerConnection
receiveRequestHeader
in interface HttpServerConnection
HttpException
- in case of HTTP protocol violationIOException
- in case of an I/O errorpublic void receiveRequestEntity(HttpEntityEnclosingRequest request) throws HttpException, IOException
HttpServerConnection
receiveRequestEntity
in interface HttpServerConnection
request
- the request to attach the entity to.HttpException
- in case of HTTP protocol violationIOException
- in case of an I/O errorpublic void sendResponseHeader(HttpResponse response) throws HttpException, IOException
HttpServerConnection
sendResponseHeader
in interface HttpServerConnection
response
- the response whose headers to send.HttpException
- in case of HTTP protocol violationIOException
- in case of an I/O errorpublic void sendResponseEntity(HttpResponse response) throws HttpException, IOException
HttpServerConnection
sendResponseEntity
in interface HttpServerConnection
response
- the response whose entity to send.HttpException
- in case of HTTP protocol violationIOException
- in case of an I/O errorpublic void flush() throws IOException
HttpServerConnection
flush
in interface HttpServerConnection
IOException
- in case of an I/O errorCopyright © 2005–2022 The Apache Software Foundation. All rights reserved.