• 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: FileDownload
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FileDownload


  • Subject: Re: FileDownload
  • From: Kaj Hejer <email@hidden>
  • Date: Sun, 16 Nov 2003 14:49:24 +0100

At 21:09 +0100 15-11-03, Richard Bruch wrote:
Hello Kranthi,

supposed you have an object "data" with data loaded from the desired server file
you can build a WOResponse object and return it as result of a given direct
action.


        r.setHeader(data.getMimetype(),"content-type");
        r.setHeader("attachment;
filename=\""+data.getFilename()+"\"","content-disposition");
  if(data.stringData != null) // data is in a string
   r.appendContentString(data.stringData.toString());
  else // data is in an NSData instance
         r.appendContentData(data.getRawData());



Hi!

We use the same headers for download and that work just fine on almost al borwsers and plattforms except for Safari 1.1 and IE5.2.3 on osx. We use content-type "application/octet-stream".

In addition to the headers you set above we use

  response.setHeader(
      Integer.toString(getHtmlcode().length()), "content-length");
  response.disableClientCaching();
  response.removeHeadersForKey("Cache-Control");
  response.removeHeadersForKey("pragma");


The content is html (full html for a html-file which want to be downloaded to the user).


In Safari and IE the html is shown in the browser instead of beeing downloaded as a file.

We have also tried

 response.setHeader(
   "application/octet-stream; name=\"" + getFilename() + "\"", "content-type");

(ref. <url:http://wodev.spearway.com/cgi-bin/WebObjects/WODev.woa/2/wa/Main?wikiPage=ReturningFileToBrowser>) with same result.


Any ideas how to solve this for Safari and IE on osx?


-Kaj :) _______________________________________________ webobjects-dev mailing list | email@hidden Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev Do not post admin requests to the list. They will be ignored.

References: 
 >FileDownload (From: "Richard Bruch" <email@hidden>)

  • Prev by Date: Re: So what is a good approach to learning WebObjects?
  • Next by Date: Re: FileDownload
  • Previous by thread: FileDownload
  • Next by thread: Re: FileDownload
  • Index(es):
    • Date
    • Thread