users@jersey.java.net

Re: [Jersey] Problems handling multipart/form-data input

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Tue, 5 Oct 2010 17:36:59 +0200

On Sep 29, 2010, at 5:07 PM, Martin Matula wrote:

> Hi Marko,
> Try using FormDataMultiPart, instead of MultiPart.

That should not make any difference.

I suspect the mimepull.jar is missing:

   https://jersey.dev.java.net/nonav/documentation/latest/user-guide.html
#d0e3947

Paul.

> Martin
>
> On Sep 29, 2010, at 9:45 AM, Marko Asplund wrote:
>
>> Hi,
>>
>> I'm having problems parsing multipart-form-data POST content with
>> Jersey 1.4.
>> I've a method like this:
>>
>> @POST
>> @Consumes(MediaType.MULTIPART_FORM_DATA)
>> public void addDocument(MultiPart mimeMultipartData) {
>> // ...
>> }
>>
>> Is this a correct way to handle multipart form input?
>> The jersey-multipart-1.4.jar is included in classpath.
>>
>> When I post a multipart-form-data request to the resource the
>> following error appears in the server log file:
>>
>> Sep 29, 2010 9:56:39 AM
>> com.sun.jersey.spi.container.ContainerRequest getEntity
>> SEVERE: A message body reader for Java class
>> com.sun.jersey.multipart.MultiPart, and Java type class
>> com.sun.jersey.multipart.MultiPart, and MIME media type multipart/
>> form-data;boundary=t2I4QEHxIQQLQKuPcza112cIXke1KQ was not found
>> Sep 29, 2010 9:56:39 AM
>> com.sun.jersey.spi.container.ContainerRequest getEntity
>> SEVERE: The registered message body readers compatible with the
>> MIME media type are:
>> */* ->
>> com.sun.jersey.core.impl.provider.entity.FormProvider
>> com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider
>> com.sun.jersey.core.impl.provider.entity.StringProvider
>> com.sun.jersey.core.impl.provider.entity.ByteArrayProvider
>> com.sun.jersey.core.impl.provider.entity.FileProvider
>> com.sun.jersey.core.impl.provider.entity.InputStreamProvider
>> com.sun.jersey.core.impl.provider.entity.DataSourceProvider
>> com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider
>> $General
>> com.sun.jersey.core.impl.provider.entity.ReaderProvider
>> com.sun.jersey.core.impl.provider.entity.DocumentProvider
>> com.sun.jersey.core.impl.provider.entity.SourceProvider
>> $StreamSourceReader
>> com.sun.jersey.core.impl.provider.entity.SourceProvider
>> $SAXSourceReader
>> com.sun.jersey.core.impl.provider.entity.SourceProvider
>> $DOMSourceReader
>> com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider
>> $General
>> com.sun.jersey.json.impl.provider.entity.JSONArrayProvider$General
>> com.sun.jersey.json.impl.provider.entity.JSONObjectProvider$General
>> com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider
>> $General
>> com.sun.jersey.core.impl.provider.entity.XMLListElementProvider
>> $General
>> com.sun.jersey.core.impl.provider.entity.XMLRootObjectProvider
>> $General
>> com.sun.jersey.core.impl.provider.entity.EntityHolderReader
>> com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider
>> $General
>> com.sun.jersey.json.impl.provider.entity.JSONListElementProvider
>> $General
>> com.sun.jersey.json.impl.provider.entity.JacksonProviderProxy
>>
>>
>> The client request is issued by Commons httpclient v3.1 and the
>> server side runs on Tomcat 6.
>>
>>
>> marko
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>