|
Re: @Consumes & @Produces [message #989371 is a reply to message #988516] |
Wed, 05 December 2012 21:20 |
|
Am 30.11.2012 11:38, schrieb Janusz Dalecki:
> @Consumes({ MediaType.APPLICATION_JSON })
> @Produces({ MediaType.APPLICATION_JSON })
> public Product create(final Product prod) {
> prod.setId(null);
> return ...
> }
>
> so it is POJO object (Product), and it works !!! why???
> What am I missing???
Your assumption is correct.
@Consumes({ MediaType.APPLICATION_JSON }) instructs JAX-RS to accept
JSON input. It then searches for a @Provider that converts JSON into a
Product POJO.
@Produces is the other way around. It takes return values from methods
and uses a @Provider to convert POJOs to JSON.
-Gunnar
--
Gunnar Wagenknecht
gunnar@xxxxxxxx
http://wagenknecht.org/
|
|
|
Powered by
FUDForum. Page generated in 0.03443 seconds