|
|
|
@ -37,9 +37,6 @@ import org.springframework.web.context.request.RequestAttributes;
|
|
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
|
import org.springframework.web.filter.OncePerRequestFilter;
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Servlet {@link Filter} that logs all requests to a {@link TraceRepository}.
|
|
|
|
|
*
|
|
|
|
@ -55,8 +52,6 @@ public class WebRequestTraceFilter extends OncePerRequestFilter implements Order
|
|
|
|
|
|
|
|
|
|
private final TraceRepository traceRepository;
|
|
|
|
|
|
|
|
|
|
private final ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
|
|
|
|
|
|
private ErrorAttributes errorAttributes;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -93,16 +88,9 @@ public class WebRequestTraceFilter extends OncePerRequestFilter implements Order
|
|
|
|
|
this.logger.trace("Processing request " + request.getMethod() + " "
|
|
|
|
|
+ request.getRequestURI());
|
|
|
|
|
if (this.dumpRequests) {
|
|
|
|
|
try {
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
|
Map<String, Object> headers = (Map<String, Object>) trace
|
|
|
|
|
.get("headers");
|
|
|
|
|
this.logger.trace("Headers: "
|
|
|
|
|
+ this.objectMapper.writeValueAsString(headers));
|
|
|
|
|
}
|
|
|
|
|
catch (JsonProcessingException ex) {
|
|
|
|
|
throw new IllegalStateException("Cannot create JSON", ex);
|
|
|
|
|
}
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
|
Map<String, Object> headers = (Map<String, Object>) trace.get("headers");
|
|
|
|
|
this.logger.trace("Headers: " + headers);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|