Can you try out 2.2-beta-1 please?  I think I fixed something in 
multipart then.  Also try not using a DataSource and getting the raw 
input stream.

On 5/18/11 9:36 AM, ujay68 wrote:
> Hi,
>
> I'm trying to process a file upload with the multipart/form-data
> facility like this:
>
> @POST
> @Path("/upload")
> @Consumes(MediaType.MULTIPART_FORM_DATA)
> public Object upload(MultipartFormDataInput formData) throws IOException {
>      InputPart part = formData.getFormDataMap().get("file").get(0); //
> "file" is the name of the browser's input field
>      DataSource dataSource = part.getBody(new GenericType<DataSource>() { });
>      InputStream in = dataSource.getInputStream();
>      // ... read from input stream
>      return Response.ok().build();
> }
>
> The data source has the correct content type, so the setup seems to be
> generally right.
>
> But when I read from the input stream, I get only 1024 bytes even if
> the uploaded file is longer.
>
> Just a guess: The InputPart is implemented by
> org.jboss.resteasy.plugins.providers.multipart.MultipartInputImpl.PartImpl.
> When I look into that PartImpl's part.bodyPart.body with a debugger,
> it looks like there is some storage provider behind the scenes
> implemented by a
> org.apache.james.mime4j.storage.ThresholdStorageProvider. That
> provider has a head of 1024 bytes and a tail with the rest of the
> bytes. That tail seems to be lost. Could be something else entirely,
> of course.
>
> I'm using v2.1.0.GA.
>
> Is this a bug? Am I doing something wrong here? Does someone know a
> workaround (apart from parsing with my own code)?
>
> Thanks, Jay
>
> ------------------------------------------------------------------------------
> What Every C/C++ and Fortran developer Should Know!
> Read this article and learn how Intel has extended the reach of its
> next-generation tools to help Windows* and Linux* C/C++ and Fortran
> developers boost performance applications - including clusters.
> http://p.sf.net/sfu/intel-dev2devmay
> _______________________________________________
> Resteasy-users mailing list
> Resteasy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/resteasy-users

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users

Reply via email to