[kune-commits] r892 - in trunk/src/main/java/org/ourproject/kune/platf/client/ui: . download

vjrj vjrj at ourproject.org
Mon Sep 29 10:47:04 CEST 2008


Author: vjrj
Date: 2008-09-29 10:47:04 +0200 (Mon, 29 Sep 2008)
New Revision: 892

Added:
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/download/
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/download/FileDownloadUtils.java
Log:
ya estamos con errores en el svn y si la abuela fuma

Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/download/FileDownloadUtils.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/download/FileDownloadUtils.java	2008-09-29 08:35:20 UTC (rev 891)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/download/FileDownloadUtils.java	2008-09-29 08:47:04 UTC (rev 892)
@@ -0,0 +1,34 @@
+package org.ourproject.kune.platf.client.ui.download;
+
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.state.Session;
+
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.ui.RootPanel;
+
+public class FileDownloadUtils {
+
+    private static final String DOWNLOADSERVLET = "/kune/servlets/FileDownloadManager";
+
+    private final Session session;
+
+    public FileDownloadUtils(final Session session) {
+	this.session = session;
+    }
+
+    public void downloadFile(final StateToken token) {
+	final String url = calculateUrl(token, true);
+	DOM.setElementAttribute(RootPanel.get("__download").getElement(), "src", url);
+    }
+
+    public String getImageUrl(final StateToken token) {
+	return calculateUrl(token, false);
+    }
+
+    private String calculateUrl(final StateToken token, final boolean download) {
+	final String url = DOWNLOADSERVLET + "?token=" + token + "&hash=" + session.getUserHash() + "&download="
+		+ (download ? "true" : "false");
+	return url;
+    }
+
+}




More information about the kune-commits mailing list