Fixed download servlet passing parameter contextId correctly

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@134804 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-11-25 14:23:28 +00:00
parent 6e9a534c05
commit 181965e694
2 changed files with 10 additions and 8 deletions

View File

@ -5,6 +5,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import org.gcube.portal.clientcontext.client.GCubeClientContext;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer.WS_UPLOAD_TYPE;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer.WsPortletInitOperation;
import org.gcube.portlets.user.workspace.client.event.AccountingHistoryEvent;
@ -938,7 +939,10 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
if(fileDownloadEvent.getItemName()!= null){
try {
new RequestBuilderWorkspaceValidateItem(RequestBuilder.GET, ConstantsExplorer.DOWNLOAD_WORKSPACE_SERVICE, "id="+fileDownloadEvent.getItemIdentifier()+"&viewContent=true", "_blank", downloadHandlerCallback);
// Add currentContextId parameter
String currentContextId = GCubeClientContext.getCurrentContextId();
String queryString = "id="+fileDownloadEvent.getItemIdentifier()+"&viewContent=true&"+ConstantsExplorer.CONTEXT_ID+"="+currentContextId;
new RequestBuilderWorkspaceValidateItem(RequestBuilder.GET, ConstantsExplorer.DOWNLOAD_WORKSPACE_SERVICE, queryString, "_blank", downloadHandlerCallback);
} catch (Exception e) {
explorerPanel.getAsycTreePanel().unmask();
@ -957,7 +961,10 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
else {
try {
new RequestBuilderWorkspaceValidateItem(RequestBuilder.GET,ConstantsExplorer.DOWNLOAD_WORKSPACE_SERVICE, "id="+fileDownloadEvent.getItemIdentifier(), "_self", downloadHandlerCallback);
// Add currentContextId parameter
String currentContextId = GCubeClientContext.getCurrentContextId();
String queryString = "id="+fileDownloadEvent.getItemIdentifier()+"&"+ConstantsExplorer.CONTEXT_ID+"="+currentContextId;
new RequestBuilderWorkspaceValidateItem(RequestBuilder.GET,ConstantsExplorer.DOWNLOAD_WORKSPACE_SERVICE, queryString, "_self", downloadHandlerCallback);
} catch (Exception e) {
explorerPanel.getAsycTreePanel().unmask();
new MessageBoxAlert("Error", e.getMessage(), null);

View File

@ -3,7 +3,6 @@
*/
package org.gcube.portlets.user.workspace.client.util;
import org.gcube.portal.clientcontext.client.GCubeClientContext;
import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import org.gcube.portlets.user.workspace.client.event.SessionExpiredEvent;
@ -64,10 +63,6 @@ public class RequestBuilderWorkspaceValidateItem {
else
httpQueryString +="&"+ConstantsExplorer.VALIDATEITEM+"=true";
// Add hidden parameters
String currentContextId = GCubeClientContext.getCurrentContextId();
httpQueryString+="&"+ConstantsExplorer.CONTEXT_ID+"="+currentContextId;
String urlRequest = servletName+"?"+httpQueryString;
GWT.log("request builder for: "+urlRequest);
@ -99,7 +94,7 @@ public class RequestBuilderWorkspaceValidateItem {
}else { //OK STATUS
if(callback!=null)
callback.onSuccess(new WindowOpenParameter(targetWindow, "", httpQueryString, true, newBrowserWindow));
callback.onSuccess(new WindowOpenParameter(targetWindow, "", params, true, newBrowserWindow));
}
}