Get Geonetwork URL from Geonetwork Library instead of IS

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/uri-resolver@130658 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-07-21 16:59:38 +00:00
parent 5c98c1dc2b
commit a5571cae70
1 changed files with 8 additions and 6 deletions

View File

@ -270,9 +270,9 @@ public class GeonetworkResolver extends HttpServlet{
try {
ServerParameters geonetworkParams = getGeonetworkCachedServerParameters(scope);
// ServerParameters geonetworkParams = getGeonetworkCachedServerParameters(scope);
GeonetworkServiceInterface gntwAccess = new GeonetworkAccessParameter(scope, geonetworkParams);
GeonetworkServiceInterface gntwAccess = new GeonetworkAccessParameter(scope, null);
GeonetworkInstance gnInstance = gntwAccess.getGeonetworkInstance();
ScopeProvider.instance.set(scope);
@ -294,11 +294,13 @@ public class GeonetworkResolver extends HttpServlet{
// logger.debug("doPost read body request: "+readBody);
ByteArrayOutputStream byteArray = new ByteArrayOutputStream();
String geonetworkUrl = config.getGeoNetworkEndpoint();
// SPECIFIC HANDLER FOR GEONETWORK REQUEST: /srv/en/mef.export
String gnCSWlURL;
if(remainValue!=null && remainValue.compareTo(SRV_EN_MEF_EXPORT)==0){
logger.info("In case of mef.export, perfoming a custom handler");
gnCSWlURL = geonetworkParams.getUrl() + SRV_EN_MEF_EXPORT;
gnCSWlURL = geonetworkUrl + SRV_EN_MEF_EXPORT;
String[] uuidValues = req.getParameterValues(UUID);
if(uuidValues!=null){
String data = null;
@ -313,7 +315,7 @@ public class GeonetworkResolver extends HttpServlet{
}else
IOUtils.copy(req.getReader(), byteArray);
}else{
gnCSWlURL = remainValue==null ||remainValue.isEmpty()?geonetworkParams.getUrl()+"/"+CSW_SERVER:geonetworkParams.getUrl()+"/"+CSW_SERVER+remainValue;
gnCSWlURL = remainValue==null ||remainValue.isEmpty()?geonetworkUrl+"/"+CSW_SERVER:geonetworkUrl+"/"+CSW_SERVER+remainValue;
IOUtils.copy(req.getReader(), byteArray);
}
@ -323,8 +325,8 @@ public class GeonetworkResolver extends HttpServlet{
}
if(account.getUser()!=null && !noAuthenticationB){
boolean authorized = GNAuthentication.login(httpUtils, geonetworkParams.getUrl(), account.getUser(), account. getPassword());
logger.trace("Authorized on "+geonetworkParams +" ? "+authorized);
boolean authorized = GNAuthentication.login(httpUtils, geonetworkUrl, account.getUser(), account. getPassword());
logger.trace("Authorized on "+geonetworkUrl +" ? "+authorized);
}else
logger.info("Skipping authentication, either ckan user is null or noAuthentication is required");