本文整理了Java中com.squareup.okhttp.Request.httpUrl
方法的一些代码示例,展示了Request.httpUrl
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.httpUrl
方法的具体详情如下:
包路径:com.squareup.okhttp.Request
类名称:Request
方法名:httpUrl
暂无
代码示例来源:origin: stackoverflow.com
OkHttpClient client = new OkHttpClient();
client.interceptors().add(new Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(Chain chain) throws IOException {
Request request = chain.request();
HttpUrl url = request.httpUrl().newBuilder()
.addQueryParameter("platform", "android")
.addQueryParameter("app_version", com.package.BuildConfig.VERSION_NAME)
.build();
Request newRequest = chain.request().newBuilder().url(url).build();
return chain.proceed(newRequest);
}
});
代码示例来源:origin: zalando/logbook
@Override
public String getHost() {
return request.httpUrl().host();
}
代码示例来源:origin: zalando/logbook
@Override
public String getScheme() {
return request.httpUrl().scheme();
}
代码示例来源:origin: com.github.simonpercic/oklog-java
@Override protected String requestUrl(Request request) {
return request.httpUrl().toString();
}
代码示例来源:origin: com.github.simonpercic/oklog-java
@Override protected String requestUrlPath(Request request) {
return request.httpUrl().encodedPath();
}
代码示例来源:origin: zalando/logbook
@Override
public String getQuery() {
return Optional.ofNullable(request.httpUrl().query()).orElse("");
}
代码示例来源:origin: zalando/logbook
@Override
public Optional<Integer> getPort() {
final int port = request.httpUrl().port();
final int defaultPort = defaultPort(request.httpUrl().scheme());
return port == defaultPort ? Optional.empty() : Optional.of(port);
}
代码示例来源:origin: com.github.simonpercic/oklog-java
@Override protected String responseUrl(Response response) {
return response.request().httpUrl().toString();
}
代码示例来源:origin: io.paradoxical/cassieq-client
static CassieqCredentials signedQueryString(String queryAuth) {
final Map<String, String> queryAuthParams =
Splitter.on('&')
.omitEmptyStrings()
.withKeyValueSeparator('=')
.split(queryAuth);
return request -> {
final HttpUrl httpUrl = request.httpUrl();
HttpUrl.Builder newUrlBuilder = httpUrl.newBuilder();
for (Map.Entry<String, String> entry : queryAuthParams.entrySet()) {
newUrlBuilder = newUrlBuilder.addQueryParameter(entry.getKey(), entry.getValue());
}
return request.newBuilder()
.url(newUrlBuilder.build())
.build();
};
}
代码示例来源:origin: PaNaVTEC/Clean-Contacts
private HttpUrl composeUrl(Chain chain) {
return chain.request().httpUrl()
.newBuilder()
.addQueryParameter("seed", "panavtec")
.build();
}
}
代码示例来源:origin: JmStefanAndroid/PVCloudGroupn
Log.e(TAG, "URL:"+response.request().httpUrl().url().toString()+" result=" + resultStr);
if (response.request().httpUrl().url().toString().contains(Contants.API.BASE_URL)) {
try {//尝试解析为基础数据
BaseRespMsg respMsg = mGson.fromJson(resultStr, BaseRespMsg.class);
代码示例来源:origin: io.macgyver/macgyver-core
String requestStartMessage = "--> " + request.method() + ' ' + request.httpUrl() + ' ' + protocol(protocol);
if (!logHeaders && hasRequestBody) {
requestStartMessage += " (" + requestBody.contentLength() + "-byte body)";
代码示例来源:origin: com.squareup.okhttp/okhttp-urlconnection
if (!httpEngine.sameConnection(followUp.httpUrl())) {
streamAllocation.release();
streamAllocation = null;
内容来源于网络,如有侵权,请联系作者删除!