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 TypeMethodDescriptionvoidvoidflush()Sends all pending buffered data over this connection.voidReceives 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.voidsendResponseEntity(HttpResponse response) Sends the response entity of a response over this connection.voidsendResponseHeader(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, toStringMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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. Ifnullsimple type cast will be used for byte to char conversion.charencoder- encoder to be used for encoding HTTP protocol elements. Ifnullsimple type cast will be used for char to byte conversion.constraints- Message constraints. IfnullMessageConstraints.DEFAULTwill be used.incomingContentStrategy- incoming content length strategy. IfnullDisallowIdentityContentLengthStrategy.INSTANCEwill be used.outgoingContentStrategy- outgoing content length strategy. IfnullStrictContentLengthStrategy.INSTANCEwill be used.requestParserFactory- request parser factory. IfnullDefaultHttpRequestParserFactory.INSTANCEwill be used.responseWriterFactory- response writer factory. IfnullDefaultHttpResponseWriterFactory.INSTANCEwill 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:HttpServerConnectionReceives 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:
receiveRequestHeaderin 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:HttpServerConnectionReceives the next request entity available from this connection and attaches it to an existing request.- Specified by:
receiveRequestEntityin 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:HttpServerConnectionSends the response line and headers of a response over this connection.- Specified by:
sendResponseHeaderin 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:HttpServerConnectionSends the response entity of a response over this connection.- Specified by:
sendResponseEntityin 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:HttpServerConnectionSends all pending buffered data over this connection.- Specified by:
flushin interfaceHttpServerConnection- Throws:
IOException- in case of an I/O error
-