fix on scope
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/uri-resolver@148750 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
eba2b6985e
commit
6d26d97361
|
@ -115,6 +115,8 @@ public class GeonetworkResolver extends HttpServlet{
|
||||||
String resetCache = req.getParameter(RESET_CACHE);
|
String resetCache = req.getParameter(RESET_CACHE);
|
||||||
String resetScope = req.getParameter(RESET_CACHED_SCOPE);
|
String resetScope = req.getParameter(RESET_CACHED_SCOPE);
|
||||||
|
|
||||||
|
String originalScope = ScopeProvider.instance.get();
|
||||||
|
|
||||||
if (scopeValue == null || scopeValue.equals("")) {
|
if (scopeValue == null || scopeValue.equals("")) {
|
||||||
logger.debug("Scope not found");
|
logger.debug("Scope not found");
|
||||||
sendError(resp, HttpServletResponse.SC_BAD_REQUEST, SCOPE+" not found or empty");
|
sendError(resp, HttpServletResponse.SC_BAD_REQUEST, SCOPE+" not found or empty");
|
||||||
|
@ -140,8 +142,8 @@ public class GeonetworkResolver extends HttpServlet{
|
||||||
// gnInstance = gntwAccess.getGeonetworkInstance();
|
// gnInstance = gntwAccess.getGeonetworkInstance();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// GeonetworkServiceInterface gntwAccess = new GeonetworkAccessParameter(scopeValue);
|
ScopeProvider.instance.set(scopeValue);
|
||||||
// GeonetworkInstance gnInstance = gntwAccess.getGeonetworkInstance();
|
|
||||||
HTTPCallsUtils httpUtils = new HTTPCallsUtils();
|
HTTPCallsUtils httpUtils = new HTTPCallsUtils();
|
||||||
Configuration config = gnInstance.getGeonetworkPublisher().getConfiguration();
|
Configuration config = gnInstance.getGeonetworkPublisher().getConfiguration();
|
||||||
String geonetworkUrl = config.getGeoNetworkEndpoint();
|
String geonetworkUrl = config.getGeoNetworkEndpoint();
|
||||||
|
@ -190,6 +192,14 @@ public class GeonetworkResolver extends HttpServlet{
|
||||||
String error = "Sorry, an error occurred on resolving geonetwork request with scope "+scopeValue+". Please, contact support!";
|
String error = "Sorry, an error occurred on resolving geonetwork request with scope "+scopeValue+". Please, contact support!";
|
||||||
sendError(resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, error);
|
sendError(resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, error);
|
||||||
return;
|
return;
|
||||||
|
}finally{
|
||||||
|
if(originalScope!=null){
|
||||||
|
ScopeProvider.instance.set(originalScope);
|
||||||
|
logger.info("scope provider set to orginal scope: "+originalScope);
|
||||||
|
}else{
|
||||||
|
ScopeProvider.instance.reset();
|
||||||
|
logger.info("scope provider reset");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue