Class Response

java.lang.Object
org.apache.hadoop.hbase.rest.client.Response

@Public public class Response extends Object
The HTTP result code, response headers, and body of an HTTP response.
  • Field Details

    • LOG

      private static final org.slf4j.Logger LOG
    • code

      private int code
    • headers

      private org.apache.http.Header[] headers
    • body

      private byte[] body
    • resp

      private org.apache.http.HttpResponse resp
    • stream

  • Constructor Details

    • Response

      public Response(int code)
      Constructor
      Parameters:
      code - the HTTP response code
    • Response

      public Response(int code, org.apache.http.Header[] headers)
      Constructor
      Parameters:
      code - the HTTP response code
      headers - the HTTP response headers
    • Response

      public Response(int code, org.apache.http.Header[] headers, byte[] body)
      Constructor
      Parameters:
      code - the HTTP response code
      headers - the HTTP response headers
      body - the response body, can be null
    • Response

      public Response(int code, org.apache.http.Header[] headers, org.apache.http.HttpResponse resp, InputStream in)
      Constructor. Note: this is not thread-safe
      Parameters:
      code - the HTTP response code
      headers - headers the HTTP response headers
      resp - the response
      in - Inputstream if the response had one.
  • Method Details

    • getCode

      public int getCode()
      Returns the HTTP response code
    • getStream

      Gets the input stream instance.
      Returns:
      an instance of InputStream class.
    • getHeaders

      public org.apache.http.Header[] getHeaders()
      Returns the HTTP response headers
    • getHeader

      public String getHeader(String key)
    • getLocation

      public String getLocation()
      Returns the value of the Location header
    • hasBody

      public boolean hasBody()
      Returns true if a response body was sent
    • getBody

      public byte[] getBody()
      Returns the HTTP response body
    • setCode

      public void setCode(int code)
      Parameters:
      code - the HTTP response code
    • setHeaders

      public void setHeaders(org.apache.http.Header[] headers)
      Parameters:
      headers - the HTTP response headers
    • setBody

      public void setBody(byte[] body)
      Parameters:
      body - the response body