@Override public String toString() { StringBuilder sb = new StringBuilder(method.name()); sb.append("@"); sb.append(uri); sb.append("/"); sb.append(path); if (params != null) { sb.append("?"); sb.append(params); } return sb.toString(); } }
if (ba != null && ba.length() > 0) { if (!(http instanceof EntityEnclosingMethod)) { throw new IllegalStateException(String.format("Method %s cannot contain body - implementation bug", request.method().name())); log.trace(String.format("Tx %s[%s]@[%s][%s]?[%s] w/ payload [%s]", proxyInfo, request.method().name(), httpInfo, request.path(), request.params(), request.body()));
private void checkResponse(Request request, Response response) { if (response.hasFailed()) { // check error first String msg = null; // try to parse the answer try { EsHadoopException ex = errorExtractor.extractError(this.<Map> parseContent(response.body(), null)); msg = (ex != null) ? ex.toString() : null; if (response.isClientError()) { msg = msg + "\n" + request.body(); } else { msg = errorExtractor.prettify(msg, request.body()); } } catch (Exception ex) { // can't parse message, move on } if (!StringUtils.hasText(msg)) { msg = String.format("[%s] on [%s] failed; server[%s] returned [%s|%s:%s]", request.method().name(), request.path(), response.uri(), response.status(), response.statusDescription(), IOUtils.asStringAlways(response.body())); } throw new EsHadoopInvalidRequest(msg); } }
if (ba != null && ba.length() > 0) { if (!(http instanceof EntityEnclosingMethod)) { throw new IllegalStateException(String.format("Method %s cannot contain body - implementation bug", request.method().name())); log.trace(String.format("Tx %s[%s]@[%s][%s] w/ payload [%s]", proxyInfo, request.method().name(), httpInfo, request.path(), request.body()));
if (ba != null && ba.length() > 0) { if (!(http instanceof EntityEnclosingMethod)) { throw new IllegalStateException(String.format("Method %s cannot contain body - implementation bug", request.method().name())); log.trace(String.format("Tx %s[%s]@[%s][%s]?[%s] w/ payload [%s]", proxyInfo, request.method().name(), httpInfo, request.path(), request.params(), request.body()));
if (ba != null && ba.length() > 0) { if (!(http instanceof EntityEnclosingMethod)) { throw new IllegalStateException(String.format("Method %s cannot contain body - implementation bug", request.method().name())); log.trace(String.format("Tx %s[%s]@[%s][%s]?[%s] w/ payload [%s]", proxyInfo, request.method().name(), httpInfo, request.path(), request.params(), request.body()));
if (ba != null && ba.length() > 0) { if (!(http instanceof EntityEnclosingMethod)) { throw new IllegalStateException(String.format("Method %s cannot contain body - implementation bug", request.method().name())); log.trace(String.format("Tx %s[%s]@[%s][%s]?[%s] w/ payload [%s]", proxyInfo, request.method().name(), httpInfo, request.path(), request.params(), request.body()));
private void checkResponse(Request request, Response response) { if (response.hasFailed()) { // check error first String msg = null; // try to parse the answer try { EsHadoopException ex = errorExtractor.extractError(this.<Map> parseContent(response.body(), null)); msg = (ex != null) ? ex.toString() : null; if (response.isClientError()) { msg = msg + "\n" + request.body(); } else { msg = errorExtractor.prettify(msg, request.body()); } } catch (Exception ex) { // can't parse message, move on } if (!StringUtils.hasText(msg)) { msg = String.format("[%s] on [%s] failed; server[%s] returned [%s|%s:%s]", request.method().name(), request.path(), response.uri(), response.status(), response.statusDescription(), IOUtils.asStringAlways(response.body())); } throw new EsHadoopInvalidRequest(msg); } }
private void checkResponse(Request request, Response response) { if (response.hasFailed()) { // check error first String msg = null; // try to parse the answer try { EsHadoopException ex = errorExtractor.extractError(this.<Map> parseContent(response.body(), null)); msg = (ex != null) ? ex.toString() : null; if (response.isClientError()) { msg = msg + "\n" + request.body(); } else { msg = errorExtractor.prettify(msg, request.body()); } } catch (Exception ex) { // can't parse message, move on } if (!StringUtils.hasText(msg)) { msg = String.format("[%s] on [%s] failed; server[%s] returned [%s|%s:%s]", request.method().name(), request.path(), response.uri(), response.status(), response.statusDescription(), IOUtils.asStringAlways(response.body())); } throw new EsHadoopInvalidRequest(msg); } }
private void checkResponse(Request request, Response response) { if (response.hasFailed()) { // check error first String msg = null; // try to parse the answer try { msg = extractError(this.<Map> parseContent(response.body(), null)); if (response.isClientError()) { msg = msg + "\n" + request.body(); } else { msg = prettify(msg, request.body()); } } catch (Exception ex) { // can't parse message, move on } if (!StringUtils.hasText(msg)) { msg = String.format("[%s] on [%s] failed; server[%s] returned [%s|%s:%s]", request.method().name(), request.path(), response.uri(), response.status(), response.statusDescription(), IOUtils.asStringAlways(response.body())); } throw new EsHadoopInvalidRequest(msg); } }
private void checkResponse(Request request, Response response) { if (response.hasFailed()) { // check error first String msg = null; // try to parse the answer try { EsHadoopException ex = errorExtractor.extractError(this.<Map> parseContent(response.body(), null)); msg = (ex != null) ? ex.toString() : null; if (response.isClientError()) { msg = msg + "\n" + request.body(); } else { msg = errorExtractor.prettify(msg, request.body()); } } catch (Exception ex) { // can't parse message, move on } if (!StringUtils.hasText(msg)) { msg = String.format("[%s] on [%s] failed; server[%s] returned [%s|%s:%s]", request.method().name(), request.path(), response.uri(), response.status(), response.statusDescription(), IOUtils.asStringAlways(response.body())); } throw new EsHadoopInvalidRequest(msg); } }
@Override public String toString() { StringBuilder sb = new StringBuilder(method.name()); sb.append("@"); sb.append(uri); sb.append("/"); sb.append(path); if (params != null) { sb.append("?"); sb.append(params); } return sb.toString(); } }
@Override public String toString() { StringBuilder sb = new StringBuilder(method.name()); sb.append("@"); sb.append(uri); sb.append("/"); sb.append(path); if (params != null) { sb.append("?"); sb.append(params); } return sb.toString(); } }
@Override public String toString() { StringBuilder sb = new StringBuilder(method.name()); sb.append("@"); sb.append(uri); sb.append("/"); sb.append(path); if (params != null) { sb.append("?"); sb.append(params); } return sb.toString(); } }
@Override public String toString() { StringBuilder sb = new StringBuilder(method.name()); sb.append("@"); sb.append(uri); sb.append("/"); sb.append(path); if (params != null) { sb.append("?"); sb.append(params); } return sb.toString(); } }