• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Streaming File Downloads
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Streaming File Downloads


  • Subject: Re: Streaming File Downloads
  • From: Greg Hulands <email@hidden>
  • Date: Mon, 11 Oct 2004 10:03:12 +1000

This is what I use in a separate component called document downloader:

public void appendToResponse(WOResponse response, WOContext context) {
super.appendToResponse(response, context);
URL file = null;
NSData fileContents = null;

try {
file = new URL("file", null, doc.path() + doc.file());
fileContents = new NSData(file);

response.setContentEncoding("UTF8");
response.setHeader(doc.mimeType(), "content-type");
response.setHeader("filename=" + doc.filename(),"Content-Disposition");
response.setContent(fileContents);
response.setStatus(WOMessage.HTTP_STATUS_OK);
} catch (Exception e) {
System.out.println("Error Downloading file: " + e);
}
}


HTH,
Greg

On 11/10/2004, at 9:44 AM, Ismael Perdido wrote:

Hi All,

I would like to serve the client a file to download
using a DirectAction.

I have a page listing database rows (including a
OpenBase 'object') and want to serve the file
associated with the item a user chooses.  Inside a
WORepetition I have a button with action getFile, here
was my idea:

    public WOComponent getFile()
    {
		WOResponse.setContentStream((java.io.InputStream)
FileInputStream(document.file), 4096, 4096);
        return null;
    }

Unfortunatley neither the setContentStream nor the
access of the '.file' column of 'document' were usable
in this context.  Help anyone???

Thanks,

Ismael Jones






______________________________________________
Renovamos el Correo Yahoo!: ¡100 MB GRATIS!
Nuevos servicios, más seguridad
http://correo.yahoo.es
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Streaming File Downloads
      • From: Ismael Perdido <email@hidden>
References: 
 >RE: Streaming File Downloads (From: Ismael Perdido <email@hidden>)

  • Prev by Date: RE: Streaming File Downloads
  • Next by Date: Re: book about "Expert One on One J2EE Development Without EJB"
  • Previous by thread: RE: Streaming File Downloads
  • Next by thread: Re: Streaming File Downloads
  • Index(es):
    • Date
    • Thread