X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=eclipse%2Fruntime%2Forg.argeo.eclipse.ui.rap%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Feclipse%2Fui%2Fspecific%2FFileHandler.java;h=ad551b47939e657625c8622af6c8830040262ad5;hb=1d5afdce3e91054f07ddd3c98309c363b4cf1d46;hp=f873f1a524cf0c078dfa73a120f929cde74916df;hpb=a99d11e0c2696ff1a4a258adaa94d137440c8d6c;p=lgpl%2Fargeo-commons.git diff --git a/eclipse/runtime/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/FileHandler.java b/eclipse/runtime/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/FileHandler.java index f873f1a52..ad551b479 100644 --- a/eclipse/runtime/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/FileHandler.java +++ b/eclipse/runtime/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/FileHandler.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2007-2012 Mathieu Baudier + * + * 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 java.net.URL; @@ -19,10 +34,9 @@ import org.eclipse.ui.PlatformUI; * Manages the process of forwarding the request to the handler at runtime to * open the dialog box * - * @author bsinou - * */ public class FileHandler { + public final static String FORCED_DOWNLOAD_URL_BASE_PROPERTY = "argeo.rap.specific.forcedDownloadUrlBase"; private final static Log log = LogFactory.getLog(FileHandler.class); @@ -41,8 +55,8 @@ public class FileHandler { // http://www.eclipse.org/forums/index.php?t=msg&th=205487&start=0&S=43d85dacc88b505402420592109c7240 try { - if (log.isDebugEnabled()) - log.debug("URL : " + createFullDownloadUrl(fileName, fileId)); + if (log.isTraceEnabled()) + log.trace("URL : " + createFullDownloadUrl(fileName, fileId)); URL url = new URL(createFullDownloadUrl(fileName, fileId)); PlatformUI.getWorkbench().getBrowserSupport() @@ -62,7 +76,14 @@ public class FileHandler { private String createFullDownloadUrl(String fileName, String fileId) { StringBuilder url = new StringBuilder(); - url.append(RWT.getRequest().getRequestURL()); + // in case RAP is proxied we need to specify the actual base URL + // TODO find a cleaner way + String forcedDownloadUrlBase = System + .getProperty(FORCED_DOWNLOAD_URL_BASE_PROPERTY); + if (forcedDownloadUrlBase != null) + url.append(forcedDownloadUrlBase); + else + url.append(RWT.getRequest().getRequestURL()); url.append(createParamUrl(fileName, fileId)); return url.toString(); }