2003/09/27 06:42:26
[org.ibex.core.git] / src / org / xwt / Res.java
index bb63940..1f1a927 100644 (file)
@@ -6,6 +6,7 @@ import java.util.*;
 import java.util.zip.*;
 import org.xwt.js.*;
 import org.xwt.util.*;
+import org.bouncycastle.util.encoders.Base64;
 
 /** base class for XWT resources */
 public abstract class Res extends JS {
@@ -15,6 +16,8 @@ public abstract class Res extends JS {
     /** cache of subresources so that the equality operator works on them */
     private Hash refCache = null;
 
+    public Template t = null;
+
     public Res getParent() { return null; }
 
     /** returns an InputStream containing the Resource's contents */
@@ -50,7 +53,8 @@ public abstract class Res extends JS {
         if (url.startsWith("https://")) return new HTTP(url);
         if (url.startsWith("file:") && permitLocalFilesystem) return new File(url.substring(5));
         if (url.startsWith("cab:")) return new CAB(stringToRes(url.substring(4)));
-        throw new JS.Exn("invalid resource specifier");
+        if (url.startsWith("data:")) return new ByteArray(Base64.decode(url.substring(5)));
+        throw new JS.Exn("invalid resource specifier " + url);
     }
 
     /** HTTP or HTTPS resource */