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() { public void run() {
try { try {
logger.info("(inside task)publishing application in context {}", context); 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) { }catch (Exception e) {
logger.error("erro publishing application", e); logger.error("erro publishing application", e);
throw new RuntimeException(e); throw new RuntimeException(e);

View File

@ -8,15 +8,18 @@ import java.util.List;
import javax.servlet.ServletRegistration; import javax.servlet.ServletRegistration;
import org.gcube.common.resources.gcore.GCoreEndpoint; 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.application.ApplicationConfiguration;
import org.gcube.smartgears.configuration.container.ContainerConfiguration; import org.gcube.smartgears.configuration.container.ContainerConfiguration;
import org.gcube.smartgears.context.application.ApplicationContext; import org.gcube.smartgears.context.application.ApplicationContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ApplicationProfileBuilder { public class ApplicationProfileBuilder {
private static List<String> servletExcludes = Arrays.asList("default","jsp"); 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; private ApplicationContext context;
@ -44,15 +47,18 @@ public class ApplicationProfileBuilder {
endpoint.profile().newDeploymentData() endpoint.profile().newDeploymentData()
.activationTime(Calendar.getInstance()) .activationTime(Calendar.getInstance())
.status((context.lifecycle().state().remoteForm())); .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(); endpoint.profile().endpoints().clear();
String baseAddress; String baseAddress;
if (configuration.proxied() && container.proxy()!=null){ if (configuration.proxyAddress()!=null){
String protocol = container.proxy().getProtocol(); ProxyAddress proxy = configuration.proxyAddress();
String port = container.proxy().getPort()!=null?":"+container.proxy().getPort():""; 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 { } else {
String protocol = container.protocol(); String protocol = container.protocol();
int port = container.port(); int port = container.port();