Added GCubeClientContext in gwt.xml and used before call the
GeoportalExporterAction Servlet
This commit is contained in:
parent
50fac5143d
commit
c2a930b112
|
@ -17,11 +17,14 @@
|
|||
|
||||
<inherits name="com.google.gwt.json.JSON" />
|
||||
|
||||
<inherits
|
||||
name='org.gcube.portal.clientcontext.GCubeClientContext' />
|
||||
|
||||
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
|
||||
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
|
||||
|
||||
<!-- Other module inherits -->
|
||||
|
||||
|
||||
<servlet path="/geoportalexporterservice"
|
||||
class="org.gcube.portlets.user.geoportaldataviewer.server.GeoportalExporterActionServlet" />
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ public class GeoportalDataViewerConstants {
|
|||
//WAITING_SERVER_ACTION_SERVLET
|
||||
public static final String UCD_ID_PARAMETER = "ucdID";
|
||||
public static final String PROIECT_ID_PARAMETER = "projectID";
|
||||
public static final String CONTEXT_ID_PARAMETER = "contextID";
|
||||
public static final String GEOPORTAL_EXPORT_ACTION_SERVLET = GWT.getModuleBaseURL()
|
||||
+ "geoportalexporterservice";
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
|||
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.SectionView;
|
||||
import org.gcube.portal.clientcontext.client.GCubeClientContext;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
||||
|
@ -222,12 +223,15 @@ public class ProjectViewer extends Composite {
|
|||
// TODO: handle exception
|
||||
}
|
||||
|
||||
String currentContextId = GCubeClientContext.getCurrentContextId();
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append(GeoportalDataViewerConstants.GEOPORTAL_EXPORT_ACTION_SERVLET + "?");
|
||||
builder.append(GeoportalDataViewerConstants.UCD_ID_PARAMETER + "="
|
||||
+ projectView.getTheProjectDV().getProfileID() + "&");
|
||||
builder.append(GeoportalDataViewerConstants.PROIECT_ID_PARAMETER + "="
|
||||
+ projectView.getTheProjectDV().getId());
|
||||
+ projectView.getTheProjectDV().getId() + "&");
|
||||
builder.append(GeoportalDataViewerConstants.CONTEXT_ID_PARAMETER + "=" + currentContextId);
|
||||
|
||||
String geoportalExportActionServlet = builder.toString();
|
||||
NewBrowserWindow.open(geoportalExportActionServlet, "_blank", null);
|
||||
|
|
|
@ -16,10 +16,12 @@ import javax.servlet.http.HttpServletResponse;
|
|||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.GeoportalServiceIdentityProxy;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
||||
import org.gcube.portlets.user.uriresolvermanager.geoportal.GeoportalExporterAPI;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -59,12 +61,19 @@ public class GeoportalExporterActionServlet extends HttpServlet {
|
|||
// setSecretManager();
|
||||
String projectID = req.getParameter(GeoportalDataViewerConstants.PROIECT_ID_PARAMETER);
|
||||
String ucdID = req.getParameter(GeoportalDataViewerConstants.UCD_ID_PARAMETER);
|
||||
|
||||
logger.info("doGet called with Input Params [projectID: " + projectID + ", ucdID: " + ucdID + "]");
|
||||
|
||||
String contextID = req.getParameter(GeoportalDataViewerConstants.CONTEXT_ID_PARAMETER);
|
||||
logger.info("doGet called with [projectID: " + projectID + ", ucdID: " + ucdID + ", contextID: " + contextID + "]");
|
||||
|
||||
if(contextID==null || contextID.isEmpty())
|
||||
sendError(resp, "Bad Request. No context found!");
|
||||
|
||||
PortalContext pContext = PortalContext.getConfiguration();
|
||||
GCubeUser gcubeUser = pContext.getCurrentUser(req);
|
||||
String scope = pContext.getCurrentScope(contextID);
|
||||
logger.info("User caller fullname is {}, scope {}", gcubeUser.getFullname(), scope);
|
||||
|
||||
try {
|
||||
String scope = SessionUtil.getCurrentContext(req, true);
|
||||
logger.info("the scope is: "+scope);
|
||||
ScopeProvider.instance.set(scope);
|
||||
GeoportalServiceIdentityProxy identity = new GeoportalServiceIdentityProxy(req);
|
||||
String theToken = identity.getToken();
|
||||
String theIdentity = identity.getIdentity();
|
||||
|
|
|
@ -17,11 +17,14 @@
|
|||
|
||||
<inherits name="com.google.gwt.json.JSON" />
|
||||
|
||||
<inherits
|
||||
name='org.gcube.portal.clientcontext.GCubeClientContext' />
|
||||
|
||||
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
|
||||
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
|
||||
|
||||
<!-- Other module inherits -->
|
||||
|
||||
|
||||
<servlet path="/geoportalexporterservice"
|
||||
class="org.gcube.portlets.user.geoportaldataviewer.server.GeoportalExporterActionServlet" />
|
||||
|
||||
|
|
Loading…
Reference in New Issue