Class HttpResponse

  • All Implemented Interfaces:
    java.io.Closeable , java.lang.AutoCloseable

    
    public abstract class HttpResponse
     implements Closeable
                        

    The type representing response of HttpRequest.

    The body of the HttpResponse is backed by an HTTP connection, the Http connections are limited resources. It is important to close the response body to avoid leaking of backing connection and associated resource, such leaking may ultimately cause the application to slow down or crash.

    HttpResponse implements Closeable, invoking Closeable.close will close the response body. The body must be closed by calling one of the following methods:

    • HttpResponse::close()

    • HttpResponse::getBodyAsByteArray()

    • HttpResponse::getBodyAsString()

    • HttpResponse::getBodyAsString(Charset)