Uppdated CatalogueResolver by adding
query_string=BASE64[query_string_value]
This commit is contained in:
parent
cda5599d27
commit
ca07d7ae0e
|
@ -94,12 +94,12 @@ public class CatalogueStaticConfigurations{
|
|||
if(toPrivateCKANCatalogueURL.startsWith(prefix)) {
|
||||
toPrivateCKANCatalogueURL = toPrivateCKANCatalogueURL.replaceFirst(prefix, ""); //removing prefix
|
||||
String catalogueName = toPrivateCKANCatalogueURL.substring(0,toPrivateCKANCatalogueURL.indexOf(".d4science"));
|
||||
LOG.info("Catalogue Name extration returning value: "+catalogueName);
|
||||
LOG.info("Catalogue Name extraction returning value: "+catalogueName);
|
||||
return catalogueName;
|
||||
}
|
||||
}
|
||||
|
||||
LOG.info("Catalogue Name extration returning null");
|
||||
LOG.info("Catalogue Name extraction returning null");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import javax.ws.rs.core.Context;
|
|||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.gcube.common.scope.impl.ScopeBean.Type;
|
||||
|
@ -34,7 +35,6 @@ import org.gcube.datatransfer.resolver.catalogue.resource.CkanCatalogueConfigura
|
|||
import org.gcube.datatransfer.resolver.catalogue.resource.GatewayCKANCatalogueReference;
|
||||
import org.gcube.datatransfer.resolver.catalogue.resource.GetAllInfrastructureScopes;
|
||||
import org.gcube.datatransfer.resolver.services.error.ExceptionManager;
|
||||
import org.gcube.datatransfer.resolver.util.UrlEncoderUtil;
|
||||
import org.gcube.datatransfer.resolver.util.Util;
|
||||
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.VRE;
|
||||
import org.gcube.smartgears.utils.InnerMethodName;
|
||||
|
@ -94,6 +94,7 @@ public class CatalogueResolver {
|
|||
|
||||
try {
|
||||
InnerMethodName.instance.set("resolveCataloguePublicLink");
|
||||
|
||||
ItemCatalogueURLs itemCatalogueURLs = getItemCatalogueURLs(req, vreName, entityContext, entityName);
|
||||
|
||||
String itemCatalogueURL;
|
||||
|
@ -113,17 +114,19 @@ public class CatalogueResolver {
|
|||
}
|
||||
} else {
|
||||
itemCatalogueURL = itemCatalogueURLs.getPrivateVRECataloguePortletURL();
|
||||
logger.info("The dataset " + itemCatalogueURLs.getItemName()
|
||||
+ " is a private item (to VRE) so using protected access to CKAN portlet: " + itemCatalogueURL);
|
||||
logger.info("Either the " + itemCatalogueURLs.getItemName()
|
||||
+ " is not an item (alias dataset) or it is a private item (to VRE) so using protected access to CKAN portlet: "
|
||||
+ itemCatalogueURL);
|
||||
}
|
||||
|
||||
String queryString = req.getQueryString();
|
||||
if (queryString != null) {
|
||||
logger.debug("Query string found: " + queryString);
|
||||
String qsEnc = URLEncoder.encode(queryString, "UTF-8");
|
||||
logger.info("Adding encoded query string " + qsEnc + " to Catalogue URL response");
|
||||
|
||||
itemCatalogueURL += "?" + qsEnc;
|
||||
logger.info("Query string found: " + queryString);
|
||||
byte[] stringEncBytes = Base64.encodeBase64(queryString.getBytes());
|
||||
String queryStringEnc = "query_string=" + new String(stringEncBytes);
|
||||
logger.info("Adding Base64 encoded: " + queryString);
|
||||
itemCatalogueURL += itemCatalogueURL.contains("?") ? "&" : "?";
|
||||
itemCatalogueURL += queryStringEnc;
|
||||
}
|
||||
|
||||
return Response.seeOther(new URL(itemCatalogueURL).toURI()).build();
|
||||
|
|
|
@ -1,23 +1,10 @@
|
|||
package org.gcube.datatransfer.test;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.Response.ResponseBuilder;
|
||||
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.storagehub.client.StreamDescriptor;
|
||||
import org.gcube.common.storagehub.client.plugins.AbstractPlugin;
|
||||
import org.gcube.common.storagehub.client.proxies.ItemManagerClient;
|
||||
import org.gcube.datatransfer.resolver.catalogue.resource.CkanCatalogueConfigurationsReader;
|
||||
import org.gcube.datatransfer.resolver.catalogue.resource.GatewayCKANCatalogueReference;
|
||||
import org.gcube.datatransfer.resolver.init.UriResolverSmartGearManagerInit;
|
||||
import org.gcube.datatransfer.resolver.services.CatalogueResolver;
|
||||
import org.gcube.datatransfer.resolver.services.StorageHubResolver;
|
||||
import org.gcube.datatransfer.resolver.services.error.ExceptionManager;
|
||||
import org.gcube.datatransfer.resolver.shub.StorageHubMetadataResponseBuilder;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.itextpdf.text.log.SysoCounter;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,19 +15,10 @@ import java.nio.file.StandardCopyOption;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.Response.ResponseBuilder;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.gcube.common.storagehub.client.StreamDescriptor;
|
||||
import org.gcube.common.storagehub.client.plugins.AbstractPlugin;
|
||||
import org.gcube.common.storagehub.client.proxies.ItemManagerClient;
|
||||
import org.gcube.datatransfer.resolver.applicationprofile.ApplicationProfileReader;
|
||||
import org.gcube.datatransfer.resolver.services.StorageHubResolver;
|
||||
import org.gcube.datatransfer.resolver.services.error.ExceptionManager;
|
||||
import org.gcube.datatransfer.resolver.shub.StorageHubMetadataResponseBuilder;
|
||||
import org.gcube.datatransfer.resolver.util.HTTPCallsUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -42,7 +33,7 @@ import org.slf4j.LoggerFactory;
|
|||
public class TestResolvers {
|
||||
|
||||
|
||||
public static final String URI_RESOLVER_SERVICE_ENDPOINT = "https://data1-d.d4science.net";
|
||||
public static final String URI_RESOLVER_SERVICE_ENDPOINT = "https://data.dev.d4science.org";
|
||||
|
||||
public static final Logger logger = LoggerFactory.getLogger(TestResolvers.class);
|
||||
|
||||
|
|
Loading…
Reference in New Issue