Package org.apache.http.impl
Class DefaultBHttpServerConnection
- java.lang.Object
-
- org.apache.http.impl.BHttpConnectionBase
-
- org.apache.http.impl.DefaultBHttpServerConnection
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,HttpConnection,HttpInetConnection,HttpServerConnection
public class DefaultBHttpServerConnection extends BHttpConnectionBase implements HttpServerConnection
Default implementation ofHttpServerConnection.- Since:
- 4.3
-
-
Constructor Summary
Constructors Constructor Description DefaultBHttpServerConnection(int buffersize)DefaultBHttpServerConnection(int buffersize, int fragmentSizeHint, java.nio.charset.CharsetDecoder chardecoder, java.nio.charset.CharsetEncoder charencoder, MessageConstraints constraints, ContentLengthStrategy incomingContentStrategy, ContentLengthStrategy outgoingContentStrategy, HttpMessageParserFactory<HttpRequest> requestParserFactory, HttpMessageWriterFactory<HttpResponse> responseWriterFactory)Creates new instance of DefaultBHttpServerConnection.DefaultBHttpServerConnection(int buffersize, java.nio.charset.CharsetDecoder chardecoder, java.nio.charset.CharsetEncoder charencoder, MessageConstraints constraints)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbind(java.net.Socket socket)voidflush()Sends all pending buffered data over this connection.voidreceiveRequestEntity(HttpEntityEnclosingRequest request)Receives the next request entity available from this connection and attaches it to an existing request.HttpRequestreceiveRequestHeader()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, 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 Detail
-
DefaultBHttpServerConnection
public DefaultBHttpServerConnection(int buffersize, int fragmentSizeHint, java.nio.charset.CharsetDecoder chardecoder, java.nio.charset.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, java.nio.charset.CharsetDecoder chardecoder, java.nio.charset.CharsetEncoder charencoder, MessageConstraints constraints)
-
DefaultBHttpServerConnection
public DefaultBHttpServerConnection(int buffersize)
-
-
Method Detail
-
bind
public void bind(java.net.Socket socket) throws java.io.IOException- Throws:
java.io.IOException
-
receiveRequestHeader
public HttpRequest receiveRequestHeader() throws HttpException, java.io.IOException
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 violationjava.io.IOException- in case of an I/O error
-
receiveRequestEntity
public void receiveRequestEntity(HttpEntityEnclosingRequest request) throws HttpException, java.io.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 violationjava.io.IOException- in case of an I/O error
-
sendResponseHeader
public void sendResponseHeader(HttpResponse response) throws HttpException, java.io.IOException
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 violationjava.io.IOException- in case of an I/O error
-
sendResponseEntity
public void sendResponseEntity(HttpResponse response) throws HttpException, java.io.IOException
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 violationjava.io.IOException- in case of an I/O error
-
flush
public void flush() throws java.io.IOExceptionDescription copied from interface:HttpServerConnectionSends all pending buffered data over this connection.- Specified by:
flushin interfaceHttpServerConnection- Throws:
java.io.IOException- in case of an I/O error
-
-