X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.eclipse.ui.rap%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Feclipse%2Fui%2Fspecific%2FFileHandler.java;fp=org.argeo.eclipse.ui.rap%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Feclipse%2Fui%2Fspecific%2FFileHandler.java;h=0000000000000000000000000000000000000000;hb=e71b1737815da9f0fdaff1ee1c69773a8c073ef1;hp=6a28c0ae4535d8e97e1990c103c7596502b3f660;hpb=0a92e95ea4c674cf408738d57917db13f336214b;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/FileHandler.java b/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/FileHandler.java deleted file mode 100644 index 6a28c0ae4..000000000 --- a/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/FileHandler.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.eclipse.ui.specific; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.ArgeoException; -import org.argeo.eclipse.ui.FileProvider; -import org.eclipse.rap.rwt.RWT; -import org.eclipse.rap.rwt.client.service.UrlLauncher; -import org.eclipse.rap.rwt.service.ServiceHandler; - -/** - * RAP SPECIFIC handler to enable the opening of a download dialog box triggered - * by whatever action in the UI - * - * Manages the registration of the effective DownloadServiceHandler at - * instantiation time. - * - * Manages the process of forwarding the request to the handler at runtime to - * open the dialog box encodedURL - */ -@Deprecated -public class FileHandler { - public final static String DOWNLOAD_SERVICE_NAME = "argeo.rap.download.service"; - private final static Log log = LogFactory.getLog(FileHandler.class); - - public FileHandler(FileProvider provider) { - ServiceHandler handler = new DownloadServiceHandler(provider); - try { - RWT.getServiceManager().registerServiceHandler( - DOWNLOAD_SERVICE_NAME, handler); - } catch (IllegalArgumentException iae) { - log.warn("Handler is already registered, clean this registering process"); - } - } - - public void openFile(String fileName, String fileId) { - try { - String downloadUrl = RWT.getServiceManager().getServiceHandlerUrl( - DOWNLOAD_SERVICE_NAME) - + createParamUrl(fileName, fileId); - if (log.isTraceEnabled()) - log.debug("URL : " + downloadUrl); - UrlLauncher launcher = RWT.getClient() - .getService(UrlLauncher.class); - launcher.openURL(downloadUrl); - } catch (Exception e) { - throw new ArgeoException("Unable to open file " + fileName, e); - } - // These lines are useless in the current use case but might be - // necessary with new browsers. Stored here for memo - // response.setContentType("application/force-download"); - // response.setHeader("Content-Disposition", contentDisposition); - // response.setHeader("Content-Transfer-Encoding", "binary"); - // response.setHeader("Pragma", "no-cache"); - // response.setHeader("Cache-Control", "no-cache, must-revalidate"); - } - - private String createParamUrl(String filename, String fileId) { - StringBuilder url = new StringBuilder(); - url.append("&filename="); - url.append(filename); - url.append("&fileid="); - url.append(fileId); - return url.toString(); - } -} \ No newline at end of file