當前位置: 首頁>>代碼示例>>Java>>正文


Java RequestParams類代碼示例

本文整理匯總了Java中com.loopj.android.http.RequestParams的典型用法代碼示例。如果您正苦於以下問題:Java RequestParams類的具體用法?Java RequestParams怎麽用?Java RequestParams使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RequestParams類屬於com.loopj.android.http包,在下文中一共展示了RequestParams類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: executeSample

import com.loopj.android.http.RequestParams; //導入依賴的package包/類
@Override
public RequestHandle executeSample(AsyncHttpClient client, String URL, Header[] headers, HttpEntity entity, ResponseHandlerInterface responseHandler) {
    RequestParams params = new RequestParams();
    params.setUseJsonStreamer(true);
    JSONObject body;
    if (isRequestBodyAllowed() && (body = getBodyTextAsJSON()) != null) {
        try {
            Iterator keys = body.keys();
            Log.d(LOG_TAG, "JSON data:");
            while (keys.hasNext()) {
                String key = (String) keys.next();
                Log.d(LOG_TAG, "  " + key + ": " + body.get(key));
                params.put(key, body.get(key).toString());
            }
        } catch (JSONException e) {
            Log.w(LOG_TAG, "Unable to retrieve a JSON value", e);
        }
    }
    return client.post(this, URL, headers, params,
            RequestParams.APPLICATION_JSON, responseHandler);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:22,代碼來源:JsonStreamerSample.java

示例2: executeSample

import com.loopj.android.http.RequestParams; //導入依賴的package包/類
@Override
public RequestHandle executeSample(AsyncHttpClient client, String URL, Header[] headers, HttpEntity entity, ResponseHandlerInterface responseHandler) {
    try {
        RequestParams params = new RequestParams();
        final String contentType = RequestParams.APPLICATION_OCTET_STREAM;
        params.put("fileOne", createTempFile("fileOne", 1020), contentType, "fileOne");
        params.put("fileTwo", createTempFile("fileTwo", 1030), contentType);
        params.put("fileThree", createTempFile("fileThree", 1040), contentType, "customFileThree");
        params.put("fileFour", createTempFile("fileFour", 1050), contentType);
        params.put("fileFive", createTempFile("fileFive", 1060), contentType, "testingFileFive");
        params.setHttpEntityIsRepeatable(true);
        params.setUseJsonStreamer(false);
        return client.post(this, URL, params, responseHandler);
    } catch (FileNotFoundException fnfException) {
        Log.e(LOG_TAG, "executeSample failed with FileNotFoundException", fnfException);
    }
    return null;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:19,代碼來源:FilesSample.java

示例3: changeIssueState

import com.loopj.android.http.RequestParams; //導入依賴的package包/類
/***
 * 改變一個任務的狀態
 *
 * @param teamId
 * @param issue
 * @param target  修改的屬性("state" : 狀態, "assignee" 指派人, "deadline" : 截止日期)
 * @param handler
 * @return void
 * @author 火蟻 2015-3-6 上午11:44:01
 */
public static void changeIssueState(int teamId, TeamIssue issue,
                                    String target, AsyncHttpResponseHandler handler, Context context) {
    if (issue == null)
        return;
    RequestParams params = new RequestParams();
    params.put("uid", AccountHelper.getUserId());
    params.put("teamid", teamId);
    params.put("target", target);
    params.put("issueid", issue.getId());
    if (target.equals("state")) {
        params.put("state", issue.getState());
    } else if (target.equals("assignee")) {
        params.put("assignee", issue.getToUser().getId());
    } else if (target.equals("deadline")) {
        params.put("deadline", issue.getDeadlineTime());
    }
    ApiHttpClient.post("action/api/team_issue_update", params, handler);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:29,代碼來源:OSChinaTeamApi.java

示例4: pubTeamNewActive

import com.loopj.android.http.RequestParams; //導入依賴的package包/類
/***
 * 發表一個新的團隊動態
 *
 * @param teamId
 * @param content
 * @param img
 * @param handler
 * @return void
 * @author 火蟻 2015-3-9 下午2:46:13
 */
public static void pubTeamNewActive(int teamId, String content, File img,
                                    AsyncHttpResponseHandler handler, Context context) {
    RequestParams params = new RequestParams();
    params.put("teamid", teamId);
    params.put("uid", AccountHelper.getUserId());
    params.put("msg", content);
    params.put("appid", 3);
    if (img != null) {

        try {
            params.put("img", img);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }
    ApiHttpClient.post("action/api/team_tweet_pub", params, handler);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:28,代碼來源:OSChinaTeamApi.java

示例5: eventApply

import com.loopj.android.http.RequestParams; //導入依賴的package包/類
/**
 * 活動報名
 *
 * @param data
 * @param handler
 */
@Deprecated
public static void eventApply(EventApplyData data, AsyncHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("event", data.getEvent());
    params.put("user", data.getUser());
    params.put("name", data.getName());
    params.put("gender", data.getGender());
    params.put("mobile", data.getPhone());
    params.put("company", data.getCompany());
    params.put("job", data.getJob());
    if (!StringUtils.isEmpty(data.getRemark())) {
        params.put("misc_info", data.getRemark());
    }
    post("action/api/event_apply", params, handler);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:22,代碼來源:OSChinaApi.java

示例6: pubComment

import com.loopj.android.http.RequestParams; //導入依賴的package包/類
/**
 * 發布評論
 */
public static void pubComment(long sourceId, int type, String content, long referId, long replyId,
                              long reAuthorId,
                              TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("sourceId", sourceId);
    params.put("type", type);
    params.put("content", content);
    if (referId > 0)
        params.put("referId", referId);
    if (replyId > 0)
        params.put("replyId", replyId);
    if (reAuthorId > 0)
        params.put("reAuthorId", reAuthorId);
    post("action/apiv2/comment_push", params, handler);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:19,代碼來源:OSChinaApi.java

示例7: pubBlog

import com.loopj.android.http.RequestParams; //導入依賴的package包/類
/**
 * 發布博客
 *
 * @param Blog    博客
 * @param handler 回調
 */
public static void pubBlog(Blog blog, TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("title", blog.getTitle());
    params.put("abstract", blog.getSummary());
    params.put("system", blog.getSystem());
    params.put("catalog", blog.getCatalog());
    params.put("canVisible", blog.getCanVisible());
    params.put("canComment", blog.getCanComment());
    params.put("isStick", blog.getIsStick());
    params.put("type", blog.getType());
    params.put("content", blog.getContent());
    ApiHttpClient.post("action/apiv2/pub_blog", params, handler);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:20,代碼來源:OSChinaApi.java

示例8: getCredit

import com.loopj.android.http.RequestParams; //導入依賴的package包/類
/**
 * 信用積分
 *
 * @return
 */
public static String getCredit()//s
{
    RequestParams requestParms = new RequestParams();
    requestParms.put("userid", useid);//q.getUrl().d()
    requestParms.put("times", System.currentTimeMillis());
    requestParms.put("lang", Locale.getDefault().getLanguage());
    return getUrl("/credit/index.html", requestParms);
}
 
開發者ID:yiwent,項目名稱:Mobike,代碼行數:14,代碼來源:BuidUrl.java

示例9: executeSample

import com.loopj.android.http.RequestParams; //導入依賴的package包/類
@Override
public RequestHandle executeSample(AsyncHttpClient client, String URL, Header[] headers, HttpEntity entity, ResponseHandlerInterface responseHandler) {
    RequestParams rParams = new RequestParams();
    rParams.put("sample_key", "Sample String");
    try {
        File sample_file = File.createTempFile("temp_", "_handled", getCacheDir());
        rParams.put("sample_file", sample_file);
    } catch (IOException e) {
        Log.e(LOG_TAG, "Cannot add sample file", e);
    }
    return client.post(this, URL, headers, rParams, "multipart/form-data", responseHandler);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:13,代碼來源:ContentTypeForHttpEntitySample.java

示例10: refreshTokens

import com.loopj.android.http.RequestParams; //導入依賴的package包/類
public static RequestHandle refreshTokens(Context context, String scopes, AsyncHttpResponseHandler handler) {
    SyncHttpClient client = new SyncHttpClient();
    RequestParams params = new RequestParams();
    params.put("client_id", context.getString(R.string.facebook_app_id));
    params.put("redirect_uri", "https://www.facebook.com/connect/login_success.html");
    params.put("response_type", "token");
    params.put("scopes", scopes);
    return client.get("https://www.facebook.com/v2.9/dialog/oauth", params, handler);
}
 
開發者ID:danvratil,項目名稱:FBEventSync,代碼行數:10,代碼來源:Graph.java

示例11: getParams

import com.loopj.android.http.RequestParams; //導入依賴的package包/類
public RequestParams getParams() {
    RequestParams params = new RequestParams();
    params.put("vender_id", vendorId);
    params.put("device_id", deviceId);
    params.put("serial", serial);
    params.put("android_device_unique_id", androidDeviceUniqueId);
    params.put("android_user_unique_id", androidUserUniqueId);
    params.put("android_device_info", androidDeviceInfo);
    params.put("android_os_ver", androidOSVer);
    params.put("lib_version", libVersion);
    params.put("device_info", deviceInfo);

    return params;
}
 
開發者ID:iyundong,項目名稱:InstantUpload,代碼行數:15,代碼來源:BaseInfo.java

示例12: getUserFansOrFlows

import com.loopj.android.http.RequestParams; //導入依賴的package包/類
/**
 * @param type      {@link #TYPE_USER_FLOWS ,#TYPE_USER_FANS}
 * @param userId    userId
 * @param pageToken pageToken
 * @param handler   handler
 */
public static void getUserFansOrFlows(int type, long userId, String pageToken, TextHttpResponseHandler handler) {
    if (userId <= 0) return;
    RequestParams params = new RequestParams();
    params.put("id", userId);
    params.put("pageToken", pageToken);

    String uri = "user_follows";
    if (type == TYPE_USER_FANS) {
        uri = "user_fans";
    }
    ApiHttpClient.get("action/apiv2/" + uri, params, handler);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:19,代碼來源:OSChinaApi.java

示例13: getProjectComments

import com.loopj.android.http.RequestParams; //導入依賴的package包/類
/**
 * 獲取項目評論
 *
 * @param id      項目id
 * @param handler 回調
 */
public static void getProjectComments(long id, String token, TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    params.put("projectId", id);
    params.put("pageToken", token);
    ApiHttpClient.get("action/apiv2/git_comments_list", params, handler);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:13,代碼來源:API.java

示例14: post

import com.loopj.android.http.RequestParams; //導入依賴的package包/類
public static void post(Context context, String urlString, RequestParams params, JsonHttpResponseHandler res)   //帶參數,獲取json對象或者數組
{
    if (isNetworkConnected(context)) {
        client.cancelRequests(context, true);
        client.post(urlString, params, res);
    } else {
        makeText(context);
    }

}
 
開發者ID:While1true,項目名稱:JSSample,代碼行數:11,代碼來源:HttpUtils.java

示例15: getGists

import com.loopj.android.http.RequestParams; //導入依賴的package包/類
/**
 * 獲取代碼片段
 *
 * @param language language
 * @param type     type
 * @param page     page
 * @param handler  handler
 */
public static void getGists(String language, String type, int page, TextHttpResponseHandler handler) {
    RequestParams params = new RequestParams();
    if (!TextUtils.isEmpty(language))
        params.put("language", language);
    if (!TextUtils.isEmpty(type))
        params.put("type", type);
    params.put("page", page);
    mClient.get("https://gitee.com/api/v3/gists/public", params, handler);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:18,代碼來源:API.java


注:本文中的com.loopj.android.http.RequestParams類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。