public static StatusLine get(Response response) { return new StatusLine(response.protocol(), response.code(), response.message()); }
Entry(Response response) { this.url = response.request().url().toString(); this.varyHeaders = HttpHeaders.varyHeaders(response); this.requestMethod = response.request().method(); this.protocol = response.protocol(); this.code = response.code(); this.message = response.message(); this.responseHeaders = response.headers(); this.handshake = response.handshake(); this.sentRequestMillis = response.sentRequestAtMillis(); this.receivedResponseMillis = response.receivedResponseAtMillis(); }
private static void sendRequest(OkHttpClient client, String url) { System.out.printf("%-40s ", url); System.out.flush(); System.out.println(Platform.get()); Request request = new Request.Builder().url(url).build(); try (Response response = client.newCall(request).execute()) { Handshake handshake = response.handshake(); System.out.println(handshake.tlsVersion() + " " + handshake.cipherSuite() + " " + response.protocol() + " " + response.code + " " + response.body.bytes().length + "b"); } catch (IOException ioe) { System.out.println(ioe.toString()); } } }
public static StatusLine get(Response response) { return new StatusLine(response.protocol(), response.code(), response.message()); }
+ response.networkResponse().code() + " over " + response.protocol() + ")") : "(cache)"; int responseCode = response.code();
private List<InetAddress> readResponse(String hostname, Response response) throws Exception { if (response.cacheResponse() == null && response.protocol() != Protocol.HTTP_2) { Platform.get().log(Platform.WARN, "Incorrect protocol: " + response.protocol(), null); } try { if (!response.isSuccessful()) { throw new IOException("response: " + response.code() + " " + response.message()); } ResponseBody body = response.body(); if (body.contentLength() > MAX_RESPONSE_SIZE) { throw new IOException("response size exceeds limit (" + MAX_RESPONSE_SIZE + " bytes): " + body.contentLength() + " bytes"); } ByteString responseBytes = body.source().readByteString(); return DnsRecordCodec.decodeAnswers(hostname, responseBytes); } finally { response.close(); } }
Entry(Response response) { this.url = response.request().url().toString(); this.varyHeaders = HttpHeaders.varyHeaders(response); this.requestMethod = response.request().method(); this.protocol = response.protocol(); this.code = response.code(); this.message = response.message(); this.responseHeaders = response.headers(); this.handshake = response.handshake(); this.sentRequestMillis = response.sentRequestAtMillis(); this.receivedResponseMillis = response.receivedResponseAtMillis(); }
ResponseHeaderRecord(Response response) { this.url = response.request().url().toString(); this.varyHeaders = HttpHeaders.varyHeaders(response); this.requestMethod = response.request().method(); this.protocol = response.protocol(); this.code = response.code(); this.message = response.message(); this.responseHeaders = response.headers(); this.handshake = response.handshake(); this.sentRequestMillis = response.sentRequestAtMillis(); this.receivedResponseMillis = response.receivedResponseAtMillis(); }
private Headers getHeaders() throws IOException { if (responseHeaders == null) { Response response = getResponse(true); Headers headers = response.headers(); responseHeaders = headers.newBuilder() .add(SELECTED_PROTOCOL, response.protocol().toString()) .add(RESPONSE_SOURCE, responseSourceHeader(response)) .build(); } return responseHeaders; }
transaction.setProtocol(response.protocol().toString()); transaction.setResponseCode(response.code()); transaction.setResponseMessage(response.message());
@Override public HttpVersion getProtocol() { if (protocol == null) { String protocol = this.response.protocol().toString().split("/")[0]; boolean keepAlive = KEEP_ALIVE.equalsIgnoreCase(this.response .header("Connection")); if (this.response.protocol() == Protocol.HTTP_1_0) { return new HttpVersion(protocol, 1, 0, keepAlive); } else if (this.response.protocol() == Protocol.HTTP_1_1) { return new HttpVersion(protocol, 1, 1, keepAlive); } else if (this.response.protocol() == Protocol.HTTP_2) { return new HttpVersion(protocol, 2, 0, keepAlive); } else if (this.response.protocol() == Protocol.SPDY_3) { return new HttpVersion(protocol, 3, 0, keepAlive); } else { this.protocol = new HttpVersion(protocol, keepAlive); } } return protocol; }
/** * * @return */ public Protocol protocol() { return response.protocol(); }
@Override public String getProtocolVersion() { // see https://tools.ietf.org/html/rfc7230#section-2.6 return response.protocol().toString().toUpperCase(Locale.ROOT); }
public Entry(Response response) { this.url = response.request().url().toString(); this.varyHeaders = OkHeaders.varyHeaders(response); this.requestMethod = response.request().method(); this.protocol = response.protocol(); this.code = response.code(); this.message = response.message(); this.responseHeaders = response.headers(); this.handshake = response.handshake(); }
public Entry(Response response) { this.url = response.request().url().toString(); this.varyHeaders = OkHeaders.varyHeaders(response); this.requestMethod = response.request().method(); this.protocol = response.protocol(); this.code = response.code(); this.message = response.message(); this.responseHeaders = response.headers(); this.handshake = response.handshake(); }
public Entry(Response response) { this.url = response.request().url().toString(); this.varyHeaders = OkHeaders.varyHeaders(response); this.requestMethod = response.request().method(); this.protocol = response.protocol(); this.code = response.code(); this.message = response.message(); this.responseHeaders = response.headers(); this.handshake = response.handshake(); }
Entry(Response response) { this.url = response.request().url().toString(); this.varyHeaders = HttpHeaders.varyHeaders(response); this.requestMethod = response.request().method(); this.protocol = response.protocol(); this.code = response.code(); this.message = response.message(); this.responseHeaders = response.headers(); this.handshake = response.handshake(); this.sentRequestMillis = response.sentRequestAtMillis(); this.receivedResponseMillis = response.receivedResponseAtMillis(); }
HermesResponse fromOkHttpResponse(Response response) throws IOException { return hermesResponse() .withHeaderSupplier(response::header) .withHttpStatus(response.code()) .withBody(response.body().string()) .withProtocol(response.protocol().toString()) .build(); } }
/** Construct a OkReplay Response based on the provided OkHttp response */ static Response adapt(final okhttp3.Response okhttpResponse, ResponseBody body) { return new RecordedResponse.Builder() .headers(okhttpResponse.headers()) .body(body) .protocol(okhttpResponse.protocol()) .code(okhttpResponse.code()) .build(); }
private Headers getHeaders() throws IOException { if (responseHeaders == null) { Response response = getResponse(true); Headers headers = response.headers(); responseHeaders = headers.newBuilder() .add(SELECTED_PROTOCOL, response.protocol().toString()) .add(RESPONSE_SOURCE, responseSourceHeader(response)) .build(); } return responseHeaders; }