Class DefaultBHttpServerConnection

    • Constructor Detail

      • DefaultBHttpServerConnection

        public DefaultBHttpServerConnection​(int bufferSize,
                                            java.nio.charset.CharsetDecoder charDecoder,
                                            java.nio.charset.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​(java.net.Socket socket)
                  throws java.io.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:
        java.io.IOException - in case of an I/O error.
      • receiveRequestHeader

        public HttpRequest receiveRequestHeader()
                                         throws HttpException,
                                                java.io.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
        java.io.IOException - in case of an I/O error
      • sendResponseHeader

        public void sendResponseHeader​(HttpResponse response)
                                throws HttpException,
                                       java.io.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
        java.io.IOException - in case of an I/O error
      • flush

        public void flush()
                   throws java.io.IOException
        Description copied from interface: HttpServerConnection
        Sends all pending buffered data over this connection.
        Specified by:
        flush in interface HttpServerConnection
        Throws:
        java.io.IOException - in case of an I/O error