Thanks Robert. Yes, I think you're correct for WLP. Writing to the response should be done in the rendering phase rather than the execution of the action. Really appreciate the additional input.
On 5/10/07, Robert Read <[EMAIL PROTECTED]> wrote:
Hi Again, Further to my last email... the blank JSP provides an empty response 'buffer'. You can forward to another page or the same page - but then its buffer will contain the rendered JSP - so it will require resetting prior to streaming the new content. I think this is the required method: http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletResponse.html #resetBuffer() Cheers, Robert -----Original Message----- From: Robert Read [mailto:[EMAIL PROTECTED] Sent: Friday, 11 May 2007 10:21 a.m. To: Beehive Users Subject: RE: Stream a fiile from an action Hi Ben and Carlin In my experience forwarding to a JSP is necessary to get a hold of a suitable response, which I guess is the scope issue you mention (though I'm not 100% sure since I'm unfamiliar with the term 'scoped response'). In Beehive, we forwarded to a blank JSP. The browser grabs the page and interprets the content-disposition etc opening the appropriate dialog for the file-type mapping. This is not on portal but weblogic 9.2 with out-of-the-box Beehive. Cheers, Robert Robert Read Analyst-Programmer ITS Group Applications The University of Auckland Telephone: +64 9 373 7599 ext 82475 Email: [EMAIL PROTECTED] Web: http://www.auckland.ac.nz/ -----Original Message----- From: Carlin Rogers [mailto:[EMAIL PROTECTED] Sent: Friday, 11 May 2007 10:07 a.m. To: Beehive Users Subject: Re: Stream a fiile from an action Hi Ben, Your example definitely works in a standalone Beehive NetUI application. You're probably correct about the scoped response but I'm not yet certain. Have you posted this question to the portal forum? http://forums.bea.com/bea/forum.jspa?forumID=2044 Kind regards, Carlin On 5/10/07, Burgess, Benjamin <[EMAIL PROTECTED]> wrote: > What is the correct way to stream a file from a Beehive action? > > > > What I have tried is to use (which doesn't work) is to declare an action > method that doesn't have any forwards: > > getResponse().setContentType("application/zip"); > > getResponse().setHeader("Content-Disposition", > "attachment;filename=test.zip"); > > getResponse().getOutputStream().write(bytes); > > return null; > > > > However, the content type header never gets updated; it always comes to > the browser as text/html. I assume this has something to do with Scoped > Responses. Also, the actual content being returned to the browser > starts with the bytes for the zip file, but then has the JSP from which > the request initiated concatenated to the end of it. Doesn't a null > forward mean to stop the response right there? > > > > I am using BEA Weblogic Portal 9.2 with out of the box Beehive. > > > > Ben > > > ****************************************** > This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, please contact sender immediately by reply e-mail and destroy all copies. You are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. > TIAA-CREF > ****************************************** >
