git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
6f2610e
)
JAL-1859 strip file name from applet documentbase
author
gmungoc
<g.m.carstairs@dundee.ac.uk>
Tue, 15 Sep 2015 15:00:52 +0000
(16:00 +0100)
committer
gmungoc
<g.m.carstairs@dundee.ac.uk>
Tue, 15 Sep 2015 15:00:52 +0000
(16:00 +0100)
src/jalview/bin/JalviewLite.java
patch
|
blob
|
history
diff --git
a/src/jalview/bin/JalviewLite.java
b/src/jalview/bin/JalviewLite.java
index
e736009
..
7cad007
100644
(file)
--- a/
src/jalview/bin/JalviewLite.java
+++ b/
src/jalview/bin/JalviewLite.java
@@
-45,6
+45,7
@@
import jalview.io.NewickFile;
import jalview.javascript.JSFunctionExec;
import jalview.javascript.JalviewLiteJsApi;
import jalview.javascript.JsCallBack;
import jalview.javascript.JSFunctionExec;
import jalview.javascript.JalviewLiteJsApi;
import jalview.javascript.JsCallBack;
+import jalview.javascript.MouseOverStructureListener;
import jalview.structure.SelectionListener;
import jalview.structure.StructureSelectionManager;
import jalview.util.MessageManager;
import jalview.structure.SelectionListener;
import jalview.structure.StructureSelectionManager;
import jalview.util.MessageManager;
@@
-979,8
+980,8
@@
public class JalviewLite extends Applet implements
return;
}
}
return;
}
}
- jalview.javascript.MouseOverStructureListener mol = new jalview.javascript.MouseOverStructureListener(
- this, listener, separatorListToArray(modelSet));
+ MouseOverStructureListener mol = new MouseOverStructureListener(this,
+ listener, separatorListToArray(modelSet));
javascriptListeners.addElement(mol);
StructureSelectionManager.getStructureSelectionManager(this)
.addStructureViewerListener(mol);
javascriptListeners.addElement(mol);
StructureSelectionManager.getStructureSelectionManager(this)
.addStructureViewerListener(mol);
@@
-2906,35
+2907,51
@@
public class JalviewLite extends Applet implements
* form a complete URL given a path to a resource and a reference location on
* the same server
*
* form a complete URL given a path to a resource and a reference location on
* the same server
*
- * @param url
+ * @param targetPath
* - an absolute path on the same server as localref or a document
* located relative to localref
* @param localref
* - a URL on the same server as url
* @return a complete URL for the resource located by url
*/
* - an absolute path on the same server as localref or a document
* located relative to localref
* @param localref
* - a URL on the same server as url
* @return a complete URL for the resource located by url
*/
- private String resolveUrlForLocalOrAbsolute(String url, URL localref)
+ private String resolveUrlForLocalOrAbsolute(String targetPath,
+ URL localref)
{
{
- String codebase = localref.toString();
- if (url.indexOf("/") == 0)
+ String resolvedPath = "";
+
+ /*
+ * get URL path and strip off any trailing file e.g.
+ * www.jalview.org/examples/index.html#applets?a=b is trimmed to
+ * www.jalview.org/examples/
+ */
+ String urlPath = localref.toString();
+ String directoryPath = urlPath;
+ int lastSeparator = directoryPath.lastIndexOf("/");
+ if (lastSeparator > 0)
{
{
+ directoryPath = directoryPath.substring(0, lastSeparator + 1);
+ }
+
+ if (targetPath.startsWith("/"))
+ {
+ /*
+ * construct absolute URL to a file on the server
+ */
String localfile = localref.getFile();
String localfile = localref.getFile();
- url = codebase.substring(0, codebase.length() - localfile.length())
- + url;
+ resolvedPath = urlPath.substring(0,
+ urlPath.length() - localfile.length())
+ + targetPath;
}
else
{
}
else
{
- url = localref + url;
+ resolvedPath = directoryPath + targetPath;
}
}
- if (true/* debug */)
+ if (debug)
{
{
- System.err.println("URL: " + localref.toString());
- System.err.println("URL.getFile: " + localref.getFile());
- System.err.println("URL.getPath: " + localref.getPath());
- System.err.println("URL.getQuery: " + localref.getQuery());
- System.err.println("resolveUrlForLocalOrAbsolute returning " + url);
+ System.err.println("resolveUrlForLocalOrAbsolute returning "
+ + resolvedPath);
}
}
- return url;
+ return resolvedPath;
}
/**
}
/**
@@
-2956,8
+2973,8
@@
public class JalviewLite extends Applet implements
URL prepend;
url = resolveUrlForLocalOrAbsolute(
url,
URL prepend;
url = resolveUrlForLocalOrAbsolute(
url,
- prepend = getDefaultParameter("resolvetocodebase", false) ? getDocumentBase()
- : getCodeBase());
+ prepend = getDefaultParameter("resolvetocodebase", false) ? getCodeBase()
+ : getDocumentBase());
if (debug)
{
System.err
if (debug)
{
System.err