Class AbstractConnectionHandler

    • Constructor Detail

      • AbstractConnectionHandler

        public AbstractConnectionHandler()
    • Method Detail

      • readInFirstLine

        protected java.lang.String readInFirstLine​(java.io.BufferedReader br,
                                                   HttpRequest request)
                                            throws java.io.IOException
        Read the first line
        Parameters:
        br - the reader
        request - the request
        Returns:
        the first line
        Throws:
        java.io.IOException - In case of an I/O error
      • readInBody

        protected java.lang.String readInBody​(java.io.BufferedReader reader,
                                              int contentLength)
                                       throws java.io.IOException
        Read in the body
        Parameters:
        reader - the reader
        contentLength - the content length
        Returns:
        the body
        Throws:
        java.io.IOException - In case of an I/O error
      • createHttpResponse

        protected IHttpResponse createHttpResponse​(IHttpRequest request)
        create a http response
        Parameters:
        request - the reuqest
        Returns:
        the response object
      • getStatusLineAndHeaders

        protected java.lang.String getStatusLineAndHeaders​(IHttpResponse response)
        Get the status line and headers
        Parameters:
        response - the http response
        Returns:
        the status line and headers
      • getBodyAsByteArray

        protected java.lang.String getBodyAsByteArray​(IHttpResponse response)
        Get the body as byte array
        Parameters:
        response - the http response
        Returns:
        the body as byte array