D4Science Forum D4Science Forum

Development

How to know my service context/infrastructure?

Toggle
How to know in which context/infrastructure is my service running programmatically?
0 (0 Votes)

RE: How to know my service context/infrastructure?
Answer
8/20/19 12:23 PM as a reply to Andrea Rossi.

It is very easy with SmartGears:

  

import org.gcube.smartgears.ContextProvider;

import org.gcube.smartgears.context.application.ApplicationContext;

 

...

    ApplicationContext ctx = ContextProvider.get(); // get this info from SmartGears

    String rootContext = "/"+ctx.container().configuration().infrastructure();

0 (0 Votes)