• 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: csv report download -> Safari adding .html to filename?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: csv report download -> Safari adding .html to filename?


  • Subject: Re: csv report download -> Safari adding .html to filename?
  • From: John Ours <email@hidden>
  • Date: Thu, 09 Apr 2009 21:57:39 -0400


On Apr 9, 2009, at 9:33 PM, Leif Harrison wrote:


So...the headers ARE different...but I have idea why WO is changing my Content-Type after I have explicitly set it...?




In the code you sent earlier you are using:


			response.setContent(report);
			response.setStatus(WOMessage.HTTP_STATUS_OK);

response.setContentEncoding("UTF8");
response.setHeader("attachment; filename="+reportFilename,"Content-Disposition");
response.setHeader("text/csv", "Content-Type");



So perhaps because you're setting it _after_ you set the content? Conceptually that makes some sense since the headers have to be written before the payload, and the payload might have to be chunked. IIRC, Microsoft .NET works this way...if you set the content first, it assumes the content-type and then throws a runtime exception if you try to change the headers. I'm guessing of course...



That's the main difference between my (working) code and yours, other than the different headers that others have pointed out:



public void appendToResponse(WOResponse aResponse, WOContext aContext) {
super.appendToResponse(aResponse, aContext);
if (pendingResponse != null) {
ByteArrayInputStream in = new ByteArrayInputStream(pendingResponse);
aResponse.setHeader("application/pdf", "Content-type");
aResponse.setHeader("inline; filename=" + fileName, "Content- disposition");
aResponse.setContentStream(in, 512, (long)pendingResponse.length);
}
}



John _______________________________________________ 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
References: 
 >csv report download -> Safari adding .html to filename? (From: Leif Harrison <email@hidden>)
 >Re: csv report download -> Safari adding .html to filename? (From: Leif Harrison <email@hidden>)
 >Re: csv report download -> Safari adding .html to filename? (From: email@hidden)
 >Re: csv report download -> Safari adding .html to filename? (From: Leif Harrison <email@hidden>)
 >Re: csv report download -> Safari adding .html to filename? (From: Leif Harrison <email@hidden>)
 >Re: csv report download -> Safari adding .html to filename? (From: Chuck Hill <email@hidden>)
 >Re: csv report download -> Safari adding .html to filename? (From: Leif Harrison <email@hidden>)

  • Prev by Date: Re: csv report download -> Safari adding .html to filename?
  • Next by Date: Re: ERXEC Exception
  • Previous by thread: Re: csv report download -> Safari adding .html to filename?
  • Next by thread: Re: csv report download -> Safari adding .html to filename?
  • Index(es):
    • Date
    • Thread