+/*
+ * 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;
* 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);
// 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()
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();
}