proxy retrieving modified

This commit is contained in:
Lucio Lelii 2022-06-24 15:55:05 +02:00
parent d62df31df1
commit 711e841ac6
2 changed files with 15 additions and 7 deletions

View File

@ -79,7 +79,9 @@ public class LegacyISPublisher implements Publisher{
public void run() {
try {
logger.info("(inside task)publishing application in context {}", context);
registry.getStubs().create(toXml(enpoint), enpoint.type().toString());
String resource = toXml(enpoint);
registry.getStubs().create(resource, enpoint.type().toString());
logger.debug("publisher resource in context {} : {}",context, resource);
}catch (Exception e) {
logger.error("erro publishing application", e);
throw new RuntimeException(e);

View File

@ -8,15 +8,18 @@ import java.util.List;
import javax.servlet.ServletRegistration;
import org.gcube.common.resources.gcore.GCoreEndpoint;
import org.gcube.smartgears.configuration.ProxyAddress;
import org.gcube.smartgears.configuration.application.ApplicationConfiguration;
import org.gcube.smartgears.configuration.container.ContainerConfiguration;
import org.gcube.smartgears.context.application.ApplicationContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ApplicationProfileBuilder {
private static List<String> servletExcludes = Arrays.asList("default","jsp");
// private static final Logger log = LoggerFactory.getLogger(ProfileBuilder.class);
private static final Logger log = LoggerFactory.getLogger(ApplicationProfileBuilder.class);
private ApplicationContext context;
@ -45,14 +48,17 @@ public class ApplicationProfileBuilder {
.activationTime(Calendar.getInstance())
.status((context.lifecycle().state().remoteForm()));
log.debug("publishing aplication profile with id {} for {} with status {}",context.id(), configuration.name(), context.lifecycle().state().remoteForm());
endpoint.profile().endpoints().clear();
String baseAddress;
if (configuration.proxied() && container.proxy()!=null){
String protocol = container.proxy().getProtocol();
String port = container.proxy().getPort()!=null?":"+container.proxy().getPort():"";
if (configuration.proxyAddress()!=null){
ProxyAddress proxy = configuration.proxyAddress();
String protocol = proxy.getProtocol();
String port = proxy.getPort()!=null?":"+proxy.getPort():"";
baseAddress=String.format("%s://%s%s%s", protocol , container.proxy().getHostname(), port,context.application().getContextPath());
baseAddress=String.format("%s://%s%s%s", protocol , proxy.getHostname(), port,context.application().getContextPath());
} else {
String protocol = container.protocol();
int port = container.port();