cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kynan Fraser <kynan.fra...@customware.net>
Subject Re: JAX-RS: Best approach for POST operation of a complex type containing binary object
Date Mon, 06 Jul 2009 23:31:26 GMT

Hi Sergey,

Thanks for the test case links. I had seen your blog (and Arul's) but hadn't
seen these tests yet.

I've got something working but need to think about client support for
generating multipart requests (I mean its easy enough using http client but
i'll probably have all kinds of clients) and if thats the best option etc.

As a side note when I was testing POST of a single InputStream I closed the
stream in my service class but that caused an exception to be thrown by the
OutInterceptor because it was trying to close it too. However, I don't seem
to have this behaviour using multiparts. Should input streams typically be
closed by the service class or closed by the runtime?

Thanks for your responses.

Regards,
Kynan


Sergey Beryozkin-2 wrote:
> 
> Hi Kynan
> 
> I'd probably go with multiparts, CXF is very efficient in the way it deals
> with attachments, every part will be represented by an 
> individual stream, if the part is too large then it will be saved to the
> disk, etc...
> I'm sorry I haven't properly documented how to use attachments in CXf
> JAX-RS, I only posted to my blog once. I'm so slow in updating 
> the docs. Here's a system test :
> 
> http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
> (tests)
> 
> http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
> (resource class)
> 
> The limitation is that multiparts are not supproted by the client api - I
> have this JIRA for it :
> http://issues.apache.org/jira/browse/CXF-2270
> 
>  Let me know please if using multiparts can be of interest
> 
> cheers, Sergey
> 
> 
> ----- Original Message ----- 
> From: "Kynan Fraser" <kynan.fraser@customware.net>
> To: <users@cxf.apache.org>
> Sent: Monday, July 06, 2009 9:03 AM
> Subject: Re: JAX-RS: Best approach for POST operation of a complex type
> containing binary object
> 
> 
>>
>> Forgot to mention i've got no problem with byte[]'s in the XML but i'd
>> prefer
>> to use streams if possible. I'm not sure if there is a way to have
>> streams
>> inside the XML, or if its better to use attachments/multipart instead?
>>
>> Regards,
>> Kynan
>>
>> Kynan Fraser wrote:
>>>
>>> Hi All,
>>>
>>> My use case is I need to support a POST operation for clients to send an
>>> XML representation of a complex type (like a mail) containing a mix of
>>> strings and (multiple) binary objects (mail attachments).
>>>
>>> I can handle a post just containing a single binary as an input stream
>>> or
>>> byte[], or the XML by itself easily enough, but I'm not sure of the best
>>> way to handle them side by side and also multiple binary objects
>>> (ideally
>>> streams?) instead of just one inside the xml complex type. Should they
>>> be
>>> base64 encoded binary objects inside the XML? Attachments?
>>>
>>> I've read a bit about jaxrs support for multiparts but i'm not sure if
>>> thats my best option... any help/direction is appreciated.
>>>
>>> Thanks,
>>> Kynan
>>>
>>
>> -- 
>> View this message in context: 
>> http://www.nabble.com/JAX-RS%3A-Best-approach-for-POST-operation-of-a-complex-type-containing-binary-object-tp24350931p24351262.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/JAX-RS%3A-Best-approach-for-POST-operation-of-a-complex-type-containing-binary-object-tp24350931p24364644.html
Sent from the cxf-user mailing list archive at Nabble.com.


Mime
View raw message