make some classes and methods package private
ElasticsearchResponseException, as well as ElasticsearchResponse, should only be created from o.e.client package. RequestLogger should only be used from this package too.
This commit is contained in:
parent
6490355cb6
commit
29b1f8d44a
|
@ -31,7 +31,7 @@ public class ElasticsearchResponseException extends IOException {
|
||||||
private ElasticsearchResponse elasticsearchResponse;
|
private ElasticsearchResponse elasticsearchResponse;
|
||||||
private final String responseBody;
|
private final String responseBody;
|
||||||
|
|
||||||
public ElasticsearchResponseException(ElasticsearchResponse elasticsearchResponse, String responseBody) throws IOException {
|
ElasticsearchResponseException(ElasticsearchResponse elasticsearchResponse, String responseBody) throws IOException {
|
||||||
super(buildMessage(elasticsearchResponse,responseBody));
|
super(buildMessage(elasticsearchResponse,responseBody));
|
||||||
this.elasticsearchResponse = elasticsearchResponse;
|
this.elasticsearchResponse = elasticsearchResponse;
|
||||||
this.responseBody = responseBody;
|
this.responseBody = responseBody;
|
||||||
|
|
|
@ -30,7 +30,7 @@ final class HttpDeleteWithEntity extends HttpEntityEnclosingRequestBase {
|
||||||
|
|
||||||
final static String METHOD_NAME = HttpDelete.METHOD_NAME;
|
final static String METHOD_NAME = HttpDelete.METHOD_NAME;
|
||||||
|
|
||||||
public HttpDeleteWithEntity(final URI uri) {
|
HttpDeleteWithEntity(final URI uri) {
|
||||||
setURI(uri);
|
setURI(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ final class HttpGetWithEntity extends HttpEntityEnclosingRequestBase {
|
||||||
|
|
||||||
final static String METHOD_NAME = HttpGet.METHOD_NAME;
|
final static String METHOD_NAME = HttpGet.METHOD_NAME;
|
||||||
|
|
||||||
public HttpGetWithEntity(final URI uri) {
|
HttpGetWithEntity(final URI uri) {
|
||||||
setURI(uri);
|
setURI(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ import java.nio.charset.StandardCharsets;
|
||||||
* Helper class that exposes static methods to unify the way requests are logged.
|
* Helper class that exposes static methods to unify the way requests are logged.
|
||||||
* Includes trace logging to log complete requests and responses in curl format.
|
* Includes trace logging to log complete requests and responses in curl format.
|
||||||
*/
|
*/
|
||||||
public final class RequestLogger {
|
final class RequestLogger {
|
||||||
|
|
||||||
private static final Log tracer = LogFactory.getLog("tracer");
|
private static final Log tracer = LogFactory.getLog("tracer");
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public final class RequestLogger {
|
||||||
/**
|
/**
|
||||||
* Logs a request that yielded a response
|
* Logs a request that yielded a response
|
||||||
*/
|
*/
|
||||||
public static void log(Log logger, String message, HttpUriRequest request, HttpHost host, HttpResponse httpResponse) {
|
static void log(Log logger, String message, HttpUriRequest request, HttpHost host, HttpResponse httpResponse) {
|
||||||
logger.debug(message + " [" + request.getMethod() + " " + host + request.getRequestLine().getUri() +
|
logger.debug(message + " [" + request.getMethod() + " " + host + request.getRequestLine().getUri() +
|
||||||
"] [" + httpResponse.getStatusLine() + "]");
|
"] [" + httpResponse.getStatusLine() + "]");
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ public final class RequestLogger {
|
||||||
/**
|
/**
|
||||||
* Logs a request that failed
|
* Logs a request that failed
|
||||||
*/
|
*/
|
||||||
public static void log(Log logger, String message, HttpUriRequest request, HttpHost host, IOException e) {
|
static void log(Log logger, String message, HttpUriRequest request, HttpHost host, IOException e) {
|
||||||
logger.debug(message + " [" + request.getMethod() + " " + host + request.getRequestLine().getUri() + "]", e);
|
logger.debug(message + " [" + request.getMethod() + " " + host + request.getRequestLine().getUri() + "]", e);
|
||||||
if (logger.isTraceEnabled()) {
|
if (logger.isTraceEnabled()) {
|
||||||
String traceRequest;
|
String traceRequest;
|
||||||
|
|
Loading…
Reference in New Issue