diff --git a/src/main/java/org/gcube/datatransfer/resolver/gis/geonetwork/GeonetworkResolver.java b/src/main/java/org/gcube/datatransfer/resolver/gis/geonetwork/GeonetworkResolver.java index 861c228..e2e4465 100644 --- a/src/main/java/org/gcube/datatransfer/resolver/gis/geonetwork/GeonetworkResolver.java +++ b/src/main/java/org/gcube/datatransfer/resolver/gis/geonetwork/GeonetworkResolver.java @@ -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");