本文整理汇总了Java中com.squareup.okhttp.OkHttpClient.newCall方法的典型用法代码示例。如果您正苦于以下问题:Java OkHttpClient.newCall方法的具体用法?Java OkHttpClient.newCall怎么用?Java OkHttpClient.newCall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.squareup.okhttp.OkHttpClient
的用法示例。
在下文中一共展示了OkHttpClient.newCall方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: post
import com.squareup.okhttp.OkHttpClient; //导入方法依赖的package包/类
Call post(Callback callback) throws IOException {
OkHttpClient client = getUnsafeOkHttpClient();
CookieManager cookieManager = new CookieManager();
cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
client.setCookieHandler(cookieManager);
RequestBody requestBody = new FormEncodingBuilder()
.add("user_id", NetId)
.add("user_password", password)
.build();
Request request = new Request.Builder()
.url("https://studentmaintenance.webapps.snu.edu.in/students/public/studentslist/studentslist/loginauth")
.post(requestBody)
.build();
Call call = client.newCall(request);
call.enqueue(callback);
return call;
}
示例2: post
import com.squareup.okhttp.OkHttpClient; //导入方法依赖的package包/类
Call post(String mode, String username, String password, Callback callback) throws IOException {
OkHttpClient client = new OkHttpClient();
RequestBody formBody = new FormEncodingBuilder()
.add("mode", mode)
.add("username", username + "@snu.in")
.add("password", password)
.build();
Request request = new Request.Builder()
.url("http://192.168.50.1/24online/servlet/E24onlineHTTPClient")
.post(formBody)
.build();
Call call = client.newCall(request);
call.enqueue(callback);
return call;
}