Hi Ns,
For the cookies please see [1], [2].
Regarding the request body, you are probably
trying to send JSON representation out.
I would recommend, you are explicit on this
and attach the Content-type HTTP header
to your request. For detailed info on JSON
processing in Jersey please see [3].
HTH,
~Jakub
[1]
http://jersey.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/api/client/WebResource.html#cookie%28javax.ws.rs.core.Cookie%29
[2]
http://jersey.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/api/client/ClientResponse.html#getCookies%28%29
[3]
http://jersey.java.net/nonav/documentation/latest/json.html
On 05/18/2011 11:35 PM, NS wrote:
> Hi,
>
> I am trying to use Jersey client for the first time. I have browsed
> through several tutorials, but couldn't get the following POST request
> working :
>
> I am trying to execute the following POST request through Jersey Client -
>
> curl -b cookies -c cookies -X POST --data-binary @cred 'url'
>
> the cred file contains username and password info in the following format
>
> "auth":
> {
> "username" : "user",
> "password" : "passwd"
> }
> }
>
> I tried to use MultivaluedMap to set username and password, but it
> doesn't work
>
> Could you point me to an example to implement my request.
>
> Thanks a bunch!
>
>