Return-Path: Delivered-To: apmail-cxf-users-archive@www.apache.org Received: (qmail 15549 invoked from network); 19 Oct 2009 11:19:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 19 Oct 2009 11:19:30 -0000 Received: (qmail 34733 invoked by uid 500); 19 Oct 2009 11:19:29 -0000 Delivered-To: apmail-cxf-users-archive@cxf.apache.org Received: (qmail 34672 invoked by uid 500); 19 Oct 2009 11:19:29 -0000 Mailing-List: contact users-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@cxf.apache.org Delivered-To: mailing list users@cxf.apache.org Received: (qmail 34622 invoked by uid 99); 19 Oct 2009 11:19:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Oct 2009 11:19:28 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [193.52.21.73] (HELO puma.emsc-csem.org) (193.52.21.73) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Oct 2009 11:19:17 +0000 Received: from iguane (iguane.emsc-csem.org [193.52.21.90]) by puma.emsc-csem.org (8.13.8+Sun/8.12.10) with ESMTP id n9JBIs66024985 for ; Mon, 19 Oct 2009 11:18:57 GMT From: "Linus Kamb" To: References: <61b5d9410910161304v2e5b8e83s72516df2637de9ff@mail.gmail.com> <25932363.post@talk.nabble.com> <61b5d9410910161455o375a17d4g975c724b89033fb3@mail.gmail.com> <97288ED2513C432B95B3D68237AFFEE0@emsccsem.org> <021901ca509e$b2d70010$1f02050a@emea.progress.com> <65C940F3DEC944D1A436BE4830C09CFE@emsccsem.org> <025201ca50a6$694fa160$1f02050a@emea.progress.com> <61b5d9410910190351g2a8c4bdej6e97b3f25b033674@mail.gmail.com> <027f01ca50ac$ece10f90$1f02050a@emea.progress.com> Subject: RE: jax-rs byte stream result Date: Mon, 19 Oct 2009 13:18:54 +0200 Message-ID: <30C807BA73F64DF78C80D5CC04E19087@emsccsem.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Thread-Index: AcpQrQNlPOiXZFD+QbGi98iUb9FkCQAAMH3A In-Reply-To: <027f01ca50ac$ece10f90$1f02050a@emea.progress.com> X-Virus-Checked: Checked by ClamAV on apache.org You might also look in to setting the Content Disposition header. -----Message d'origine----- De=A0: Sergey Beryozkin [mailto:sberyozk@progress.com]=20 Envoy=E9=A0: Monday, October 19, 2009 1:12 PM =C0=A0: users@cxf.apache.org Objet=A0: 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 -----=20 From: "Benson Margulies" To: 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 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" > To: > 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=E9 : Monday, October 19, 2009 11:30 AM > =C0 : 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" > To: > 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=E9 : Friday, October 16, 2009 11:56 PM > =C0 : 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. >> >> >> > > > > >