users@jersey.java.net

[Jersey] How to upload a foto (Graph API)

From: <benjamin.malter_at_arcor.de>
Date: Sat, 2 Jun 2012 08:45:24 +0000 (GMT)

Hallo.

I use jersey to communicate with Facebooks Graph API.
Everythink works fine. I can publish a post etc.

This is the code to publish non binary posts:

     Client client = Client.create();

     WebResource webResource = client.resource(url);

     ClientResponse response =
webResource.type("application/x-www-formurlencoded")
         .post(ClientResponse.class, parameters);

parameters is a MultiValuedMap with String value pairs.

Now i want to publish a Photopost. I searched hours to find a way to
submit the MultiValuedMap and a binary attachment as
multipart/form-data.

I hope someone knows how to do it or point me an example or tutorial.

Greetings

Ben