Display Object in JSON format => Can be put in request for replay
This commit is contained in:
parent
f97a3889a5
commit
9e50b527ca
6 changed files with 120 additions and 47 deletions
|
|
@ -3,14 +3,16 @@ package org.chtijbug.drools.reverseproxy.mappings;
|
|||
import com.github.mkopylec.charon.configuration.MappingProperties;
|
||||
import com.github.mkopylec.charon.core.http.ForwardedRequestInterceptor;
|
||||
import com.github.mkopylec.charon.core.http.RequestData;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class CustomForwardedRequestInterceptor implements ForwardedRequestInterceptor {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(CustomForwardedRequestInterceptor.class);
|
||||
@Override
|
||||
public void intercept(RequestData data, MappingProperties mapping) {
|
||||
System.out.println("tptp");
|
||||
logger.debug(data.toString());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -3,12 +3,15 @@ package org.chtijbug.drools.reverseproxy.mappings;
|
|||
import com.github.mkopylec.charon.configuration.MappingProperties;
|
||||
import com.github.mkopylec.charon.core.http.ReceivedResponseInterceptor;
|
||||
import com.github.mkopylec.charon.core.http.ResponseData;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class CustomReceivedResponseInterceptor implements ReceivedResponseInterceptor {
|
||||
private static final Logger logger = LoggerFactory.getLogger(CustomReceivedResponseInterceptor.class);
|
||||
@Override
|
||||
public void intercept(ResponseData responseData, MappingProperties mappingProperties) {
|
||||
System.out.println("response");
|
||||
logger.debug(responseData.toString());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,17 +52,22 @@ public class UpdateService {
|
|||
if (mappingProperties.getPath().equals(update.getPath())) {
|
||||
found = true;
|
||||
mappingProperties.getDestinations().clear();
|
||||
logger.info("Updating path {}",update.getPath());
|
||||
for (String destination : update.getServerNames()) {
|
||||
mappingProperties.getDestinations().add(destination);
|
||||
logger.info("for path {} adding server {} ",update.getPath(),destination);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
MappingProperties newMappingProperties = new MappingProperties();
|
||||
newMappingProperties.setPath(update.getPath());
|
||||
logger.info("Creating path {}",update.getPath());
|
||||
for (String destination : update.getServerNames()) {
|
||||
newMappingProperties.getDestinations().add(destination);
|
||||
logger.info("for path {} adding server {} ",update.getPath(),destination);
|
||||
}
|
||||
mappingPropertiesMap.put(update.getPath(), newMappingProperties);
|
||||
}
|
||||
|
|
@ -115,7 +120,11 @@ public class UpdateService {
|
|||
if (mappingProperties2.getDestinations().size() > 0) {
|
||||
mappingPropertiesMap.put(mappingProperties2.getPath(), mappingProperties2);
|
||||
paths.add(mappingProperties2);
|
||||
logger.info("Project " + projectPersist.getContainerID() + " defined on servers - " + mappingProperties2.getDestinations().toString());
|
||||
logger.info("Startup creating path {}",mappingProperties2.getPath());
|
||||
for (String serverName : mappingProperties2.getDestinations()){
|
||||
logger.info("---------for path {} adding server {} ",mappingProperties2.getPath(),serverName);
|
||||
}
|
||||
logger.info("---------Project " + projectPersist.getContainerID() + " defined on servers - " + mappingProperties2.getDestinations().toString());
|
||||
|
||||
} else {
|
||||
logger.error("Project " + projectPersist.getContainerID() + " defined on non existing server");
|
||||
|
|
|
|||
Loading…
Add table
editor.link_modal.header
Reference in a new issue