Interface HTTPRequestBuilder.Response

    • Method Detail

      • getUri

        @NotNull
        URI getUri()
        Requested URI.
      • getContentStream

        @Nullable
        InputStream getContentStream()
                              throws IOException
        Return response content as InputStream. WARN: Each call returns the same stream. You do not have to close is
        Returns:
        response content as InputStream
        Throws:
        IOException - in case of IO exception while getting a response content.
      • getBodyAsString

        @Nullable
        String getBodyAsString()
                        throws IOException
        Return response content as String.
        Returns:
        response content as String
        Throws:
        IOException - in case of IO exception while getting a response content.
      • getBodyAsString

        @Nullable
        String getBodyAsString​(@Nullable
                               String defaultCharsetName)
                        throws IOException
        Return response content as String. Use defaultCharset if none is specified
        Parameters:
        defaultCharsetName - a charset to use if no charset is specified in the response header
        Returns:
        response content as String
        Throws:
        IOException - in case of IO exception while getting a response content.
      • getStatusCode

        int getStatusCode()
        Return response's status code.
      • getStatusText

        @NotNull
        String getStatusText()
        Return response's status text.
      • getHeader

        @Nullable
        String getHeader​(@NotNull
                         String headerName)
        Return header by its name.
        Parameters:
        headerName - name of header to search
        Returns:
        header with specified name or null if such header is not exists
      • getContentLength

        default long getContentLength()
        Return content length. In general it is a value from Content-Length header.
        Returns:
        content length or value below zero if we can not get it