Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.http.impl
Class DefaultBHttpServerConnection

    java.lang.Object
      org.apache.http.impl.BHttpConnectionBase
          org.apache.http.impl.DefaultBHttpServerConnection

All Implemented Interfaces:
  Closeable, HttpConnection, HttpInetConnection, HttpServerConnection

    public class DefaultBHttpServerConnection

extends BHttpConnectionBase
implements HttpServerConnection

Default implementation of `HttpServerConnection`.

Since:
  4.3

Constructor Summary
`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.

Method Summary
`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.

Methods inherited from class org.apache.http.impl.BHttpConnectionBase
`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`

Methods inherited from class java.lang.Object
`clone, equals, finalize, 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,
                                        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. 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.

### DefaultBHttpServerConnection

    public DefaultBHttpServerConnection(int bufferSize,
                                        CharsetDecoder charDecoder,
                                        CharsetEncoder charEncoder,
                                        MessageConstraints constraints)

### DefaultBHttpServerConnection

    public DefaultBHttpServerConnection(int bufferSize)

Method Detail

### onRequestReceived

    protected void onRequestReceived(HttpRequest request)

### onResponseSubmitted

    protected void onResponseSubmitted(HttpResponse response)

### bind

    public void bind(Socket socket)
              throws IOException

  Description copied from class: `BHttpConnectionBase`
  Binds this connection to the given `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`.

  Overrides:
    `bind` in class `BHttpConnectionBase`
  Parameters:
    `socket` - the socket.
  Throws:
    `IOException` - in case of an I/O error.

### receiveRequestHeader

    public HttpRequest receiveRequestHeader()
                                     throws HttpException,
                                            IOException

  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 interface `HttpServerConnection`
  Returns:
    a new HttpRequest object whose request line and headers are initialized.
  Throws:
    `HttpException` - in case of HTTP protocol violation
    `IOException` - 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 interface `HttpServerConnection`
  Parameters:
    `request` - the request to attach the entity to.
  Throws:
    `HttpException` - in case of HTTP protocol violation
    `IOException` - in case of an I/O error

### sendResponseHeader

    public void sendResponseHeader(HttpResponse response)
                            throws HttpException,
                                   IOException

  Description copied from interface: `HttpServerConnection`
  Sends the response line and headers of a response over this connection.

  Specified by:
    `sendResponseHeader` in interface `HttpServerConnection`
  Parameters:
    `response` - the response whose headers to send.
  Throws:
    `HttpException` - in case of HTTP protocol violation
    `IOException` - in case of an I/O error

### sendResponseEntity

    public void sendResponseEntity(HttpResponse response)
                            throws HttpException,
                                   IOException

  Description copied from interface: `HttpServerConnection`
  Sends the response entity of a response over this connection.

  Specified by:
    `sendResponseEntity` in interface `HttpServerConnection`
  Parameters:
    `response` - the response whose entity to send.
  Throws:
    `HttpException` - in case of HTTP protocol violation
    `IOException` - in case of an I/O error

### flush

    public void flush()
               throws IOException

  Description copied from interface: `HttpServerConnection`
  Sends all pending buffered data over this connection.

  Specified by:
    `flush` in interface `HttpServerConnection`
  Throws:
    `IOException` - in case of an I/O error

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.