From adffaces-user-return-2487-apmail-incubator-adffaces-user-archive=incubator.apache.org@incubator.apache.org Tue Mar 27 12:34:12 2007 Return-Path: Delivered-To: apmail-incubator-adffaces-user-archive@locus.apache.org Received: (qmail 36135 invoked from network); 27 Mar 2007 12:34:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Mar 2007 12:34:11 -0000 Received: (qmail 23169 invoked by uid 500); 27 Mar 2007 12:34:18 -0000 Delivered-To: apmail-incubator-adffaces-user-archive@incubator.apache.org Received: (qmail 23158 invoked by uid 500); 27 Mar 2007 12:34:18 -0000 Mailing-List: contact adffaces-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: adffaces-user@incubator.apache.org Delivered-To: mailing list adffaces-user@incubator.apache.org Received: (qmail 23149 invoked by uid 99); 27 Mar 2007 12:34:18 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Mar 2007 05:34:18 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [192.234.253.30] (HELO nemours.org) (192.234.253.30) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Mar 2007 05:34:10 -0700 Received: from nemapp38.nemours.org ([172.19.10.55]) by nemours.org with Microsoft SMTPSVC(5.0.2195.6713); Tue, 27 Mar 2007 08:34:39 -0400 Received: from 10.20.11.90 by nemapp38.nemours.org with ESMTP (SMTP Relay); Tue, 27 Mar 2007 08:33:16 -0400 X-Server-Uuid: 35EBC2B0-EA10-409F-9923-04DFACBAF8D2 Received: from jaxmsx02.nemours.org ([10.20.9.25]) by nemmsx01.nemours.org with Microsoft SMTPSVC(5.0.2195.6713); Tue, 27 Mar 2007 08:33:00 -0400 Content-class: urn:content-classes:message MIME-Version: 1.0 X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: RE: Providing Files / Streams as download-link with trinidad? Date: Tue, 27 Mar 2007 08:33:00 -0400 Message-ID: <5B930A45C354E84395A194D500589ED80DBE1A@jaxmsx02.nemours.org> In-Reply-To: <71235db40703270525g39954932o9ca9dbdfb1ca1a42@mail.gmail.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Providing Files / Streams as download-link with trinidad? Thread-Index: Acdwa08mi+fdK7vMTru8rPW2g8DiBwAAEW4A From: "William Hoover" To: adffaces-user@incubator.apache.org X-OriginalArrivalTime: 27 Mar 2007 12:33:00.0859 (UTC) FILETIME=[0EB0B8B0:01C7706C] X-WSS-ID: 6A17D0863VW151764-01-01 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Brightmail-Tracker: AAAAAQAAA+o= X-Language-Identified: TRUE X-Virus-Checked: Checked by ClamAV on apache.org Not a problem. If it can save others the headache I had getting it to = work- I'm all for it ;o) -----Original Message----- From: mwessendorf@gmail.com [mailto:mwessendorf@gmail.com]On Behalf Of Matthias Wessendorf Sent: Tuesday, March 27, 2007 8:26 AM To: adffaces-user@incubator.apache.org Subject: Re: Providing Files / Streams as download-link with trinidad? why not, at least for the hopfully soon coming sandbox ? Do you mind to *upload* something like that to jira? the download thing is a common task, has been ask several times on myfaces_dev/user as well. -M On 3/27/07, William Hoover wrote: > Matthias, > > Sure... How would I go about doing that? > > I have been writting a few custom trinidad components and was thinking = that this might be a good canidate for it's own component. What's your = take on that? > > -----Original Message----- > From: mwessendorf@gmail.com [mailto:mwessendorf@gmail.com]On Behalf Of > Matthias Wessendorf > Sent: Tuesday, March 27, 2007 8:05 AM > To: adffaces-user@incubator.apache.org > Subject: Re: Providing Files / Streams as download-link with trinidad? > > > Possible, > long time ago, I dealt w/ that last time :-) > Yours looks much more detailed. Interested in providing a nice how-to > for the wiki ? > > Thx, > Matthias > > On 3/27/07, William Hoover wrote: > > Matthias, > > > > I have been struggling with the same problem when streaming files = for download. I have tried the solution described below, but I still = recieve an java.lang.IllegalStateException- even when calling = FacesContext.getCurrentInstance().responseComplete(). This also breaks = all of the links/buttons on the page. > > > > -----Original Message----- > > From: mwessendorf@gmail.com [mailto:mwessendorf@gmail.com]On Behalf = Of > > Matthias Wessendorf > > Sent: Tuesday, March 27, 2007 4:48 AM > > To: adffaces-user@incubator.apache.org > > Subject: Re: Providing Files / Streams as download-link with = trinidad? > > > > > > Hello Jochen, > > > > I've worked with Apache FOP for creating pdfs. iText or > > JasperReports are also lib that help you on that task. > > > > inside of your backing bean method (referenced by a commandLink or > > cmdButton) you can do somthing like this: > > > > public String pdf() { > > > > FacesContext ctx =3D FacesContext.getCurrentInstance(); > > > > if(!ctx.getResponseComplete()) { > > > > > > HttpServletResponse response =3D (HttpServletResponse) > > ctx.getExternalContext().getResponse(); > > > > byte[] file =3D //do some FOP, or ... stuff; > > > > response.setContentType("application/pdf"); > > response.setHeader("Content-Disposition", "inline; > > filename=3D\"foo.pdf\""); > > response.setContentLength(file.length); > > > > OutputStream out =3D response.getOutputStream(); > > out.write(file, 0, file.length); > > out.flush(); > > out.close(); > > > > ctx.responseComplete(); > > > > return null; > > } > > > > > > This will work in p(l)ain servlet or struts world too (expect of the > > usage of jsf api (like FacesContext)) > > > > However, the *magic* here is the responseComplete() > > > > Signal the JavaServer Faces implementation that the HTTP response = for > > this request has already been generated (such as an HTTP redirect), > > and that the request processing lifecycle should be terminated as = soon > > as the current phase is completed. > > > > > > and yes... it's getResponseComplete() instead of = isResponseComplete() > > > > HTH, > > Matthias > > > > On 3/27/07, Jochen Traunecker wrote: > > > Hello everybody, > > > > > > I'm just wondering if there is some Trinidad-specific / = Faces-specific way to serve binary downloads, like PDFs stored in a = database. Or do I have to provide some link to a non managed servlet? > > > > > > Thanks, > > > Jochen > > > > > > > > > > > > > > > > > > ___________________________________________________________ > > > Telefonate ohne weitere Kosten vom PC zum PC: = http://messenger.yahoo.de > > > > > > > > > -- > > Matthias Wessendorf > > http://tinyurl.com/fmywh > > > > further stuff: > > blog: http://jroller.com/page/mwessendorf > > mail: mwessendorf-at-gmail-dot-com > > > > > > > -- > Matthias Wessendorf > http://tinyurl.com/fmywh > > further stuff: > blog: http://jroller.com/page/mwessendorf > mail: mwessendorf-at-gmail-dot-com > > --=20 Matthias Wessendorf http://tinyurl.com/fmywh further stuff: blog: http://jroller.com/page/mwessendorf mail: mwessendorf-at-gmail-dot-com