Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4407646

JavaHelp Content Viewer displays raw html when used over https connection

    Details

    • Subcomponent:
    • Resolved In Build:
      03
    • CPU:
      sparc
    • OS:
      solaris_8
    • Verification:
      Verified

      Backports

        Description


        Scenario: JavaHelp is invoked by an applet running in the Java Plug-in (Tested with 1.3.0 and 1.3.0_01). If a secure connection (https) is being used the Content Viewer that displays the Help Topics will display raw, unrendered html.

        The original tests were made with the following configuration:

        Client: any version of MS Windows, Microsoft Internet Explorer 5.5 with the
        Java Plug-in 1.3.0_01.

        Server: a Sun server, running Apache/1.3.12 (Unix), tomcat/1.0,
        mod_ssl/2.6.6, and OpenSSL/0.9.6 on Solaris 8

        In the original test case, which can be made available, the HelpSet was built using the following code:

                private static HelpSet jh = null;
                private static HelpBroker jb = null;
                private static JApplet myApplet;

                public static void showHelp()
                {
                        if (jb == null)
                        {
                                String foobar = new String();
                                ClassLoader loader = foobar.getClass().getClassLoader();
                                URL codebase, url;
                                try
                                {
                                        codebase = myApplet.getCodeBase();
               
                                        url = new URL(codebase, "Help/Sentences_Online_Help.hs");
                                        jh = new HelpSet(loader, url);
               
                                        jb = jh.createHelpBroker();
                                } catch (Exception e)
                                {
                                        processException(e);
                                        return;
                                }
                        }
                        jb.setDisplayed(true);

        The html files for each help topic are retrieved via https using the original codebase and the required filename. The page is displayed by a subclass of JEditorPane. The problem seems to be that at some point URLConnection.getContentType() is called and this returns null because of the underlying secure connection. Normally this call to getContentType() would return "text/html".

        The problem can be simplified by removing JavaHelp from the equation. Create a plugin applet which contains a JEditorPane. Call the JEditorPane's setPage() method to load a page from the server using https as the protocol (as specified in the URL) and the page will displayed as raw, unrendered html.

        Another test can be made where a URLConnection is made back to the web server using https as the protocol and then calling getContentType() on the URLConnection. This will return null.

        In both of these cases, changing the protocol specified in URL from https to http gives the expected results, JEditorPane will render and display the html and URLConnection.getContentType() will return "text/html"

        two test cases are provided that can be deployed with a secure web server.

        The first is HttpsTestCase1.java and testcase1.html
        the second is HttpsTestCase2.java and testcase2.html

        Both are included in the file testcase.jar.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  ccheung Calvin Cheung
                  Reporter:
                  duke J. Duke (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: