Hi No problems at all, please have a look at my previous email. Please check the CXF JAX-RS documentation or indeed Jersey or any other one you can find. In CXF it's possible to use HTTP Binding to do REST - it's really not supported - so the other option is to go with JAX-RS which is what you're looking at I believe.
In JAX-RS it's MessageBodyReader which is responsible for converting an input stream into a concrete method parameter. As I said, one option is to write a MessageBodyReader which will convert an input stream into, say, an instance of MultiPartDataSource - CXF will do it itself at some time. As you'd like to pass more than one file, the other option is to just introduce a holder for as many body parts as you need, use it as a method parameter and do something similar to what I suggested earlier to conver the multipart/related source into that holder instance... Cheers, Sergey -----Original Message----- From: deniak [mailto:[EMAIL PROTECTED] Sent: 31 July 2008 17:44 To: [email protected] Subject: Re: CXF and fileupload Ok, let's say I set the requestentity with a MultipartRequestEntity. File zip = new File("/path/fileToUpload.zip"); File xml = new File("/path/fileToUpload.xml"); PostMethod filePost = new PostMethod("http://host/some_path"); Part[] parts = { new FilePart(xml.getName(), xml) new FilePart(zip.getName(), zip) }; filePost.setRequestEntity( new MultipartRequestEntity(parts, filePost.getParams()) ); How can I deal with this MultipartRequestEntity on the server side with CXF? I know I may ask some stupid questions but it really drives me crazy :s Thanks for your help Brad-77 wrote: > > Sounds like http request with an attached file to me, which I believe > requires a multipart request. > > See 3.7.2 in http://www.ietf.org/rfc/rfc2616.txt > > On Thu, Jul 31, 2008 at 2:26 PM, deniak <[EMAIL PROTECTED]> wrote: >> >> Actually, I just want to send a xml file and a zip file with my client >> and then handle these 2 files on my server using CXF. >> >> It's easy with just a XML file like described in the CXF samples but >> there's >> nothing about >> uploading a file >> >> >> >> >> Brad-77 wrote: >>> >>> So if I'm reading this correctly you just want to read the data out of >>> a file and send it as the body in a PUT request? >>> >>> Or is there more to it than that? >>> >>> On Thu, Jul 31, 2008 at 1:56 PM, deniak <[EMAIL PROTECTED]> wrote: >>>> >>>> I forgot to mention I need to use rest web services >>>> >>>> >>>> Benson Margulies-4 wrote: >>>>> >>>>> Well, CXF supports MTOM and SwA. >>>>> >>>>> On Thu, Jul 31, 2008 at 8:34 AM, deniak <[EMAIL PROTECTED]> >>>>> wrote: >>>>> >>>>>> >>>>>> Actually, i need to use a put method and I was wondering how cxf can >>>>>> handle >>>>>> it >>>>>> >>>>>> >>>>>> >>>>>> Brad-77 wrote: >>>>>> > >>>>>> > Hi, >>>>>> > >>>>>> > if you mean using HTML form POSTs then yes, its pretty easy with >>>>>> > commons FileUpload: http://commons.apache.org/fileupload/ >>>>>> > >>>>>> > You need to get access the the HTTP request object which you can >>>>>> pass >>>>>> > to the mime multipart request class in FileUploads. From there you >>>>>> can >>>>>> > iterate through the request parts, one of which will be your file. >>>>>> > >>>>>> > Hope that helps. >>>>>> > >>>>>> > Brad. >>>>>> > >>>>>> > On Thu, Jul 31, 2008 at 1:06 PM, deniak <[EMAIL PROTECTED]> >>>>>> wrote: >>>>>> >> >>>>>> >> Hi, >>>>>> >> >>>>>> >> Has anyone ever dealt with fileupload using cxf? >>>>>> >> I mean send a file to the server and get it with cxf? >>>>>> >> -- >>>>>> >> View this message in context: >>>>>> >> http://www.nabble.com/CXF-and-fileupload-tp18753132p18753132.html >>>>>> >> Sent from the cxf-user mailing list archive at Nabble.com. >>>>>> >> >>>>>> >> >>>>>> > >>>>>> > >>>>>> >>>>>> -- >>>>>> View this message in context: >>>>>> http://www.nabble.com/CXF-and-fileupload-tp18753132p18753583.html >>>>>> Sent from the cxf-user mailing list archive at Nabble.com. >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> -- >>>> View this message in context: >>>> http://www.nabble.com/CXF-and-fileupload-tp18753132p18753963.html >>>> Sent from the cxf-user mailing list archive at Nabble.com. >>>> >>>> >>> >>> >> >> -- >> View this message in context: >> http://www.nabble.com/CXF-and-fileupload-tp18753132p18754544.html >> Sent from the cxf-user mailing list archive at Nabble.com. >> >> > > -- View this message in context: http://www.nabble.com/CXF-and-fileupload-tp18753132p18758727.html Sent from the cxf-user mailing list archive at Nabble.com. ---------------------------- IONA Technologies PLC (registered in Ireland) Registered Number: 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
