+ /** graft newResource in place of this resource on its parent */
+ public Res graft(Object newResource) { throw new JS.Exn("cannot graft onto this resource"); }
+
+ /** if the path of this resource does not end with extension, return a new one wit it appended */
+ public Res addExtension(String extension) { return new Ref(this, extension); }
+
+ public Object[] keys() { throw new JS.Exn("cannot enumerate a resource"); }
+ public void put(Object key, Object val) { throw new JS.Exn("cannot put to a resource"); }
+ public Object get(Object key) {
+ if ("".equals(key)) {
+ Template t = Template.getTemplate(addExtension(".xwt"));
+ return t == null ? null : t.getStatic();
+ }
+ Object ret = refCache == null ? null : refCache.get(key);
+ if (ret != null) return ret;
+ ret = new Ref(this, key);
+ if (refCache == null) refCache = new Hash();
+ refCache.put(key, ret);
+ return ret;
+ }
+
+ public static Res stringToRes(String url) { return stringToRes(url, false); }
+ public static Res stringToRes(String url, boolean permitLocalFilesystem) {