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

getDocumentBase() returns the URL including file name

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.4.1
    • deploy
    • None
    • sparc
    • solaris_7

      According to the spec of Applet.getDocumentBase(), this method "Returns an
      absolute URL naming the directory of the document in which the applet is
                              ^^^^^^^^^
      embedded."

      However, the following example shows that the whole URL including HTML file name
      is returned:

      import java.applet.*;

      public class DummyApplet extends Applet {
          public void start() {
              super.start();
              System.out.println("Document Base: " + getDocumentBase());
          }
      }

      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
      <html>
      <body>
      <applet
      codebase="file:///home/alwang/pp/"
      CODE=DummyApplet
      WIDTH=500 HEIGHT=400>
      </applet>
      </body>
      </html>

      % appletviewer file:///home/alwang/pp/applet.html

      The output from AppletViewer is:

      Jul 9, 2002 2:23:20 PM java.util.prefs.FileSystemPreferences$3 run
      WARNING: Could not create system preferences directory. System preferences are unusable.
      Document Base: file:/home/alwang/pp/applet.html

            mafishersunw Margarita Fisher (Inactive)
            xwangsunw Xiaozhong Wang (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: