JDK-4712311 : getDocumentBase() returns the URL including file name
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 1.4.1
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_7
  • CPU: sparc
  • Submitted: 2002-07-09
  • Updated: 2002-07-16
  • Resolved: 2002-07-16
Related Reports
Duplicate :  
Description
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


Comments
EVALUATION This is a documentation bug. Duplicate of bug#4710854. ###@###.### 2002-07-16
16-07-2002