Remove unecessary Jackson dependency in trace filter

pull/1732/merge
Dave Syer 10 years ago
parent 08ddbe79cd
commit cd092e02dc

@ -37,9 +37,6 @@ import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.filter.OncePerRequestFilter; 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}. * 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 TraceRepository traceRepository;
private final ObjectMapper objectMapper = new ObjectMapper();
private ErrorAttributes errorAttributes; private ErrorAttributes errorAttributes;
/** /**
@ -93,16 +88,9 @@ public class WebRequestTraceFilter extends OncePerRequestFilter implements Order
this.logger.trace("Processing request " + request.getMethod() + " " this.logger.trace("Processing request " + request.getMethod() + " "
+ request.getRequestURI()); + request.getRequestURI());
if (this.dumpRequests) { if (this.dumpRequests) {
try { @SuppressWarnings("unchecked")
@SuppressWarnings("unchecked") Map<String, Object> headers = (Map<String, Object>) trace.get("headers");
Map<String, Object> headers = (Map<String, Object>) trace this.logger.trace("Headers: " + headers);
.get("headers");
this.logger.trace("Headers: "
+ this.objectMapper.writeValueAsString(headers));
}
catch (JsonProcessingException ex) {
throw new IllegalStateException("Cannot create JSON", ex);
}
} }
} }

Loading…
Cancel
Save