From 26ca78b976cf24e366f1db415f5a06c5850c1c43 Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Wed, 14 Nov 2018 16:00:22 +0000 Subject: [PATCH] updated listener git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/uri-resolver@174150 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../listeners/UriResolverStartupListener.java | 12 ++++++++++-- .../resolver/services/CatalogueResolver.java | 2 +- src/test/java/rest/TestResolvers.java | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/gcube/datatransfer/resolver/listeners/UriResolverStartupListener.java b/src/main/java/org/gcube/datatransfer/resolver/listeners/UriResolverStartupListener.java index 9955510..7144f14 100644 --- a/src/main/java/org/gcube/datatransfer/resolver/listeners/UriResolverStartupListener.java +++ b/src/main/java/org/gcube/datatransfer/resolver/listeners/UriResolverStartupListener.java @@ -15,14 +15,15 @@ import javax.servlet.ServletContextListener; import javax.servlet.ServletException; import javax.servlet.annotation.WebListener; -//import org.gcube.datatransfer.resolver.caches.LoadingCatalogueApplicationProfilesCache; import org.gcube.datatransfer.resolver.caches.LoadingGeonetworkInstanceCache; import org.gcube.datatransfer.resolver.caches.LoadingGisViewerApplicationURLCache; import org.gcube.datatransfer.resolver.caches.LoadingVREsScopeCache; import org.gcube.datatransfer.resolver.gis.property.ApplicationProfilePropertyReader; import org.gcube.datatransfer.resolver.gis.property.PropertyFileNotFoundException; import org.gcube.smartgears.ContextProvider; +import org.gcube.smartgears.configuration.container.ContainerConfiguration; import org.gcube.smartgears.context.application.ApplicationContext; +import org.gcube.smartgears.context.container.ContainerContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -67,8 +68,15 @@ public class UriResolverStartupListener implements ServletContextListener { try { rootContextScope = loadScopeFromEnvironment(); ApplicationContext ctx = ContextProvider.get(); + ContainerContext container = ctx.container(); + logger.info("Is ContainerContext null? "+(container==null)); + ContainerConfiguration contConfiguration = container.configuration(); + logger.info("Is ContainerConfiguration null? "+(contConfiguration==null)); + String rootScope = ctx.container().configuration().infrastructure(); - logger.info("The ContextProvider returned the infrastructure name: "+rootScope); + logger.info("Is infrastructure null? "+(rootScope==null)); + + logger.info("The ContextProvider read the infrastructure name: "+rootScope); } catch (Exception e) { // diff --git a/src/main/java/org/gcube/datatransfer/resolver/services/CatalogueResolver.java b/src/main/java/org/gcube/datatransfer/resolver/services/CatalogueResolver.java index 64a3cef..c769bf1 100644 --- a/src/main/java/org/gcube/datatransfer/resolver/services/CatalogueResolver.java +++ b/src/main/java/org/gcube/datatransfer/resolver/services/CatalogueResolver.java @@ -150,7 +150,7 @@ public class CatalogueResolver { }.start();*/ - return Response.ok(linkURL).build(); + return Response.ok(linkURL).header("Location", linkURL).build(); } /** diff --git a/src/test/java/rest/TestResolvers.java b/src/test/java/rest/TestResolvers.java index 99e8cf3..01760f3 100644 --- a/src/test/java/rest/TestResolvers.java +++ b/src/test/java/rest/TestResolvers.java @@ -210,7 +210,7 @@ public class TestResolvers { * * @throws Exception the exception */ - @Test + //@Test public void testCatalogueResolverCreatePublicItemURL() throws Exception{ String entityName = "sarda-sarda";