Package org.apache.http.impl
Class DefaultBHttpServerConnection
java.lang.Object
org.apache.http.impl.BHttpConnectionBase
org.apache.http.impl.DefaultBHttpServerConnection
- All Implemented Interfaces:
Closeable
,AutoCloseable
,HttpConnection
,HttpInetConnection
,HttpServerConnection
public class DefaultBHttpServerConnection
extends BHttpConnectionBase
implements HttpServerConnection
Default implementation of
HttpServerConnection
.- Since:
- 4.3
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultBHttpServerConnection
(int buffersize) 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.DefaultBHttpServerConnection
(int buffersize, CharsetDecoder chardecoder, CharsetEncoder charencoder, MessageConstraints constraints) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
flush()
Sends all pending buffered data over this connection.void
Receives the next request entity available from this connection and attaches it to an existing request.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.Methods inherited from class org.apache.http.impl.BHttpConnectionBase
close, getLocalAddress, getLocalPort, getMetrics, getRemoteAddress, getRemotePort, getSocketTimeout, isOpen, isStale, setSocketTimeout, shutdown, toString
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.http.HttpConnection
close, getMetrics, getSocketTimeout, isOpen, isStale, setSocketTimeout, shutdown
-
Constructor Details
-
DefaultBHttpServerConnection
public 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.- Parameters:
buffersize
- buffer size. Must be a positive number.fragmentSizeHint
- fragment size hint.chardecoder
- decoder to be used for decoding HTTP protocol elements. Ifnull
simple type cast will be used for byte to char conversion.charencoder
- encoder to be used for encoding HTTP protocol elements. Ifnull
simple type cast will be used for char to byte conversion.constraints
- Message constraints. Ifnull
MessageConstraints.DEFAULT
will be used.incomingContentStrategy
- incoming content length strategy. Ifnull
DisallowIdentityContentLengthStrategy.INSTANCE
will be used.outgoingContentStrategy
- outgoing content length strategy. Ifnull
StrictContentLengthStrategy.INSTANCE
will be used.requestParserFactory
- request parser factory. Ifnull
DefaultHttpRequestParserFactory.INSTANCE
will be used.responseWriterFactory
- response writer factory. Ifnull
DefaultHttpResponseWriterFactory.INSTANCE
will be used.
-
DefaultBHttpServerConnection
public DefaultBHttpServerConnection(int buffersize, CharsetDecoder chardecoder, CharsetEncoder charencoder, MessageConstraints constraints) -
DefaultBHttpServerConnection
public DefaultBHttpServerConnection(int buffersize)
-
-
Method Details
-
bind
- Throws:
IOException
-
receiveRequestHeader
Description copied from interface:HttpServerConnection
Receives the request line and all headers available from this connection. The caller should examine the returned request and decide if to receive a request entity as well.- Specified by:
receiveRequestHeader
in interfaceHttpServerConnection
- Returns:
- a new HttpRequest object whose request line and headers are initialized.
- Throws:
HttpException
- in case of HTTP protocol violationIOException
- in case of an I/O error
-
receiveRequestEntity
public void receiveRequestEntity(HttpEntityEnclosingRequest request) throws HttpException, IOException Description copied from interface:HttpServerConnection
Receives the next request entity available from this connection and attaches it to an existing request.- Specified by:
receiveRequestEntity
in interfaceHttpServerConnection
- Parameters:
request
- the request to attach the entity to.- Throws:
HttpException
- in case of HTTP protocol violationIOException
- in case of an I/O error
-
sendResponseHeader
Description copied from interface:HttpServerConnection
Sends the response line and headers of a response over this connection.- Specified by:
sendResponseHeader
in interfaceHttpServerConnection
- Parameters:
response
- the response whose headers to send.- Throws:
HttpException
- in case of HTTP protocol violationIOException
- in case of an I/O error
-
sendResponseEntity
Description copied from interface:HttpServerConnection
Sends the response entity of a response over this connection.- Specified by:
sendResponseEntity
in interfaceHttpServerConnection
- Parameters:
response
- the response whose entity to send.- Throws:
HttpException
- in case of HTTP protocol violationIOException
- in case of an I/O error
-
flush
Description copied from interface:HttpServerConnection
Sends all pending buffered data over this connection.- Specified by:
flush
in interfaceHttpServerConnection
- Throws:
IOException
- in case of an I/O error
-