本文整理了Java中com.squareup.okhttp.Request.url
方法的一些代码示例,展示了Request.url
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.url
方法的具体详情如下:
包路径:com.squareup.okhttp.Request
类名称:Request
方法名:url
暂无
代码示例来源:origin: zalando/logbook
@Override
public String getPath() {
return request.url().getPath();
}
代码示例来源:origin: com.palantir.remoting2/tracing-okhttp2
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
// instrument request
OpenSpan callState = Tracer.startSpan(request.method() + " " + request.urlString(), SpanType.CLIENT_OUTGOING);
Request.Builder instrumentedRequest = new Request.Builder()
.headers(request.headers())
.url(request.url())
.method(request.method(), request.body())
.header(TraceHttpHeaders.TRACE_ID, Tracer.getTraceId())
.header(TraceHttpHeaders.SPAN_ID, callState.getSpanId())
.header(TraceHttpHeaders.IS_SAMPLED, Tracer.isTraceObservable() ? "1" : "0");
if (callState.getParentSpanId().isPresent()) {
instrumentedRequest.header(TraceHttpHeaders.PARENT_SPAN_ID, callState.getParentSpanId().get());
}
Response response;
try {
response = chain.proceed(instrumentedRequest.build());
} finally {
Tracer.completeSpan();
}
return response;
}
}
代码示例来源:origin: cn-ljb/rxjava_for_android
Protocol protocol = connection != null ? connection.getProtocol() : Protocol.HTTP_1_1;
StringBuilder requestStartMessage = new StringBuilder();
requestStartMessage.append("--> " + request.method() + ' ' + request.url() + ' ' + protocol(protocol));
if (!logHeaders && hasRequestBody) {
requestStartMessage.append(" (" + requestBody.contentLength() + BYTE_BODY);
+ response.request().url() + " (" + tookMs + "ms" + (!logHeaders ? ", "
+ responseBody.contentLength() + "-byte body" : "") + ')');
代码示例来源:origin: pratamawijaya/example
@Override public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
long t1 = System.nanoTime();
Timber.i(String.format("Sending request %s on %s%n%s", request.url(), chain.connection(),
request.headers()));
Response response = chain.proceed(request);
long t2 = System.nanoTime();
Timber.i(String.format("Received response for %s in %.1fms%n%s", response.request().url(),
(t2 - t1) / 1e6d, response.headers()));
Timber.i("response : " + response.message());
return response;
}
}
代码示例来源:origin: apiman/apiman
url = followUp.url();
requestHeaders = followUp.headers().newBuilder();
if (!httpEngine.sameConnection(followUp.url())) {
httpEngine.releaseConnection();
代码示例来源:origin: io.apiman/apiman-gateway-platforms-servlet
url = followUp.url();
requestHeaders = followUp.headers().newBuilder();
if (!httpEngine.sameConnection(followUp.url())) {
httpEngine.releaseConnection();
代码示例来源:origin: io.paradoxical/cassieq-client
static CassieqCredentials key(
final AccountName accountName,
final AccountKey accountKey,
final Clock requestClock) {
return request -> {
final Instant now = requestClock.now();
final SignedRequestSignatureGenerator requestParameters =
new SignedRequestSignatureGenerator(
accountName,
request.method(),
request.url().getPath(),
now.toDateTime(DateTimeZone.UTC));
final String signature = requestParameters.computeSignature(MacProviders.HmacSha256(accountKey));
final String requestTime = SignatureGenerator.formatDateTime(now);
return request.newBuilder()
.header("Authorization", "Signed " + signature)
.header(StandardAuthHeaders.RequestTime.getHeaderName(), requestTime)
.build();
};
}
代码示例来源:origin: com.squareup.okhttp/okhttp-urlconnection
url = followUp.url();
requestHeaders = followUp.headers().newBuilder();
内容来源于网络,如有侵权,请联系作者删除!