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?
>