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, isSuccess
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, getBody, getBodyAsString, getBucket, getHttpHeaders, getHttpMethod, getHttpResponse, getKey, getStatusCode, getStream, isError, isStreamed, isSuccess
public FetchResponse(HttpResponse r, RiakClient riak) throws RiakResponseRuntimeException, RiakIORuntimeException
RiakObject
. On a 300 response, parse the multipart/mixed HTTP
body into a collection of sibling RiakObject
s.
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
RiakResponseRuntimeException
public boolean hasObject()
hasObject
in interface WithBodyResponse
public RiakObject getObject()
getObject
in interface WithBodyResponse
public void setObject(RiakObject object)
public boolean hasSiblings()
hasSiblings
in interface WithBodyResponse
public Collection<RiakObject> getSiblings()
getSiblings
in interface WithBodyResponse
public String getVclock()
getVclock
in interface WithBodyResponse
Copyright © 2013. All Rights Reserved.