Rename trace to httptrace

Closes gh-11806
This commit is contained in:
Andy Wilkinson
2018-01-30 12:54:52 +00:00
parent 87c82310cf
commit 356efaa7c8
19 changed files with 145 additions and 131 deletions

View File

@@ -133,17 +133,18 @@ public class HttpExchangeTracer {
@Override
public Map<String, List<String>> getHeaders() {
return getHeadersIfIncluded(Include.REQUEST_HEADERS,
this.delegate::getHeaders, (name) -> {
if (name.equalsIgnoreCase(HttpHeaders.COOKIE)) {
return HttpExchangeTracer.this.includes
.contains(Include.COOKIE_HEADERS);
}
if (name.equalsIgnoreCase(HttpHeaders.AUTHORIZATION)) {
return HttpExchangeTracer.this.includes
.contains(Include.AUTHORIZATION_HEADER);
}
return true;
});
this.delegate::getHeaders, this::includedHeader);
}
private boolean includedHeader(String name) {
if (name.equalsIgnoreCase(HttpHeaders.COOKIE)) {
return HttpExchangeTracer.this.includes.contains(Include.COOKIE_HEADERS);
}
if (name.equalsIgnoreCase(HttpHeaders.AUTHORIZATION)) {
return HttpExchangeTracer.this.includes
.contains(Include.AUTHORIZATION_HEADER);
}
return true;
}
@Override
@@ -169,13 +170,14 @@ public class HttpExchangeTracer {
@Override
public Map<String, List<String>> getHeaders() {
return getHeadersIfIncluded(Include.RESPONSE_HEADERS,
this.delegate::getHeaders, (name) -> {
if (name.equalsIgnoreCase(HttpHeaders.SET_COOKIE)) {
return HttpExchangeTracer.this.includes
.contains(Include.COOKIE_HEADERS);
}
return true;
});
this.delegate::getHeaders, this::includedHeader);
}
private boolean includedHeader(String name) {
if (name.equalsIgnoreCase(HttpHeaders.SET_COOKIE)) {
return HttpExchangeTracer.this.includes.contains(Include.COOKIE_HEADERS);
}
return true;
}
}

View File

@@ -26,9 +26,10 @@ import org.springframework.util.Assert;
* {@link Endpoint} to expose {@link HttpTrace} information.
*
* @author Dave Syer
* @author Andy Wilkinson
* @since 2.0.0
*/
@Endpoint(id = "trace")
@Endpoint(id = "httptrace")
public class HttpTraceEndpoint {
private final HttpTraceRepository repository;
@@ -43,19 +44,19 @@ public class HttpTraceEndpoint {
}
@ReadOperation
public TraceDescriptor traces() {
return new TraceDescriptor(this.repository.findAll());
public HttpTraceDescriptor traces() {
return new HttpTraceDescriptor(this.repository.findAll());
}
/**
* A description of an application's {@link HttpTrace} entries. Primarily intended for
* serialization to JSON.
*/
public static final class TraceDescriptor {
public static final class HttpTraceDescriptor {
private final List<HttpTrace> traces;
private TraceDescriptor(List<HttpTrace> traces) {
private HttpTraceDescriptor(List<HttpTrace> traces) {
this.traces = traces;
}