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.