本文整理汇总了Java中com.lidroid.xutils.HttpUtils.configCurrentHttpCacheExpiry方法的典型用法代码示例。如果您正苦于以下问题:Java HttpUtils.configCurrentHttpCacheExpiry方法的具体用法?Java HttpUtils.configCurrentHttpCacheExpiry怎么用?Java HttpUtils.configCurrentHttpCacheExpiry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.lidroid.xutils.HttpUtils
的用法示例。
在下文中一共展示了HttpUtils.configCurrentHttpCacheExpiry方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doDonate
import com.lidroid.xutils.HttpUtils; //导入方法依赖的package包/类
void doDonate(int love_id, String money){
RequestParams params = new RequestParams();
params.addHeader("authorization", loginData.getToken());
params.addBodyParameter("love_id", love_id + "");
params.addBodyParameter("money", money);
HttpUtils httpUtils = new HttpUtils();
httpUtils.configCurrentHttpCacheExpiry(1000);
httpUtils.send(HttpRequest.HttpMethod.POST, ApiStores.donate, params, new RequestCallBack<String>() {
@Override
public void onSuccess(com.lidroid.xutils.http.ResponseInfo<String> responseInfo) {
Toast.makeText(context, "捐赠成功", Toast.LENGTH_SHORT).show();
et_donate.setText("");
getDetails(donation.id);
CenterFragment.instance.getMyInfo();
}
@Override
public void onFailure(HttpException e, String s) {
Toast.makeText(context, "请求失败" + s, Toast.LENGTH_SHORT).show();
Log.e("aaa", e.getMessage());
Log.e("aaa", s);
}
});
}
示例2: getDetails
import com.lidroid.xutils.HttpUtils; //导入方法依赖的package包/类
void getDetails(int donationId){
RequestParams params = new RequestParams();
params.addHeader("authorization", loginData.getToken());
params.addQueryStringParameter("love_id", donationId + "");
HttpUtils httpUtils = new HttpUtils();
httpUtils.configCurrentHttpCacheExpiry(1000);
httpUtils.send(HttpRequest.HttpMethod.GET, ApiStores.getDonationDetail, params, new RequestCallBack<String>() {
@Override
public void onSuccess(com.lidroid.xutils.http.ResponseInfo<String> responseInfo) {
donation = new Gson().fromJson(responseInfo.result, RequestDonation.class).data;
initViews();
}
@Override
public void onFailure(HttpException e, String s) {
Toast.makeText(context, "请求失败", Toast.LENGTH_SHORT).show();
Log.e("aaa", e.getMessage());
Log.e("aaa", s);
}
});
}
示例3: getXutils_HttpUtils
import com.lidroid.xutils.HttpUtils; //导入方法依赖的package包/类
private static HttpUtils getXutils_HttpUtils(){
HttpUtils http = new HttpUtils(Request_Charset);
http.configResponseTextCharset(Response_Charset);
http.configCurrentHttpCacheExpiry(timeout);
return http;
}
示例4: send
import com.lidroid.xutils.HttpUtils; //导入方法依赖的package包/类
private void send(HttpRequest.HttpMethod arg0,RequestParams params){
SharedPreferences sharedPref = context.getSharedPreferences("appdata",Context.MODE_PRIVATE);
params.addHeader("Cookie","JSESSIONID="+sharedPref.getString("SessionId", ""));
http = new HttpUtils();
http.configCurrentHttpCacheExpiry(1000 * 1);
http.send(arg0,
declare.getHost_url() + uri,
params,
new RequestCallBack<String>() {
@Override
public void onStart() {
Log.i(TAG ,"onStart" ) ;
}
@Override
public void onSuccess(ResponseInfo<String> responseInfo) {
Log.i(TAG, "Http==>"+responseInfo.result);
try {
jsonObject = new JSONObject(responseInfo.result);
if(jsonObject.getString("response").equals("error")){
refresh.refresh(jsonObject.getJSONObject("error").getString("text"), -1);
}else if(jsonObject.getString("response").equals("notlogin")){
Toast.makeText(context, "登录过期,请重新登录", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(context,LogOffACTIVITY.class);
intent.putExtra("action", 1);
context.startActivity(intent);
}else {
callback.getResult(jsonObject);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onFailure(HttpException error, String msg) {
Log.i(TAG ,"error==>" + msg ) ;
refresh.refresh(msg, -1);
}
});
}