users@jersey.java.net

[Jersey] Re: Why setting .type in Jersey Client?

From: George Cao <matrix3456_at_gmail.com>
Date: Tue, 3 Jul 2012 21:20:17 +0800

When your resource consumes something, you need exactly the same type on
the client side.
ÔÚ 2012-7-2 ÏÂÎç3:37£¬"Daniel" <drehmann.daniel_at_googlemail.com>дµÀ£º

> I want to send a Form to my Rest Service with Jersey. It is working like
> this:
>
> //create form
> //fill form
> service.path("rest").path("foo").accept(MediaType.APPLICATION_JSON).post(ClientResponse.class, form);
>
> So why should I use:
>
> .type(MediaType.APPLICATION_FORM_URLENCODED_TYPE)
>
> in it, when it's working without it? Same with plain text as string and so
> on. Where is the advantage of setting this?
>