riak java client

Russell Brown russell.brown at me.com
Wed Nov 16 06:36:49 EST 2011


And too the list this time :$

----

Hi Sergey,

On 16 Nov 2011, at 10:48, sergey wrote:

> Hi!
> How to set content type for store operation for java-pcb client?
> b.store("key", "{"field":"value"}") - set content as text/plain, how set content type as application/json?

That is just a  convenience method. behind the scenes it creates an IRiakObject with the value you pass and a content-type of "text/plain". If you wish to store JSON, create an IRiakObject, set it's value and content-type and store that. Use the RiakObjectBuilder class to create your riak object. Or create some java bean type instance and store that (and have the client automatically convert it to a JSON payload for you, it uses Jackson for this.)

> and how store binary data(image)?

Same as above, create an IRiakObject, set its value to the byte[] of your image and set its content-type and store that.

Cheers

Russell

> 
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20111116/b37f0d02/attachment.html>


More information about the riak-users mailing list