Hi Antonio,
you should be able to find some samples which are presenting how to use
@FormParam, see this:
http://www.vogella.de/articles/REST/article.html
for example.
Anyway, I don't understand why are you trying to use form(s) in this
case. Is Image your custom class? If so, you should implement message
body reader and writer and you should be able to send/consume it, see
http://jsr311.java.net/nonav/javadoc/javax/ws/rs/ext/MessageBodyReader.html
and
http://jsr311.java.net/nonav/javadoc/javax/ws/rs/ext/MessageBodyWriter.html.
Regards,
Pavel
On 12/5/11 6:30 PM, António Mota wrote:
> Hi again.
>
> I'm trying to POST using Jersey Client but I'm allways getting this:
>
> "A servlet POST request, to the URI
> http://localhost:8080/app/rest/image/14961, contains form parameters
> in the request body but the request body has been consumed by the
> servlet or a servlet filter accessing the request parameters. Only
> resource methods using @FormParam will work as expected. Resource
> methods consuming the request body by other means will not work as
> expected."
>
>
> My method is defined as
>
> @POST
> @Path("image/{imageId}")
> public void saveImageAnnotations(@PathParam("imageId") Long imageId,
> @FormParam("images") Image[] images);
>
> My invocations is
>
> resource.path("image").path("14961").post(images});
>
> and in "images" I tried several options, like a Form, a MultivalueMap,
> a HashMap, a Images[] (I found out later that the first 2 are for
> String values only) and serialized both in XML and JSON.
>
>
> Note that this works OK with the Apache HttpClient based client and
> XML representations, and with Jersey on the server.
>
> Any pointer on what I'm doing wrong?
>
>
> Cheers.
>