diff options
author | Joachim Lingner <jl@openoffice.org> | 2002-11-14 11:40:19 +0000 |
---|---|---|
committer | Joachim Lingner <jl@openoffice.org> | 2002-11-14 11:40:19 +0000 |
commit | 505b303e2229f2aa43334faad8c22a0aebf6dfc0 (patch) | |
tree | 14807fb9cd560c1cc96ca67fb3c652ed73c70fc9 /sj2 | |
parent | dbb6d63447386f8c15c4e152dbc7f2b45d38d254 (diff) |
#105128# Applet.getDocumentBase returned the URL of the document and not its directory
Diffstat (limited to 'sj2')
-rw-r--r-- | sj2/stardiv/applet/Document.java | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/sj2/stardiv/applet/Document.java b/sj2/stardiv/applet/Document.java index 63f69e07e4..e53f8aa77e 100644 --- a/sj2/stardiv/applet/Document.java +++ b/sj2/stardiv/applet/Document.java @@ -2,9 +2,9 @@ * * $RCSfile: Document.java,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:54:03 $ + * last change: $Author: jl $ $Date: 2002-11-14 12:40:19 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -89,7 +89,22 @@ class Document implements LiveConnectable { private java.awt.Toolkit toolkit; Document(URL url, java.awt.Toolkit toolkit) { - documentBase = url; + // Create the document base. + //For example, suppose an applet is contained within the document: + //http://java.sun.com/products/jdk/1.2/index.html + //The document base is: + //http://java.sun.com/products/jdk/1.2/ + + String s= url.toString(); + int index= s.lastIndexOf('/'); + if( index != -1) + { + s=s.substring(0, index + 1); + } + try{ + documentBase = new URL(s); + }catch(Exception e){ + } this.toolkit = toolkit; } |