当前位置: 首页>>代码示例>>Java>>正文


Java Request.url方法代码示例

本文整理汇总了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();
}
 
开发者ID:pre-dem,项目名称:pre-dem-android,代码行数:20,代码来源:OkHttp2Probe.java

示例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);
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:41,代码来源:HttpURLConnectionImpl.java


注:本文中的com.squareup.okhttp.Request.url方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。