1 19 20 package com.sslexplorer.navigation.forms; 21 22 import java.awt.Rectangle ; 23 24 import javax.servlet.http.HttpServletRequest ; 25 26 import org.apache.commons.logging.Log; 27 import org.apache.commons.logging.LogFactory; 28 29 import com.sslexplorer.boot.Util; 30 import com.sslexplorer.core.CoreUtil; 31 import com.sslexplorer.core.DownloadContent; 32 import com.sslexplorer.core.WindowOpenJavascriptLink; 33 import com.sslexplorer.core.forms.CoreForm; 34 import com.sslexplorer.security.LogonControllerFactory; 35 import com.sslexplorer.security.SessionInfo; 36 37 43 public class FileDownloadForm extends CoreForm { 44 45 static Log log = LogFactory.getLog(FileDownloadForm.class); 46 47 50 public final static int WINDOW_WIDTH = 790; 51 52 55 public final static int WINDOW_HEIGHT = 480; 56 57 private DownloadContent download; 58 59 62 public void init(DownloadContent download) { 63 this.download = download; 64 } 65 66 69 public DownloadContent getDownload() { 70 return download; 71 } 72 73 79 public String getTempDownloadLink(HttpServletRequest request){ 80 SessionInfo session = LogonControllerFactory.getInstance().getSessionInfo(request); 81 WindowOpenJavascriptLink windowOpenJavascriptLink = new WindowOpenJavascriptLink("fileSystem.do?actionTarget=list&path=" + Util.urlEncode("temp/" + session.getUser().getPrincipalName() + "." 82 + session.getHttpSession().getId())+ "&resourceId=0", 83 "vfs_" + "0" + "_" + System.currentTimeMillis(), 84 new Rectangle (20, 20, WINDOW_WIDTH, WINDOW_HEIGHT), true, false, false, true, false); 85 return "javascript: " + windowOpenJavascriptLink.toJavascript(); 86 } 87 88 91 public String getReferer() { 92 String tmpReferer = super.getReferer(); 93 if (tmpReferer == null){ 95 return "window.location = '/showHome.do'"; 96 } 97 return tmpReferer; 98 } 99 100 103 public String getLink() { 104 return "/fileDownload.do?id=" + download.getId(); 105 } 106 } | Popular Tags |