cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Linus Kamb" <k...@emsc-csem.org>
Subject RE: jax-rs byte stream result
Date Mon, 19 Oct 2009 11:18:54 GMT
You might also look in to setting the Content Disposition header.

-----Message d'origine-----
De : Sergey Beryozkin [mailto:sberyozk@progress.com] 
Envoyé : Monday, October 19, 2009 1:12 PM
À : users@cxf.apache.org
Objet : Re: jax-rs byte stream result

You choose either to return a multipart body or a plain response, but if you
decide to go the multipart way then perhaps

https://addons.mozilla.org/en-US/firefox/addon/1345

can help ?

if multipart is not used then you can just return a JAXRS Response and set
the content type dynamically;
cheers, Sergey

----- Original Message ----- 
From: "Benson Margulies" <bimargulies@gmail.com>
To: <users@cxf.apache.org>
Sent: Monday, October 19, 2009 11:51 AM
Subject: Re: jax-rs byte stream result


WHat matters is that what arrives at the client looks like a download. I
think this required an overall content type of, say, text/csv, not
multipart/x with a text/csv part, but perhaps browsers do have a way to
handle multipart. If Sergey's previous comment was that single-item
multi-parts collapse to a plain content type, I'd be set.

On Mon, Oct 19, 2009 at 6:24 AM, Sergey Beryozkin
<sberyozk@progress.com>wrote:

> Hi Linus
>
> you may be right in this case, I thought Benson was actually not excited
> about using
> @Multipart annotation :
>
> public class SomeResource {
>
> @Produces("multipart/mixed")
> // set the content type on the root part of the multipart response
> @Multipart("text/xml")
> public CSV getFile() {
> }
> }
>
> lets see what Benson actually meant :-)
>
>  And, FWIW, last time I tried setting the content type in an output
filter,
>> it didn't work.
>>
>
> If you return a custom Response from the response filter then its content
> type will be used, but if you set it on the (outbound) Message then at the
> moment it might not actually work; only setting custom headers on the
> response message (say from CXF out interceptor) works at the moment AFAIK
>
> cheers, Sergey
>
> ----- Original Message ----- From: "Linus Kamb" <kamb@emsc-csem.org>
> To: <users@cxf.apache.org>
> Sent: Monday, October 19, 2009 10:44 AM
>
> Subject: RE: jax-rs byte stream result
>
>
> Hi Sergey,
>
> It was just an idea. :-)
>
> In any case, I understood him to say he didn't want Multipart/*,  but
maybe
> I didn't follow the whole conversation.
>
> And, FWIW, last time I tried setting the content type in an output filter,
> it didn't work.  I thought maybe one might have better luck with an
> interceptor as the docs indicate such a thing is possible.  (What I was
> doing at the time was rather a hack because I didn't understand how I was
> *supposed* to do what I was trying to do...)
>
> I should probably not muddy the waters with possibly ill-conceived advice.
> :-)
>
> Cheers,
> Linus
>
> -----Message d'origine-----
> De : Sergey Beryozkin [mailto:sberyozk@progress.com]
> Envoyé : Monday, October 19, 2009 11:30 AM
> À : users@cxf.apache.org
> Objet : Re: jax-rs byte stream result
>
> Hi Linus,
>
> Setting the content type in an out interceptor can be tricky, and is
> probably not possible at the moment, for
> individual parts of a given multipart/* (mixed. etc) response. The content
> type of the response itself will be say
> multipart/mixed or /related which can be set if really needed in the out
> interceptor or response filter...But the question is how to
> set the content types for individual multupart body parts.
> So for them to be set dynamically, one can return an instance of
> MultipartBody...Perhaps another option, when only a single part is
> involved, is to return say CSV object and then wrap it in a MultipartBody
> in
> a response filter and set the part content type
> there...
>
> cheers, Sergey
>
> ----- Original Message ----- From: "Linus Kamb" <kamb@emsc-csem.org>
> To: <users@cxf.apache.org>
> Sent: Monday, October 19, 2009 9:42 AM
> Subject: RE: jax-rs byte stream result
>
>
> Could you set the content type in an out interceptor?
>
> -----Message d'origine-----
> De : Benson Margulies [mailto:bimargulies@gmail.com]
> Envoyé : Friday, October 16, 2009 11:56 PM
> À : users@cxf.apache.org
> Objet : Re: jax-rs byte stream result
>
> Can I dynamically state the content type? I definitely don't want
> multipart.
>
>
> On Fri, Oct 16, 2009 at 5:07 PM, Sergey Beryozkin <
> sergey.beryozkin@iona.com
>
>> wrote:
>>
>
>
>> Hi Benson
>>
>> You might want to return a StreamingOutput and have @Produces("CSV
type").
>> Or return it as a multipart/mixed, and have @Multipart annotation on the
>> method level which will specify the type for the root type
>>
>> cheers, Sergey
>>
>>
>> bimargulies wrote:
>> >
>> > This may win some sort of a prize for a simple question.
>> >
>> > I want to define a JAX-RS function where the function provides, as a
>> > response, the entire content of the response plus the content type. I
>> > might,
>> > for example, be returning an entire CSV spreadsheet.
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/jax-rs-byte-stream-result-tp25931526p25932363.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
>>
>
>
>
>
>





Mime
View raw message