first asset created
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package com.bayer.edam.migration;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpRequest;
|
||||
import org.springframework.http.client.ClientHttpRequestExecution;
|
||||
import org.springframework.http.client.ClientHttpRequestInterceptor;
|
||||
import org.springframework.http.client.ClientHttpResponse;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class LoggingRequestInterceptor implements ClientHttpRequestInterceptor {
|
||||
|
||||
final static Logger log = LoggerFactory.getLogger(LoggingRequestInterceptor.class);
|
||||
|
||||
@Override
|
||||
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)
|
||||
throws IOException {
|
||||
traceRequest(request, body);
|
||||
ClientHttpResponse response = execution.execute(request, body);
|
||||
return response;
|
||||
}
|
||||
|
||||
private void traceRequest(HttpRequest request, byte[] body) throws IOException {
|
||||
log.debug("===========================request begin================================================");
|
||||
log.debug("URI : {}", request.getURI());
|
||||
log.debug("Method : {}", request.getMethod());
|
||||
log.debug("Headers : {}", request.getHeaders());
|
||||
log.debug("Request body: {}", new String(body, "UTF-8"));
|
||||
log.debug("==========================request end================================================");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user