summaryrefslogtreecommitdiff
path: root/sj2
diff options
context:
space:
mode:
authorJoachim Lingner <jl@openoffice.org>2002-11-14 11:40:19 +0000
committerJoachim Lingner <jl@openoffice.org>2002-11-14 11:40:19 +0000
commit932d6a581a349031e6b5f3042d5e62b31b72288f (patch)
tree54b7e55fe1491e7fcd3371e13009d312d4bbade2 /sj2
parent829aa80c3528e6ce04f94942c3d7b7330c2f5225 (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.java21
1 files changed, 18 insertions, 3 deletions
diff --git a/sj2/stardiv/applet/Document.java b/sj2/stardiv/applet/Document.java
index 7264a5420c80..1d3b4d5c174c 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;
}