public class RestCallLogger extends RestCallInterceptor
Causes a log entry to be created that shows all the request and response headers and content at the end of the request.
Use the RestClientBuilder.logTo(Level, Logger) and RestCall.logTo(Level, Logger) methods to create
instances of this class.
| Modifier and Type | Field and Description |
|---|---|
static RestCallLogger |
DEFAULT
Default HTTP request logger.
|
| Modifier | Constructor and Description |
|---|---|
protected |
RestCallLogger(Level level,
Logger log)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
onClose(RestCall restCall)
Called when
RestCall.close() is called. |
void |
onConnect(RestCall restCall,
int statusCode,
org.apache.http.HttpRequest req,
org.apache.http.HttpResponse res)
Called immediately after an HTTP response has been received.
|
void |
onInit(RestCall restCall)
Called when
RestCall object is created. |
void |
onRetry(RestCall restCall,
int statusCode,
org.apache.http.HttpRequest req,
org.apache.http.HttpResponse res,
Exception ex)
Called if retry is going to be attempted.
|
public static final RestCallLogger DEFAULT
Logs outgoing HTTP requests to the
protected RestCallLogger(Level level, Logger log)
level - The log level to log messages at.log - The logger to log to.public void onInit(RestCall restCall)
RestCallInterceptorRestCall object is created.onInit in class RestCallInterceptorrestCall - The restCall object invoking this method.public void onConnect(RestCall restCall, int statusCode, org.apache.http.HttpRequest req, org.apache.http.HttpResponse res)
RestCallInterceptoronConnect in class RestCallInterceptorrestCall - The restCall object invoking this method.statusCode - The HTTP status code received.req - The HTTP request object.res - The HTTP response object.public void onRetry(RestCall restCall, int statusCode, org.apache.http.HttpRequest req, org.apache.http.HttpResponse res, Exception ex)
RestCallInterceptoronRetry in class RestCallInterceptorrestCall - The restCall object invoking this method.statusCode - The HTTP status code received.req - The HTTP request object.res - The HTTP response object.ex - The exception thrown from the client.public void onClose(RestCall restCall) throws RestCallException
RestCallInterceptorRestCall.close() is called.onClose in class RestCallInterceptorrestCall - The restCall object invoking this method.RestCallException - Error occurred during call.Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.