+
+ /*
+ * try relative to document root
+ */
+ URL documentBase = getDocumentBase();
+ String withDocBase = resolveUrlForLocalOrAbsolute(path, documentBase);
+ if (HttpUtils.isValidUrl(withDocBase))
+ {
+ if (debug)
+ {
+ System.err.println("Prepended document base '" + documentBase
+ + "' to make: '" + withDocBase + "'");
+ }
+ protocol = DataSourceType.URL;
+ return withDocBase;
+ }
+
+ /*
+ * try relative to codebase (if different to document base)
+ */
+ URL codeBase = getCodeBase();
+ String withCodeBase = applet.resolveUrlForLocalOrAbsolute(path,
+ codeBase);
+ if (!withCodeBase.equals(withDocBase)
+ && HttpUtils.isValidUrl(withCodeBase))
+ {
+ protocol = DataSourceType.URL;
+ if (debug)
+ {
+ System.err.println("Prepended codebase '" + codeBase
+ + "' to make: '" + withCodeBase + "'");
+ }
+ return withCodeBase;
+ }
+
+ /*
+ * try locating by classloader; try this last so files in the directory
+ * are resolved using document base
+ */
+ if (inArchive(path))