• 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: Content-type changing somewhere
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Content-type changing somewhere


  • Subject: Re: Content-type changing somewhere
  • From: Miguel Arroz <email@hidden>
  • Date: Fri, 12 Oct 2007 21:24:00 +0100

Hi!

  Ok, sometimes a dinner pause is really worth it.

I remembered I had, in Application, the method in Chuck's book to add the "utf-8" part to the content type, so that it works on IE... that was trashing the content-type.

  I changed it to:

public void appendToResponse(WOResponse response, WOContext context) {
super.appendToResponse(response, context);
if( _NSUtilities.UTF8StringEncoding.equals (response.contentEncoding()) && response.headerForKey("Content- Type").equals("text/html") )
response.setHeader("text/html; charset=UTF-8", "Content- Type");


  }

Now it checks to see if the content type has been changed to something other than text/html before applying it's patch, and binary (excel) files are being downloaded correctly.

Could this also be your problem? Look for "appendToResponse" methods on "important" classes.

  Yours

Miguel Arroz

On 2007/10/12, at 19:48, Steven Mark McCraw wrote:

Miguel,

Totally weird, I just started having the same exact issue. I still haven't tracked down where the content type is getting changed, but I did find a workaround that seems to be holding for now (at least, it's a workaround for my problem). I was using response.setHeader (contentType, "content-type". Notice the capitalization in the key. This worked just fine for years, but recently, it started yielding the exact behavior you are describing. My workaround was to change "content-type" to "Content-Type". But it looks like you are already doing that, so there's probably something else going on here. If you find anything, please post it to the list and I will do the same.

Thanks,
Mark

On Oct 12, 2007, at 2:37 PM, Miguel Arroz wrote:

Hi!

I'm setting up a component with an element inside, so that I can download a file.

My problem is in the content type. On the element code, I do: response.setHeader(contentType, "Content-Type");

I'm absolutely sure that the content-type is being set to the Excel content type (I NSlogged it just above that line).

When the browser receives it, the Content-type is back to plain text, and the file is saved as whatever.xls.html on Safari. On Firefox ir works, but Firebug shows the content type is not what I set it to be.

As the headers are a dictionary, it's hard to watch for changes on the debugger. So, my question is, how can I track down who's changing my content type?

  Yours

Miguel Arroz

Miguel Arroz
http://www.terminalapp.net
http://www.ipragma.com



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40bluecollarsoftware.com


This email sent to email@hidden


Miguel Arroz http://www.terminalapp.net http://www.ipragma.com



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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: 
 >Content-type changing somewhere (From: Miguel Arroz <email@hidden>)
 >Re: Content-type changing somewhere (From: Steven Mark McCraw <email@hidden>)

  • Prev by Date: Re: Content-type changing somewhere
  • Next by Date: Re: Content-type changing somewhere
  • Previous by thread: Re: Content-type changing somewhere
  • Next by thread: Re: Content-type changing somewhere
  • Index(es):
    • Date
    • Thread