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      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to