X-Git-Url: https://code.grnet.gr/git/pithos/blobdiff_plain/ee81f5803eda208bd0e6f44df01a5f7188b5f2bb..b4b6e89f4ac9275f96613cc1a645b5d7c867af7d:/src/gr/ebs/gss/client/FileMenu.java
diff --git a/src/gr/ebs/gss/client/FileMenu.java b/src/gr/ebs/gss/client/FileMenu.java
index 5a0a467..63fc1f1 100644
--- a/src/gr/ebs/gss/client/FileMenu.java
+++ b/src/gr/ebs/gss/client/FileMenu.java
@@ -122,17 +122,33 @@ public class FileMenu extends PopupPanel implements ClickListener {
* and save location
*/
void createDownloadLink(String[] link, boolean forceDownload) {
+ String downloadURL = getDownloadURL();
+ if (!downloadURL.isEmpty()) {
+ link[0] = "";
+ link[1] = "";
+ }
+ }
+
+ public String getDownloadURL() {
GSS app = GSS.get();
Object selection = app.getCurrentSelection();
if (selection != null && selection instanceof FileResource) {
FileResource file = (FileResource) selection;
+ return getDownloadURL(file);
+ }
+ return "";
+ }
+
+ public String getDownloadURL(FileResource file) {
+ GSS app = GSS.get();
+ if (file != null) {
String dateString = RestCommand.getDate();
String resource = file.getUri().substring(app.getApiPath().length()-1,file.getUri().length());
String sig = app.getCurrentUserResource().getUsername()+" "+RestCommand.calculateSig("GET", dateString, resource, RestCommand.base64decode(app.getToken()));
- link[0] = "";
- link[1] = "";
+ return file.getUri() + "?Authorization=" + URL.encodeComponent(sig) + "&Date="+URL.encodeComponent(dateString);
}
+ return "";
}
public MenuBar createMenu() {