- From: Richard Kaye <R.W.Kaye@bham.ac.uk>
- Date: Wed, 30 May 2007 23:21:16 +0100 (BST)
- To: "Chris Chiasson" <chris@chiasson.name>
- Cc: r.w.kaye@bham.ac.uk, www-math@w3.org
No trouble, but I think it is just about all there already. For this list the most important thing is that you need the server to say Content-Type: application/xhtml+xml I never got anything to work with this mimetype and some specified charset and suspect these registry keys MathPlayer adds don't work. (For text/xml it was a different matter. Presumably IE uses different rules for text/* and application/*) Tomcat (and other java servlet engines) has an HTTPServletResponse object. This has a getWriter() method that gets a Writer object that you can output the served document to with println() etc. See any "HelloWorld" servlet on the web for an example. Because the Tomcat people read the specs this way, the writer so got always sets a charset in the Content-Type response. I guess these Writer objects are intended for text data that use a charset and can't specify the charset any other way. Binary data is different, and the HTTPServletResponse object also has a getOutputStream() method intended for these, which is what I used instead. java.io.OutputStreamWriter has a constructor that makes a writer from the OutputStream by specifying a charset or using a default (which is UTF-8 in my case) and which doesn't invoke the tomcat default mechanisms that the writer from getWriter() has. The only further complication was the template resolving engine being used. Fortunately I was using velocity, and that only needed the Writer object and not the full HTTPServletResponse object. In contrast (but I didn't spend very long on this) I didn't see a way to work with JSP because that does something directly with the HTTPServletResponse object (presumably using getWriter()). In the process of all this I learnt that IE7 tries harder to display html on a file with extension ".xml" but with a file name not ending ".xml" it usually displays an xml tree (yes, that seems the wrong way round, but that is what happens...) I also learnt that some of the registry keys MathPlayer inserts with "text/xml; charset=..." are actually useful (at least for IE7) In fact, I would have liked to have seen more of these: with and without the space between ";" and "charset" (which is something that is difficult to control) and with "UTF-8" and "utf-8" in upper and lower case. But I don't know what would happen if two plug-ins (MathPlayer and something else) compete for the same mimetype however. I suppose this hasn't happened yet, but I guess it might. Oh and, Mike, yes I know my CSS is all screwed up. At least I hope that's the reason for the strange differences in appearance. I will look into that sometime soon. Richard > > If it isn't too much trouble, could you provide a link to the solution > (for the archives)? > > On 5/30/07, Richard Kaye <R.W.Kaye@bham.ac.uk> wrote: >> >> Dear all >> >> I have finally succeeded in getting my blog server to emit >> Content-Type: application/xhtml+xml >> in the HTTP header. This was with quite a lot of help from >> the support group for Tomcat and David Czarnecki who wrote >> the blog software (blojsom) I am using. The details aren't >> particularly important, except to say that it was necessary to >> treat XML data as binary data and output it to a stream rather >> than a text Writer. (Java supports all the usual encodings so >> it is almost trivial to support those other than the default >> UTF-8. This will be done.) >> >> I've tested it all quickly and it seems to work on all the >> platforms and browsers I have available, including IE+MathPLlayer. >> You can try it yourself at >> >> http://mat140.bham.ac.uk:8180/blojsom/blog/default/?flavor=xhtmlplusmathml >> >> (The output is legible, but I still need to do some design tweaks. >> You are not supposed to worry about those details right now.) >> >> I learnt a lot in the process :) Thanks everyone for your interest >> and help! >> >> Richard >> >> >> On Tue, 2007-05-29 at 14:59 -0400, Waters, Michael, Springer US wrote: >> > Hi Robert, >> > >> > Recent tests on serving static .xhtml files led me to agree with >> Richard's assessment: the problem with MathPlayer not being triggered >> "is due to the presence of "; charset=utf-8" or something in the >> server's Content-Type header". >> > >> > Just now I confirmed that observation by alternately adding and >> removing a "AddCharset UTF-8" directive to Apache's httpd.conf file. >> By adding that 1 directive, stopping/starting the server, >>AND<< >> removing the local browser cache, not just refreshing the page, I was >> able to prevent the triggering of MathPlayer on the simplest MathML >> demo page, thereby showing the XML tree. To re-enable the correct >> MathPlayer behavior, I removed the directive, stoppped/started the >> server, >>AND<< removed the local browser cache, going back to the >> default application/xhtml+xml MIME type for .xhtml and .xht files. >> > >> > I haven't looked closely at various registry settings and I'm no web >> server expert, but these quick tests indicate to me that >> "application/xhtml+xml" works in IE6+MathPlayer, but >> "application/xhtml+xml; charset=utf-8" is problematic. (I haven't yet >> tested IE7.) >> > >> > ---- >> > Mike Waters >> > Springer >> > Process and Content Management >> > ---- >> > 233 Spring St. | New York, NY 10013 | USA >> > Tel: +1 212 620-8457 >> > Fax: +1 212 647-1898 >> > mike.waters@springer.com >> > ---- >> > www.springer.com >> > www.springerlink.com >> > >> > >> > >> > >> > >> > > -----Original Message----- >> > > From: www-math-request@w3.org >> > > [mailto:www-math-request@w3.org] On Behalf Of Robert Miner >> > > Sent: Tuesday, May 29, 2007 11:49 AM >> > > To: Jacques Distler >> > > Cc: R.W.Kaye@bham.ac.uk; www-math@w3.org; William F. Hammond >> > > Subject: RE: MathML won't display (or: what triggers >> > > mathplayer behaviour?) >> > > >> > > >> > > Hi Jacques, >> > > >> > > There isn't a direct connection between the charset and the XML >> tree. >> > > But just as IE doesn't seem to always follow the rules for >> determining >> > > the encoding, it also does not play by the rules for determining the >> > > MIME type (as I'm sure you know). >> > > >> > > The XML tree shows up when IE doesn't believe the http header's >> > > declaration that the MIME type is application/xhtml+xml and doesn't >> > > start up MathPlayer. Somewhere later on, it must realize the >> document >> > > is XML at least, since it displays the tree. But at the point it is >> > > supposed to invoke MathPlayer if the MIME type is >> > > application/xhtml+xml, >> > > the call never comes, at least as far as I can determine by setting >> a >> > > breakpoint in the relevant routine in the debugger. >> > > >> > > We had been experimenting with the charset parameter, on the >> > > hypothesis >> > > that somehow that might be preventing IE from recognizing the MIME >> > > declaration in the http header. But it doesn't seem to. >> > > Mostly it seems >> > > like if the document is dynamically generated, so there isn't a file >> > > name in the http header, IE just sniffs the content and get's it >> wrong >> > > for purposes of firing off MathPlayer. At least that is what the >> > > experimental evidence seems to suggest to me. >> > > >> > > I thought perhaps Richard's comment about the BOM meant that if >> there >> > > was a BOM, suddenly IE's sniffer did the right thing and >> > > recognized the >> > > content as application/xhtml+xml and fired up MathPlayer. But I >> guess >> > > not. >> > > >> > > --Robert >> > > >> > > Robert Miner >> > > Director, New Product Development >> > > >> > > Design Science, Inc. >> > > 140 Pine Avenue, 4th Floor >> > > Long Beach, California 90802 >> > > USA >> > > Tel: (651) 223-2883 >> > > Fax: (651) 292-0014 >> > > robertm@dessci.com >> > > www.dessci.com >> > > ~ Makers of MathType, MathFlow, MathPlayer, WebEQ, Equation Editor, >> > > TexAide ~ >> > >> > >> >> >> > > > -- > http://chris.chiasson.name/ > >
Received on Wednesday, 30 May 2007 22:21:35 UTC