public class FetchResponse extends HttpResponseDecorator implements WithBodyResponse
impl| Constructor and Description |
|---|
FetchResponse(HttpResponse r) |
FetchResponse(HttpResponse r,
RiakClient riak)
On a 2xx response, parse the HTTP response from Riak into a
RiakObject. |
| Modifier and Type | Method and Description |
|---|---|
RiakObject |
getObject()
Returns the first Riak object contained in the response.
|
Collection<RiakObject> |
getSiblings()
Returns a collection of the Riak objects contained in the response.
|
String |
getVclock() |
boolean |
hasObject()
Whether response contained a Riak object
|
boolean |
hasSiblings()
Whether response contained a multiple Riak objects
|
void |
setObject(RiakObject object) |
close, getBody, getBodyAsString, getBucket, getHttpHeaders, getHttpMethod, getHttpResponse, getKey, getStatusCode, getStream, isError, isStreamed, isSuccessclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, getBody, getBodyAsString, getBucket, getHttpHeaders, getHttpMethod, getHttpResponse, getKey, getStatusCode, getStream, isError, isStreamed, isSuccesspublic FetchResponse(HttpResponse r, RiakClient riak) throws RiakResponseRuntimeException, RiakIORuntimeException
RiakObject. On a 300 response, parse the multipart/mixed HTTP
body into a collection of sibling RiakObjects.
A streaming response (i.e. r.isStreaming() == true), will have a null
body and non-null stream. The resulting RiakObject(s) will return
null for getValue() and the stream for getValueStream(). Users must
remember to release the return value's underlying stream by calling
close().
Sibling objects are also streamed. The values of the objects are buffered
in memory as the stream is read. Consume and/or close each
RiakObject's stream as the collection is iterated to allow the
buffers to be freed.RiakResponseRuntimeException - If the server returns a 300 without a proper multipart/mixed
body or the server returns a 400 Bad Request or 5xx failureRiakIORuntimeException - If an error occurs during communication with the Riak server.public FetchResponse(HttpResponse r) throws RiakResponseRuntimeException
RiakResponseRuntimeExceptionpublic boolean hasObject()
hasObject in interface WithBodyResponsepublic RiakObject getObject()
getObject in interface WithBodyResponsepublic void setObject(RiakObject object)
public boolean hasSiblings()
hasSiblings in interface WithBodyResponsepublic Collection<RiakObject> getSiblings()
getSiblings in interface WithBodyResponsepublic String getVclock()
getVclock in interface WithBodyResponseCopyright © 2014. All Rights Reserved.