fixed path info redirect
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@129184 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
67faf855c2
commit
a1f5e29d65
|
@ -14,29 +14,11 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
|||
@RemoteServiceRelativePath("ckandatacatalogue")
|
||||
public interface GcubeCkanDataCatalogService extends RemoteService {
|
||||
|
||||
/**
|
||||
* Gets the c kan connector.
|
||||
*
|
||||
* @param pathInfoParameters the path info parameters
|
||||
* @param queryStringParameters the query string parameters
|
||||
* @return the c kan connector
|
||||
* @throws Exception
|
||||
*/
|
||||
|
||||
String getCKanConnector(
|
||||
String pathInfoParameters, String queryStringParameters) throws Exception;
|
||||
|
||||
/**
|
||||
* Gets the my role.
|
||||
*
|
||||
* @return the my role
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
CkanRole getMyRole() throws Exception;
|
||||
|
||||
/**
|
||||
* Asks who is the current user.
|
||||
*
|
||||
* @return the user
|
||||
*/
|
||||
String getUser();
|
||||
}
|
||||
|
|
|
@ -16,31 +16,13 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
|||
*/
|
||||
public interface GcubeCkanDataCatalogServiceAsync {
|
||||
|
||||
/**
|
||||
* Gets the my role.
|
||||
*
|
||||
* @param callback the callback
|
||||
* @return the my role
|
||||
*/
|
||||
|
||||
void getMyRole(AsyncCallback<CkanRole> callback);
|
||||
|
||||
/**
|
||||
* Gets the user.
|
||||
*
|
||||
* @param callback the callback
|
||||
* @return the user
|
||||
*/
|
||||
|
||||
void getUser(AsyncCallback<String> callback);
|
||||
|
||||
/**
|
||||
* Gets the c kan connector.
|
||||
*
|
||||
* @param queryStringParameters the query string parameters
|
||||
* @param pathInfoParameters the path info parameters
|
||||
* @param callback the callback
|
||||
* @return the c kan connector
|
||||
*/
|
||||
void getCKanConnector(
|
||||
String queryStringParameters, String pathInfoParameters,
|
||||
String pathInfoParameters, String queryStringParameters,
|
||||
AsyncCallback<String> callback);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view;
|
|||
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GCubeCkanDataCatalog;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.resource.CkanPortletResources;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanRole;
|
||||
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.event.logical.shared.ResizeEvent;
|
||||
|
@ -46,8 +45,8 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate{
|
|||
this.eventBus = eventManager;
|
||||
managementPanel = new CkanMetadataManagementPanel(eventBus);
|
||||
initPanel();
|
||||
final String pathParameter = Window.Location.getParameter(GCubeCkanDataCatalog.GET_PATH_PARAMETER);
|
||||
final String queryParameter = Window.Location.getParameter(GCubeCkanDataCatalog.GET_QUERY_PARAMETER);
|
||||
String pathParameter = Window.Location.getParameter(GCubeCkanDataCatalog.GET_PATH_PARAMETER);
|
||||
String queryParameter = Window.Location.getParameter(GCubeCkanDataCatalog.GET_QUERY_PARAMETER);
|
||||
|
||||
GCubeCkanDataCatalog.service.getCKanConnector(pathParameter, queryParameter, new AsyncCallback<String>() {
|
||||
|
||||
|
@ -68,7 +67,7 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate{
|
|||
|
||||
|
||||
//MANAGE CKAN MANAGEMENT PANEL ACCORDING TO MY ROLE
|
||||
GCubeCkanDataCatalog.service.getMyRole(new AsyncCallback<CkanRole>() {
|
||||
/*GCubeCkanDataCatalog.service.getMyRole(new AsyncCallback<CkanRole>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -94,7 +93,7 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate{
|
|||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
});*/
|
||||
|
||||
Window.addResizeHandler(new ResizeHandler() {
|
||||
|
||||
|
|
|
@ -81,13 +81,14 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
|||
@Override
|
||||
public String getCKanConnector(String pathInfoParameters, String queryStringParameters) throws Exception {
|
||||
logger.info("getCKanConnector [pathInfo: "+pathInfoParameters + ", query: "+queryStringParameters+"]");
|
||||
if(Base64.isBase64(queryStringParameters.getBytes())){
|
||||
byte[] valueDecoded=Base64.decodeBase64(queryStringParameters.getBytes());
|
||||
queryStringParameters = new String(valueDecoded);
|
||||
logger.info("queryStringParameters detected like Base64 and decoded like: "+queryStringParameters);
|
||||
}
|
||||
|
||||
try{
|
||||
|
||||
if(queryStringParameters!=null && Base64.isBase64(queryStringParameters.getBytes())){
|
||||
byte[] valueDecoded=Base64.decodeBase64(queryStringParameters.getBytes());
|
||||
queryStringParameters = new String(valueDecoded);
|
||||
logger.info("queryStringParameters detected like Base64 and decoded like: "+queryStringParameters);
|
||||
}
|
||||
|
||||
String ckanContext = getServletContext().getInitParameter(CKANCONNECTORCONTEXT);
|
||||
logger.debug(CKANCONNECTORCONTEXT + " is: "+ckanContext);
|
||||
|
||||
|
@ -99,19 +100,12 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
|||
ckanConnectorUri = ckanConnectorUri.contains(PORT_HTTP)?ckanConnectorUri.replace(PORT_HTTP, PORT_HTTPS):ckanConnectorUri;
|
||||
ckanConnectorUri+=ckanContext;
|
||||
logger.debug("CKanConnector URI + Context: "+ckanConnectorUri);
|
||||
logger.debug("adding gcube token parameter...");
|
||||
if(SessionUtil.isIntoPortal()){
|
||||
ckanConnectorUri+="?"+GCUBE_TOKEN+"="+getGcubeSecurityToken();
|
||||
}else{
|
||||
logger.warn("******** Using TEST_USER security token!!!");
|
||||
ckanConnectorUri+="?"+GCUBE_TOKEN+"="+TEST_SEC_TOKEN;
|
||||
}
|
||||
|
||||
logger.debug("adding parameters...");
|
||||
String fullPath = getCkanConnectorParameters(pathInfoParameters, queryStringParameters);
|
||||
ckanConnectorUri += ckanConnectorUri+fullPath;
|
||||
ckanConnectorUri = ckanConnectorUri+fullPath;
|
||||
logger.info("returning ckanConnectorUri: "+ckanConnectorUri);
|
||||
return ckanConnectorUri;
|
||||
// return "http://ckan-d-d4s.d4science.org";
|
||||
// return "http://ckan-d-d4s.d4science.org";
|
||||
}catch(Exception e ){
|
||||
String message = "Sorry an error occurred during contacting gCube Ckan Data Catalogue";
|
||||
logger.error(message, e);
|
||||
|
@ -120,6 +114,8 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the ckan connector parameters.
|
||||
*
|
||||
|
@ -134,7 +130,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
|||
|
||||
String pathInfo = "";
|
||||
if(pathInfoParameters!=null && !pathInfoParameters.isEmpty()){
|
||||
pathInfo="/"+pathInfoParameters;
|
||||
pathInfo=pathInfoParameters.startsWith("/")?pathInfoParameters:"/"+pathInfoParameters;
|
||||
}
|
||||
|
||||
String queryString ="";
|
||||
|
@ -142,7 +138,16 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
|||
queryString = "?"+queryStringParameters;
|
||||
}
|
||||
|
||||
String gcubeTokenParameter = null;
|
||||
if(SessionUtil.isIntoPortal()){
|
||||
gcubeTokenParameter = GCUBE_TOKEN+"="+getGcubeSecurityToken();
|
||||
}else{
|
||||
logger.warn("******** Using TEST_USER security token!!!");
|
||||
gcubeTokenParameter = GCUBE_TOKEN+"="+TEST_SEC_TOKEN;
|
||||
}
|
||||
|
||||
queryString = queryString.isEmpty()?"?"+ckanHideHeader:"&"+ckanHideHeader;
|
||||
queryString+="&"+gcubeTokenParameter;
|
||||
return pathInfo+queryString;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue