The biggest issue I had to overcome was modifying the "Content-Disposition" in
one of the "Parts". There didn't seem to be an intuitive way (at least not to
me) to alter this with the method I was using "addFormData". In order to
accomplish this, I had to call addFormData to add my part, then iterate the
parts to find the part I was interested in, and get the headers, and add a
Content-Disposition header to that prior to sending off the request. I needed a
*fliename* in the content disposition which wasn't being added (as I had a byte
array from the inputStream that I sent, meaning there wasn't any way for it to
have a filename.)
Anyway, all is good now with a little tweaking and such, interesting exercise!
And if there is a simpler way to alter the headers (specifically
content-disposition) I would love to know, but this seems to be working as I
hoped now.
-Tom
----- Original Message -----
> From: "Tom Butt" <tb...@redhat.com>
> To: "william fatecsjc" <william.fatec...@gmail.com>
> Cc: resteasy-users@lists.sourceforge.net
> Sent: Friday, January 16, 2015 10:54:37 AM
> Subject: Re: [Resteasy-users] client for multipart/form-data
> So, one of the paths I was going down used MultipartFormDataOutput, and I
> found that did seem to be working (there were some errors on the consuming
> side of my client that I was able to get resolved today.) So, that part is
> pretty happy. Now I'm just trying to move an image over, and I'm pretty sure
> this is just some minor communication issue with the service I'm consuming.
> In case anybody has any great insights here (and as I've started this
> thread), I'm getting the image directly on my resource as a image/png, as an
> input stream. I'm simply doing:
> multipartoutput.addFormData("file", inputStream,
> MEDIA_TYPE.APPLICATION_OCTET_STREAM_TYPE);
> when I add it to the data to send off.
> -Tom
> ----- Original Message -----
> > From: "William Antônio Siqueira" <william.a.sique...@gmail.com>
>
> > To: "Tom Butt" <tb...@redhat.com>
>
> > Cc: resteasy-users@lists.sourceforge.net
>
> > Sent: Friday, January 16, 2015 7:35:59 AM
>
> > Subject: Re: [Resteasy-users] client for multipart/form-data
>
> > Hello TOm,
>
> > have you seems resteasy multipart test classes?
>
> > https://github.com/resteasy/Resteasy/tree/RESTEASY_JAXRS_1_2_GA_CP03/providers/multipart/src/test/java/org/jboss/resteasy/test/providers/multipart
>
> > I think it could help you when creating your own client
>
> > --
>
> > William Antônio Siqueira
>
> > Java Support Analyst
>
> > http://fxapps.blogspot.com
>
> > http://www.williamantonio.wordpress.com
>
> > http://williamprogrammer.com
>
> > 2015-01-16 12:25 GMT-02:00 Tom Butt < tb...@redhat.com > :
>
> > > We use the ProxyFactory to create clients in resteasy and typically
> > > define
> > > interfaces as:
> >
>
> > > @GET
> >
>
> > > @Path("/{id}")
> >
>
> > > @Produces("application/xml")
> >
>
> > > ClientResponse<String> getDataByTitle(@PathParam("id") String id,
> > > @QueryParam(value = "title") String name);
> >
>
> > > or similar.
> >
>
> > > I need to consume a multipart/form-data resource that would be curl'd
> > > like:
> >
>
> > > curl -kvLX POST -u $USERNAME:$PASSWORD -H "Content-Type:
> > > multipart/form-data"
> > > --form "name=logo" --form "files[files]=@cloud.png" --form "force=1"
> > > "<someurl>/attach_file"
> >
>
> > > I've tried a number of things that have me spinning my wheels with
> > > various
> > > errors and I feel like I'm on multiple misguided paths. Any point in the
> > > right direction would be GREATLY appreciated.
> >
>
> > > -Tom
> >
>
> > > ------------------------------------------------------------------------------
> >
>
> > > New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
> >
>
> > > GigeNET is offering a free month of service with a new server in Ashburn.
> >
>
> > > Choose from 2 high performing configs, both with 100TB of bandwidth.
> >
>
> > > Higher redundancy.Lower latency.Increased capacity.Completely compliant.
> >
>
> > > http://p.sf.net/sfu/gigenet
> >
>
> > > _______________________________________________
> >
>
> > > Resteasy-users mailing list
> >
>
> > > Resteasy-users@lists.sourceforge.net
> >
>
> > > https://lists.sourceforge.net/lists/listinfo/resteasy-users
> >
>
> ------------------------------------------------------------------------------
> New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
> GigeNET is offering a free month of service with a new server in Ashburn.
> Choose from 2 high performing configs, both with 100TB of bandwidth.
> Higher redundancy.Lower latency.Increased capacity.Completely compliant.
> http://p.sf.net/sfu/gigenet
> _______________________________________________
> Resteasy-users mailing list
> Resteasy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/resteasy-users
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users