using scope read from ScopeProvider avoiding jump of scope for UrlShortner

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/uri-resolver-manager@132007 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-09-28 16:17:29 +00:00
parent 9c3513ffe6
commit 3beb5a9bd2
1 changed files with 8 additions and 6 deletions

View File

@ -42,7 +42,6 @@ public class UriResolverManager {
private UriResolverMapReader uriResolverMapReader;
private Map<String, Resolver> applicationTypes;
private String scope;
private String applicationType;
private RuntimeResourceReader reader;
@ -92,10 +91,10 @@ public class UriResolverManager {
public UriResolverManager() throws UriResolverMapException, IllegalArgumentException{
try {
this.scope = ScopeProvider.instance.get();
String scope = ScopeProvider.instance.get();
logger.info("UriResolverManager is using scope: "+scope+", read from ScopeProvider");
if(this.scope == null)
if(scope == null)
throw new UriResolverMapException("Scope is null, set scope into ScopeProvider!");
this.uriResolverMapReader = new UriResolverMapReader();
@ -216,7 +215,7 @@ public class UriResolverManager {
if(shortLink){
try{
logger.info("Shortner start..");
UrlShortener shortener = new UrlShortener(this.scope);
UrlShortener shortener = new UrlShortener();
link = shortener.shorten(link);
logger.info("Shorted link is: "+link);
}catch(Exception e){
@ -253,8 +252,11 @@ public class UriResolverManager {
public List<ServiceParameter> discoveryServiceParameters(Resolver resolver) throws IllegalArgumentException, Exception{
try {
if(this.scope == null)
throw new IllegalArgumentException("Scope is null, set ScopeProvider");
String scope = ScopeProvider.instance.get();
logger.info("SiscoveryServiceParameters is using scope: "+scope+", read from ScopeProvider");
if(scope == null)
throw new UriResolverMapException("Scope is null, set scope into ScopeProvider!");
if(resolver == null)
throw new IllegalArgumentException("Resolver is null, set Resolver");