+ /**
+ * Returns the first out of: file, file prefixed by document base, or file
+ * prefixed by codebase which can be resolved to a valid URL. If none can,
+ * returns the input parameter value.
+ *
+ * @param file
+ */
+ public String resolveModelFile(String file)
+ {
+ // TODO reuse JalviewLite.LoadingThread.addProtocol instead
+ if (HttpUtils.isValidUrl(file))
+ {
+ return file;
+ }
+
+ String db = jvlite.getDocumentBase().toString();
+ db = db.substring(0, db.lastIndexOf("/"));
+ String docBaseFile = db + "/" + file;
+ if (HttpUtils.isValidUrl(docBaseFile))
+ {
+ return docBaseFile;
+ }
+
+ String cb = jvlite.getCodeBase() + file;
+ if (HttpUtils.isValidUrl(cb))
+ {
+ return cb;
+ }
+
+ return file;
+ }
+