Package arc.util

Class Http.HttpResponse

java.lang.Object
arc.util.Http.HttpResponse
Enclosing class:
Http

public static class Http.HttpResponse extends Object
  • Constructor Details

  • Method Details

    • getContentLength

      public long getContentLength()
      Returns:
      the length of received content in bytes as a long. May throw an exception (?)
    • getResult

      public byte[] getResult()
      Returns the data of the HTTP response as a byte[].

      Note: This method may only be called once per response.

      Returns:
      the result as a byte[] or null in case of a timeout or if the operation was canceled/terminated abnormally. The timeout is specified when creating the HTTP request, with Http.HttpRequest.timeout(int)
    • getResultAsString

      public String getResultAsString()
      Returns the data of the HTTP response as a String.

      Note: This method may only be called once per response.

      Returns:
      the result as a string or null in case of a timeout or if the operation was canceled/terminated abnormally. The timeout is specified when creating the HTTP request, with Http.HttpRequest.timeout(int)
    • getResultAsStream

      public InputStream getResultAsStream()
      Returns the data of the HTTP response as an InputStream.
      Warning:
      Do not store a reference to this InputStream. The underlying HTTP connection will be closed after that callback finishes executing. Reading from the InputStream after it's connection has been closed will lead to exception.
      Returns:
      An InputStream with the Http.HttpResponse data.
    • getStatus

      public Http.HttpStatus getStatus()
      Returns:
      the Http.HttpStatus containing the statusCode of the HTTP response.
    • getHeader

      public String getHeader(String name)
      Returns:
      the value of the header with the given name as a String, or null if the header is not set.
    • getHeaders

      public ObjectMap<String,Seq<String>> getHeaders()
      Returns a Map of the headers. The keys are Strings that represent the header name. Each values is a List of Strings that represent the corresponding header values.