com.basho.riak.client.response
Interface HttpResponse

All Known Implementing Classes:
BucketResponse, DefaultHttpResponse, FetchResponse, HttpResponseDecorator, MapReduceResponse, RiakResponseException, RiakResponseRuntimeException, StoreResponse, WalkResponse

public interface HttpResponse

HTTP response information resulting from some HTTP operation


Method Summary
 void close()
          Releases the underlying the HTTP connection when the response is streamed
 byte[] getBody()
          The HTTP response body or null if isStreamed()
 java.lang.String getBodyAsString()
           
 java.lang.String getBucket()
          The target object's bucket
 java.util.Map<java.lang.String,java.lang.String> getHttpHeaders()
          The HTTP response headers.
 org.apache.commons.httpclient.HttpMethod getHttpMethod()
          The actual HttpMethod used to make the HTTP request.
 java.lang.String getKey()
          The target object's key or null if bucket is target
 int getStatusCode()
          Resulting status code from the HTTP request.
 java.io.InputStream getStream()
          The HTTP response body as an input stream if isStreamed(); null otherwise
 boolean isError()
          Whether the HTTP request returned a 4xx or 5xx response
 boolean isStreamed()
          Whether the response body is available as an input stream
 boolean isSuccess()
          Whether the HTTP response is considered a success.
 

Method Detail

getBucket

java.lang.String getBucket()
The target object's bucket


getKey

java.lang.String getKey()
The target object's key or null if bucket is target


getStatusCode

int getStatusCode()
Resulting status code from the HTTP request.


getHttpHeaders

java.util.Map<java.lang.String,java.lang.String> getHttpHeaders()
The HTTP response headers.


getBody

byte[] getBody()
The HTTP response body or null if isStreamed()


getBodyAsString

java.lang.String getBodyAsString()

getStream

java.io.InputStream getStream()
The HTTP response body as an input stream if isStreamed(); null otherwise


isStreamed

boolean isStreamed()
Whether the response body is available as an input stream


getHttpMethod

org.apache.commons.httpclient.HttpMethod getHttpMethod()
The actual HttpMethod used to make the HTTP request. Most of the data here can be retrieved more simply using methods in this class. Also, note that the connection will already be closed, so calling getHttpMethod().getResponseBodyAsStream() will return null.


isSuccess

boolean isSuccess()
Whether the HTTP response is considered a success. Generally this translates to a 2xx for any request, a 304 for GET and HEAD requests, or 404 for DELETE requests.


isError

boolean isError()
Whether the HTTP request returned a 4xx or 5xx response


close

void close()
Releases the underlying the HTTP connection when the response is streamed



Copyright © 2010. All Rights Reserved.