users@jersey.java.net

Re: [Jersey] How can I post an array of File to a web server?

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Fri, 30 Jul 2010 15:14:17 +0200

Hi Danny,

Jersey does not support serializing an array of files to an XML
document. What does the server specify it requires as a request?

I recommend that you use the media type multipart/mixed and the Jersey
multipart API. See:

   https://jersey.dev.java.net/nonav/apidocs/latest/contribs/jersey-multipart/index.html
   https://jersey.dev.java.net/nonav/apidocs/latest/contribs/jersey-multipart/com/sun/jersey/multipart/file/FileDataBodyPart.html

Paul.

On Jul 16, 2010, at 4:41 PM, danny888 wrote:

>
> Hi,
>
> In my Jersey client:
>
> File templateXsl = new File("c:\\sasmple.xsl");
> File dataObjectXml = new File("c:\\sample.xml");
> File [] xmlFileArr = new File[2];
> xmlFileArr[0] = templateXsl;
> xmlFileArr[1] = dataObjectXml;
> response =
> resource.type(MediaType.APPLICATION_XML_TYPE).post(String.class,
> xmlFileArr);
>
> I got the following error:
> A message body writer for Java type, class [Ljava.io.File;, and MIME
> media
> type, application/xml, was not found
>
> I am not sure if I am in the right direction. If not, any other way
> to post
> an array of File? Your help would be highly appreciated.
>
> Thanks
> danny
> --
> View this message in context: http://jersey.576304.n2.nabble.com/How-can-I-post-an-array-of-File-to-a-web-server-tp5302224p5302224.html
> Sent from the Jersey mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>