users@jersey.java.net

[Jersey] Re: SEVERE: A message body reader for Java class com.sun.jersey.multipart.FormDataMultiPart, and Java type class com.sun.jersey.multipart.FormDataMultiPart, and MIME media type multipart/form-data; boundary=Boundary_1_12258573_127987272668 was not found

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Tue, 03 May 2011 13:20:56 +0200

Helle Stephan,

you should see something like:

...
May 3, 2011 1:15:23 PM
com.sun.jersey.server.impl.model.method.dispatch.MultipartFormDispatchProvider
getInjectables
SEVERE: Resource methods utilizing @FormParam and consuming
"multipart/form-data" are no longer supported. See @FormDataParam.
...

in your server log. When I changes @FormParam to @FormDataParam,
everything works as expected.

Regards,
Pavel


On 5/3/11 10:00 AM, Stephan Knull wrote:
> Hello,
>
> I have a similar problem with version 1.6. I previously used the following
> codes with version 1.1.5 which worked fine for me:
>
> Here is the client side code:
>
> final WebResource resource =
> IntranetUtil.getJerseyClient().resource(baseUrl + "/theService");
> FormDataMultiPart formData;
> formData = new FormDataMultiPart();
> formData.field("schema", "THESCHEMA", MediaType.TEXT_PLAIN_TYPE);
> formData.field("table", "THETABLE", MediaType.TEXT_PLAIN_TYPE);
> formData.field("authUser", "THEUSER", MediaType.TEXT_PLAIN_TYPE);
> final String result =
> resource.type("multipart/form-data").post(String.class, formData);
> formData.close();
> return result;
>
> And her the server side:
>
> @POST
> @Path("theService")
> @Consumes("multipart/form-data")
> public String theService(
> @DefaultValue("") @FormParam("schema") final String schema,
> @DefaultValue("") @FormParam("table") final String table,
> @DefaultValue("") @FormParam("authUser") final String authUser)
> throws Exception
> {
> ...
> }
>
> In my "theService" method I could use the parameters "schema", "table", etc.
> directly as usual.
> After switching to version 1.6 I have the problem, that on the server side
> all form fields are empty/not set now. I had to roll back to version 1.1.5
> for now since this was production code.
> How can I fix this (ofcourse I don't want to stay with that very old
> version)?
>
> Kind regards
> Stephan Knull
>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/SEVERE-A-message-body-reader-for-Java-class-com-sun-jersey-multipart-FormDataMultiPart-and-Java-typed-tp5969276p6326476.html
> Sent from the Jersey mailing list archive at Nabble.com.
>