本文整理汇总了Java中com.squareup.okhttp.Request.url方法的典型用法代码示例。如果您正苦于以下问题:Java Request.url方法的具体用法?Java Request.url怎么用?Java Request.url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.squareup.okhttp.Request
的用法示例。
在下文中一共展示了Request.url方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onOkHttpNew
import com.squareup.okhttp.Request; //导入方法依赖的package包/类
@Around("call(* com.squareup.okhttp.OkHttpClient+.newCall(..))")
public Object onOkHttpNew(ProceedingJoinPoint joinPoint) throws Throwable {
if (!Configuration.httpMonitorEnable || joinPoint.getArgs().length != 1) {
return joinPoint.proceed();
}
Object[] args = joinPoint.getArgs();
Request request = (Request) args[0];
//url
URL url = request.url();
if (GlobalConfig.isExcludeHost(url.getHost())) {
return joinPoint.proceed();
}
RespBean bean = new RespBean();
bean.setUrl(url.toString());
bean.setStartTimestamp(System.currentTimeMillis());
startTimeStamp.add(bean);
return joinPoint.proceed();
}
示例2: getResponse
import com.squareup.okhttp.Request; //导入方法依赖的package包/类
private HttpEngine getResponse() throws IOException {
initHttpEngine();
if (this.httpEngine.hasResponse()) {
return this.httpEngine;
}
while (true) {
if (execute(true)) {
Response response = this.httpEngine.getResponse();
Request followUp = this.httpEngine.followUpRequest();
if (followUp == null) {
this.httpEngine.releaseStreamAllocation();
return this.httpEngine;
}
int i = this.followUpCount + 1;
this.followUpCount = i;
if (i > 20) {
throw new ProtocolException("Too many follow-up requests: " + this
.followUpCount);
}
this.url = followUp.url();
this.requestHeaders = followUp.headers().newBuilder();
Sink requestBody = this.httpEngine.getRequestBody();
if (!followUp.method().equals(this.method)) {
requestBody = null;
}
if (requestBody == null || (requestBody instanceof RetryableSink)) {
StreamAllocation streamAllocation = this.httpEngine.close();
if (!this.httpEngine.sameConnection(followUp.httpUrl())) {
streamAllocation.release();
streamAllocation = null;
}
this.httpEngine = newHttpEngine(followUp.method(), streamAllocation,
(RetryableSink) requestBody, response);
} else {
throw new HttpRetryException("Cannot retry streamed HTTP body", this
.responseCode);
}
}
}
}