Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 317215

Summary: Help content containing MathML is not rendered correctly in Infocenter
Product: [Eclipse Project] Platform Reporter: David Rawlins <rawlins>
Component: User AssistanceAssignee: Chris Goldthorpe <cgold>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: cgold
Version: 4.0   
Target Milestone: 3.7 M6   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Test file for MathML output
none
Test file for MathML output
none
Patch to always allow application/xhtml+xml
none
Patch which allows application/xhtml+xml for all Mozilla based browsers none

Description David Rawlins CLA 2010-06-17 12:37:39 EDT
Build Identifier: 20100218-1602

The Eclipse Infocenter (run in Firefox) is serving xhtml help content pages as html so that mathml tags are being ignored.

Reproducible: Always

Steps to Reproduce:
1. Create User Assistance plugin containing xhtml pages with mathml
2. Save UA plugin in plugins directory
3. Launch the Infocenter and browse to it in Firefox
Comment 1 Chris Goldthorpe CLA 2010-06-18 14:21:50 EDT
Can you attach an example of a page which has problems displaying?
Comment 2 David Rawlins CLA 2010-06-21 14:45:27 EDT
Created attachment 172355 [details]
Test file for MathML output

This is a small sample MathML file created by Firemath in Firefox.  It should display the equation: x^2 = sqrt(y), with x in bold.
Comment 3 David Rawlins CLA 2010-06-21 14:47:12 EDT
I've added a small sample MathML file.  It should display correctly if opened in Firefox.
Comment 4 Chris Goldthorpe CLA 2010-06-21 17:54:25 EDT
I tried your example and as was able to reproduce tbe behavior you described. The first thing I noticed was that the content type of the page returned from the server is "text/html". Setting the content type to "application/xhtml+xml" only seems to make the situation worse, I see this error message displayed in the content frame with a yellow background:

Error loading stylesheet: A network error occured loading an XSLT stylesheet:http://127.0.0.1:3433/help/topic/b317215/html/pmathml.xsl - http://127.0.0.1:3433 is the host/port on which I have help running. 

This is the same error message I see if I try to open the Test file for MathML output attachment from Bugzilla using Firefox.

If I could solve the second problem I could look into how to set the content type to "application/xhtml+xml" when the content is xhtml.
Comment 5 David Rawlins CLA 2010-06-22 11:33:14 EDT
Created attachment 172430 [details]
Test file for MathML output

My apologies - I realized that the previous file was pointing to a local style sheet.  Try this one.

Thanks,

Dave
Comment 6 Chris Goldthorpe CLA 2010-06-22 15:54:18 EDT
Targeting Eclipse 3.7. The solution will be to allow the mime type to be "application/xhtml+xml" if the client is Firefox. Currently there is code in the help server which prevents "application/xhtml+xml" from being returned as the content type because when IE sees that content type it asks if you want to download the file rather than displaying it. I have not yet tested other browsers to see how they handle this mime type, probably the safest thing to do is to leave the current behavior unchanged for all browsers other than Firefox and maybe also Opera - both have native support for MathML.
Comment 7 David Rawlins CLA 2010-06-22 19:04:59 EDT
Internet Explorer will also work by installing MathPlayer from http://www.dessci.com/en/products/mathplayer/

Dave
Comment 8 Chris Goldthorpe CLA 2010-06-23 17:07:43 EDT
I was able to get IE to display the Math extensions however the problem I still need to solve is how to get the content type correct for all users.

If IE with no extensions sees a content type of "application/xhtml+xml" it will not display the page because it does not recognize the content type. For this reason the help server sets the content type to "text/html" in place of "application/xhtml+xml".

On the other hand the equations will not display correctly in IE even if it contains the addin to handle Mathml if the content type is set to "text/html". 

I'm not sure how to handle setting the content type correctly for IE. For Opera and Firefox it's fairly easy to get the Math to show correctly.
Comment 9 David Rawlins CLA 2010-06-28 18:54:48 EDT
For our application we warn IE users to install MathPlayer before opening the InfoCenter.  Is it possible to edit Eclipse 3.5 to allow the mime type to be
"application/xhtml+xml"?  If so, could you give me instructions?

Thanks,

Dave
Comment 10 Chris Goldthorpe CLA 2010-06-30 17:00:19 EDT
Created attachment 173157 [details]
Patch to always allow application/xhtml+xml

This patch will allow the content type "application/xhtml+xml" to be returned
for all browsers. It is not recommended for IE users who do not have extensions
to handle xml.
Comment 11 David Rawlins CLA 2010-07-21 17:27:50 EDT
I tried applying the patch to org.eclipse.help.webapp_3.4.1.v20091009_35x.jar in Eclipse 3.5.2, build 20100218-1602, but when I replace the above plugin with the rebuilt one I get the following error when launching Help:

HTTP ERROR 404

Problem accessing /help/index.jsp. Reason:

    ProxyServlet: /help/index.jsp

Powered by Jetty://

I notice that when comparing the new jar file with the old one, the new jar file does not include the directory /org/eclipse/help/internal/webapp/jsp.  There is also a warning in the file plugin.xml that the file schema/contentFilter.exsd does not exist.
Comment 12 Chris Goldthorpe CLA 2010-07-22 17:08:43 EDT
If you are missing /org/eclipse/help/internal/webapp/jsp that would explain the error message. Did you create the bundle using export/Deployable plugins and fragments?
Comment 13 David Rawlins CLA 2010-07-22 18:41:38 EDT
Yes, I used export/Deployable plugins and fragments.

The good news is that the org.eclipse.help.webapp plugin with the patch works if I click the link Overview>Testing>"Launch an Eclipse application".

I'm wondering if the extension point warning is causing the jsp directory not to be included.  Here is the line in plugin.xml that is giving the warning: "schema/contentFilter.exsd" does not reference a schema file:

   <extension-point id="contentFilter" name="%content_filter_extension_name" schema="schema/contentFilter.exsd"/>
Comment 14 Chris Goldthorpe CLA 2010-07-22 20:17:11 EDT
The missing extension point schema file is due to  Bug 318072. This would not affect the ability of the webapp to start, it would just make it harder to use the extension point because the plug-in manifest editor would not know the structure of the extension point.

I'm thinking that the reason why you don't have /org/eclipse/help/internal/webapp/jsp is because that directory contains the precompiled jsps. Usually the webapp will start regardless of whether or not thes precompiled jsps exist because they will be compiled on demand, however that requires the jsp compiler, jasper to be in your application, which I'm guessing is not true.

Try running the ant script buildJSPs.xml -that will compile the jsps and may just solve your problem.
Comment 15 David Rawlins CLA 2010-07-26 17:42:13 EDT
I don't have the ant script buildJSPs.xml in my eclipse distribution (should I?), but can can download it from http://dev.eclipse.org/viewsvn/index.cgi/org.eclipse.help.webapp/buildJSPs.xml.  Is that what I want?
Comment 16 David Rawlins CLA 2010-07-26 18:03:52 EDT
I ran the ant script above, but I'm still getting the same error.  I also tried adding the jsp directory from the original plugin jar file to the new one, but that didn't work either.
Comment 17 Chris Goldthorpe CLA 2010-07-26 18:36:36 EDT
I can't figure out what's happening then. It sounds as though you are missing the compiled jsp class files.  Can you read any other files from the help system, such as html files?
Comment 18 David Rawlins CLA 2010-07-26 18:44:32 EDT
The error in comment 11 occurs when I click on Help>Help Contents, so no, I can't read html files from the help system.
Comment 19 David Rawlins CLA 2010-07-27 17:26:51 EDT
Here are the steps I took to produce the plugin.  Let me know if there is anything I am missing.

1.Start with Eclipse 3.5 build id 20100218-1602
2.Import > Plug-ins and Fragments
    a.Import From: The active target platform
    b.Import As: Projects with source folders
    c.Selection: org.eclipse.help.webapp
3.Apply patch to src/org/eclipse/help/internal/webapp/servlet/EclipseConnector.java
4.Project > Build Project
5.Copy buildJSPs.xml to project folder
6.Run builJSPs.xml as Ant Build
7.Export > Deployable plug-ins and fragments
    a.Select: org.eclipse.help.webapp (I renamed the version to 3.4.1.v20100727)
8.Move eclipse/plugins/org.eclipse.help.webapp_3.4.1.v20091009_35x.jar to eclipse/temp
9.Copy org.eclipse.help.webapp_3.4.1.v20100727.jar to eclipse/plugins
10.Restart eclipse

If you don't see anything I am doing wrong, is it possible for you to upload your new version of org.eclipse.help.webapp?

Thanks,

Dave
Comment 20 Chris Goldthorpe CLA 2010-07-27 18:02:30 EDT
I can't immediately see anything wrong with your steps. Unfortunately I don't have a lot of time to look into this today as I have another fire to fight. I'm guessing that one of the following is happening:

a) The help server is not starting
b) The help server is starting but is not locating any resources
c) The help server has started and can display some things but not others.

My guess is (c)

If you can debug and put a breakpoints in JettyHelpServer.start() and JettyHelpServer.checkBundle() you can determine whether the help system was able to start up and if so what port was assigned. If the help system started and got a port number you can then try to open a url such as http://localhost:<port>/help/about.html . If that opens the help system has started and the problem is somewhere in the jsp processing.
Comment 21 David Rawlins CLA 2010-07-28 14:44:27 EDT
When I go to Help > About Eclipse > Installations Details > Plugins, org.eclipse.help.webapp_3.4.1.v20100727.jar is not being loaded.
Comment 22 David Rawlins CLA 2010-08-10 14:24:09 EDT
Is the plugin not being loaded an issue that can be resolved, or should I look into another system for my help documentation needs?
Comment 23 Chris Goldthorpe CLA 2010-08-10 14:46:02 EDT
The plug-in not being loaded is the problem and is definitely solvable. Copying a new plug-in to the plugins directory using the same name as the one it is replacing should work, however there is an easier way to replace one plug-in. File/Export/Deployable Plugins and Fragments will take you to a dialog where you have the option to install into host repository, which will replace the plug-in and do the necessary bookkeeping to let the Eclipse runtime know to use this new plug-in.
Comment 24 David Rawlins CLA 2010-08-11 13:35:10 EDT
Thanks!  Copying the plugin with the same name did the trick!
Comment 25 Chris Goldthorpe CLA 2011-02-15 14:54:40 EST
Created attachment 189041 [details]
Patch which allows application/xhtml+xml for all Mozilla based browsers
Comment 26 Chris Goldthorpe CLA 2011-02-15 15:02:04 EST
I have committed the patch which allows the application/xhtml+xml mime type for
all Mozilla based browsers. I had considered adding a customization preference
to control this behavior but I think that most users will find it easier to use
a different browser rather than editing plugin_customization.ini.