From 6eb009db417c28f3f0c4d25153151dbced9c7e1d Mon Sep 17 00:00:00 2001 From: Bruno Sinou Date: Fri, 17 Jan 2014 15:49:06 +0000 Subject: [PATCH] Go on working on the rap specific file download issue. New better name for command and service before it is used. https://www.argeo.org/bugzilla/show_bug.cgi?id=188 git-svn-id: https://svn.argeo.org/commons/trunk@6725 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- ...dService.java => DownloadFsFileService.java} | 11 +++++++---- .../{SimpleOpenFile.java => OpenFsFile.java} | 17 ++++++++++------- 2 files changed, 17 insertions(+), 11 deletions(-) rename base/runtime/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/{FileDownloadService.java => DownloadFsFileService.java} (87%) rename base/runtime/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/{SimpleOpenFile.java => OpenFsFile.java} (80%) diff --git a/base/runtime/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/FileDownloadService.java b/base/runtime/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/DownloadFsFileService.java similarity index 87% rename from base/runtime/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/FileDownloadService.java rename to base/runtime/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/DownloadFsFileService.java index e5eb8fcae..14915c873 100644 --- a/base/runtime/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/FileDownloadService.java +++ b/base/runtime/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/DownloadFsFileService.java @@ -26,12 +26,15 @@ import org.apache.commons.io.FileUtils; import org.argeo.ArgeoException; import org.eclipse.rap.rwt.service.ServiceHandler; -/** Provide a basic handler that returns a file from the file system in Rap. */ -public class FileDownloadService implements ServiceHandler { +/** + * Basic service handler that retrieves a file in the server file system using + * an absolute path and forward it to the end user browser. Rap specific. + */ +public class DownloadFsFileService implements ServiceHandler { public final static String PARAM_FILE_NAME = "param.fileName"; public final static String PARAM_FILE_PATH = "param.filePath"; - - public FileDownloadService() { + + public DownloadFsFileService() { } public void service(HttpServletRequest request, HttpServletResponse response) diff --git a/base/runtime/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/SimpleOpenFile.java b/base/runtime/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/OpenFsFile.java similarity index 80% rename from base/runtime/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/SimpleOpenFile.java rename to base/runtime/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/OpenFsFile.java index f8ee3b1a3..b1b21b756 100644 --- a/base/runtime/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/SimpleOpenFile.java +++ b/base/runtime/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/OpenFsFile.java @@ -24,18 +24,21 @@ import org.eclipse.rap.rwt.RWT; import org.eclipse.rap.rwt.client.service.UrlLauncher; /** - * Rap specific handler to open a file stored in the server file system, among - * other tmp files created for exports. + * Rap specific command handler to open a file stored in the server file system. + * The file absolute path and name must be passed as parameters. + * + * It relies on an existing {@link DownloadFsFileService} to forward the + * corresponding file to the user browser. * */ -public class SimpleOpenFile extends AbstractHandler { - private final static Log log = LogFactory - .getLog(SimpleOpenFile.class); +public class OpenFsFile extends AbstractHandler { + private final static Log log = LogFactory.getLog(OpenFsFile.class); + /* DEPENDENCY INJECTION */ private String serviceId; - public final static String PARAM_FILE_NAME = FileDownloadService.PARAM_FILE_NAME; - public final static String PARAM_FILE_PATH = FileDownloadService.PARAM_FILE_PATH; + public final static String PARAM_FILE_NAME = DownloadFsFileService.PARAM_FILE_NAME; + public final static String PARAM_FILE_PATH = DownloadFsFileService.PARAM_FILE_PATH; public Object execute(ExecutionEvent event) throws ExecutionException { String fileName = event.getParameter(PARAM_FILE_NAME); -- 2.30.2