All right, thanks for your ideas. It's really helpful.
I tried the simplest solution just to know if it works...
My client is still the same.

I tried to add this code on the server side:
private @Resource HttpServletRequest requestObject;

but I don't know how I can get my 2 files with the HttpServletRequest...
Did I miss something??




Brad-77 wrote:
> 
> There you go, plenty of options. I'd recommend you go with Sergey's
> suggestions as he wrote the JAX-RS implementation for CXF and actually
> knows what he's talking about :-)
> 
> On Thu, Jul 31, 2008 at 10:52 PM, Sergey Beryozkin
> <[EMAIL PROTECTED]> wrote:
>> This is probably even simpler, thanks, You can use an InputStream in the
>> signature - if you don't want to deal with HttpServletRequests
>>
>> -----Original Message-----
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
>> [EMAIL PROTECTED]
>> Sent: 31 July 2008 19:01
>> To: [email protected]
>> Subject: Re: CXF and fileupload
>>
>> No Worries :-)
>>
>> If you get FileUpload from apache commons then you can use its
>> multipart request class to parse the http request on the server side.
>>
>> If I remember correctly, to get the HttpServletRequest object in your
>> service method include this method parameter:
>>
>> @Context HttpServletRequest req
>>
>> You can then parse the req object with the FileUpload multipart request
>> object and get access to your files.
>>
>> Hope that helps.
>>
>> On 7/31/08, deniak <[EMAIL PROTECTED]> wrote:
>>>
>>> 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
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/CXF-and-fileupload-tp18753132p18773581.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to