[bs-80] Add configurable / switchable web request trace logging (headers etc)
* Added a bean post processor for the Spring Security filter chain (so you only get traces by default if security is on) * Every request is logged at trace level if the dump requests flag is on * Requests are also dumped to a TraceRepository for later analysis (very useful for tracing problems in real time when a support call comes in) [Fixes #48976001]
This commit is contained in:
@@ -28,6 +28,7 @@ import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceAware;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.core.env.PropertySources;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.validation.BindException;
|
||||
@@ -68,6 +69,8 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>,
|
||||
|
||||
private String targetName;
|
||||
|
||||
private ConversionService conversionService;
|
||||
|
||||
/**
|
||||
* @param target the target object to bind too
|
||||
* @see #PropertiesConfigurationFactory(Class)
|
||||
@@ -142,6 +145,13 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>,
|
||||
this.propertySources = propertySources;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param conversionService the conversionService to set
|
||||
*/
|
||||
public void setConversionService(ConversionService conversionService) {
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param validator the validator to set
|
||||
*/
|
||||
@@ -176,6 +186,9 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>,
|
||||
if (this.validator != null) {
|
||||
dataBinder.setValidator(this.validator);
|
||||
}
|
||||
if (this.conversionService != null) {
|
||||
dataBinder.setConversionService(this.conversionService);
|
||||
}
|
||||
dataBinder.setIgnoreInvalidFields(this.ignoreInvalidFields);
|
||||
dataBinder.setIgnoreUnknownFields(this.ignoreUnknownFields);
|
||||
customizeBinder(dataBinder);
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.bootstrap.context.annotation.ConfigurationProperties;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.core.env.PropertySources;
|
||||
import org.springframework.validation.Validator;
|
||||
|
||||
@@ -33,6 +34,8 @@ public class PropertySourcesBindingPostProcessor implements BeanPostProcessor {
|
||||
|
||||
private Validator validator;
|
||||
|
||||
private ConversionService conversionService;
|
||||
|
||||
/**
|
||||
* @param propertySources
|
||||
*/
|
||||
@@ -47,6 +50,13 @@ public class PropertySourcesBindingPostProcessor implements BeanPostProcessor {
|
||||
this.validator = validator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param conversionService the conversionService to set
|
||||
*/
|
||||
public void setConversionService(ConversionService conversionService) {
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName)
|
||||
throws BeansException {
|
||||
@@ -63,6 +73,7 @@ public class PropertySourcesBindingPostProcessor implements BeanPostProcessor {
|
||||
bean);
|
||||
factory.setPropertySources(this.propertySources);
|
||||
factory.setValidator(this.validator);
|
||||
factory.setConversionService(this.conversionService);
|
||||
factory.setIgnoreInvalidFields(annotation.ignoreInvalidFields());
|
||||
factory.setIgnoreUnknownFields(annotation.ignoreUnknownFields());
|
||||
String targetName = "".equals(annotation.value()) ? ("".equals(annotation
|
||||
|
||||
@@ -56,7 +56,6 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer {
|
||||
@Override
|
||||
public synchronized void stop() {
|
||||
try {
|
||||
this.server.setGracefulShutdown(10000);
|
||||
this.server.stop();
|
||||
} catch (InterruptedException ex) {
|
||||
Thread.currentThread().interrupt();
|
||||
|
||||
Reference in New Issue
Block a user