public String getStatusText() { return response.getStatusText(); }
private void fireCompleted(Response response) { if (listener != null) { listener.onCompleted(uri, response.getStatusCode(), response.getStatusText()); } } }
Response response = responseFuture.get(); if (response.getStatusCode() != HttpURLConnection.HTTP_OK) { log.warn("[{}] HTTP get request failed: {}", requestUrl, response.getStatusText()); Exception e; if (response.getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { e = new NotFoundException("Not found: " + response.getStatusText()); } else { e = new PulsarClientException("HTTP get request failed: " + response.getStatusText());
/** * Converts async-http-client response to okhttp response. * * @param asyncHttpClientResponse async-http-client response * @return okhttp response. * @throws NullPointerException in case of null arguments */ private Response toOkhttpResponse(org.asynchttpclient.Response asyncHttpClientResponse) { // status code val rspBuilder = new Response.Builder() .request(request()) .protocol(Protocol.HTTP_1_1) .code(asyncHttpClientResponse.getStatusCode()) .message(asyncHttpClientResponse.getStatusText()); // headers if (asyncHttpClientResponse.hasResponseHeaders()) { asyncHttpClientResponse.getHeaders().forEach(e -> rspBuilder.header(e.getKey(), e.getValue())); } // body if (asyncHttpClientResponse.hasResponseBody()) { val contentType = asyncHttpClientResponse.getContentType() == null ? null : MediaType.parse(asyncHttpClientResponse.getContentType()); val okHttpBody = ResponseBody.create(contentType, asyncHttpClientResponse.getResponseBodyAsBytes()); rspBuilder.body(okHttpBody); } else { rspBuilder.body(EMPTY_BODY); } return rspBuilder.build(); }
"Emissions of events not successful[%d: %s], with message[%s].", response.getStatusCode(), response.getStatusText(), response.getResponseBody(StandardCharsets.UTF_8).trim() );
/** * Get the HTTP status text of the response */ @Override public String getStatusText() { return ahcResponse.getStatusText(); }
public String getStatusText() { return response.getStatusText(); }
private void logResponse(Response response) throws IOException { if (logger.isDebugEnabled()) { logger.debug("Response HTTP/{} {}\n{}", response.getStatusCode(), response.getStatusText(), response.getResponseBody()); } if (logger.isTraceEnabled()) { logger.trace("Response headers {}", response.getHeaders()); } }
private void fireCompleted(Response response) { if (listener != null) { listener.onCompleted(uri, response.getStatusCode(), response.getStatusText()); } } }
public ZendeskResponseException(Response resp) throws IOException { this(resp.getStatusCode(), resp.getStatusText(), resp.getResponseBody()); }
private void handleResponse(String id, Response response) { if (response == null || response.getStatusCode() != OK_200) { log.error("Handling error for id {} with response {}", id, response); responses.offer(new PubSubMessage(id, DRPCError.CANNOT_REACH_DRPC.asJSONClip())); return; } log.info("Received for id {}: {} {}", response.getStatusCode(), id, response.getStatusText()); String body = response.getResponseBody(); PubSubMessage message = PubSubMessage.fromJSON(body); log.debug("Received for id {}:\n{}", message.getId(), message.getContent()); responses.offer(message); } }
private void handleResponse(String id, Response response) { if (response == null || response.getStatusCode() != OK_200) { log.error("Handling error for id {} with response {}", id, response); responses.offer(new PubSubMessage(id, DRPCError.CANNOT_REACH_DRPC.asJSONClip())); return; } log.info("Received for id {}: {} {}", response.getStatusCode(), id, response.getStatusText()); String body = response.getResponseBody(); PubSubMessage message = PubSubMessage.fromJSON(body); log.debug("Received for id {}:\n{}", message.getId(), message.getContent()); responses.offer(message); } }
private Response getResponse(int status, String statusText, String body) { Response mock = mock(Response.class); doReturn(status).when(mock).getStatusCode(); doReturn(statusText).when(mock).getStatusText(); doReturn(body).when(mock).getResponseBody(); return mock; }
@Override public T onCompleted(org.asynchttpclient.Response ahcResponse) { try { final Map<String, String> headersMap = new HashMap<>(); for (Map.Entry<String, String> header : ahcResponse.getHeaders()) { headersMap.put(header.getKey(), header.getValue()); } final Response response = new Response(ahcResponse.getStatusCode(), ahcResponse.getStatusText(), headersMap, ahcResponse.getResponseBodyAsStream()); @SuppressWarnings("unchecked") final T t = converter == null ? (T) response : converter.convert(response); if (callback != null) { callback.onCompleted(t); } return t; } catch (IOException | RuntimeException e) { onThrowable(e); return null; } }
Response response = responseFuture.get(); if (response.getStatusCode() != HttpURLConnection.HTTP_OK) { log.warn("[{}] HTTP get request failed: {}", requestUrl, response.getStatusText()); Exception e; if (response.getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { e = new NotFoundException("Not found: " + response.getStatusText()); } else { e = new PulsarClientException("HTTP get request failed: " + response.getStatusText());
Response response = responseFuture.get(); if (response.getStatusCode() != HttpURLConnection.HTTP_OK) { log.warn("[{}] HTTP get request failed: {}", requestUrl, response.getStatusText()); future.completeExceptionally( new PulsarClientException("HTTP get request failed: " + response.getStatusText())); return;
"Emissions of events not successful[%d: %s], with message[%s].", response.getStatusCode(), response.getStatusText(), response.getResponseBody(StandardCharsets.UTF_8).trim() );
exceptionMessage = parseDetailIfAvailable(exceptionMessage); if (exceptionMessage == null) { exceptionMessage = response.getStatusText();
"Emissions of events not successful[%d: %s], with message[%s].", response.getStatusCode(), response.getStatusText(), response.getResponseBody(StandardCharsets.UTF_8).trim() );
"Emissions of events not successful[%d: %s], with message[%s].", response.getStatusCode(), response.getStatusText(), response.getResponseBody(StandardCharsets.UTF_8).trim() );