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


Java BasicHttpClient.newParams方法代码示例

本文整理汇总了Java中com.turbomanage.httpclient.BasicHttpClient.newParams方法的典型用法代码示例。如果您正苦于以下问题:Java BasicHttpClient.newParams方法的具体用法?Java BasicHttpClient.newParams怎么用?Java BasicHttpClient.newParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.turbomanage.httpclient.BasicHttpClient的用法示例。


在下文中一共展示了BasicHttpClient.newParams方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendSessionToServer

import com.turbomanage.httpclient.BasicHttpClient; //导入方法依赖的package包/类
/**
 * Posts a session to the event server.
 *
 * @param sessionId The ID of the session that was reviewed.
 * @return whether or not updating succeeded
 */
public boolean sendSessionToServer(String sessionId, List<String> questions) {

    BasicHttpClient httpClient = new BasicHttpClient();
    httpClient.addHeader(PARAMETER_EVENT_CODE, Config.FEEDBACK_API_CODE);
    httpClient.addHeader(PARAMETER_API_KEY, Config.FEEDBACK_API_KEY);

    ParameterMap parameterMap = httpClient.newParams();
    parameterMap.add(PARAMETER_SESSION_ID, sessionId);
    parameterMap.add(PARAMETER_SURVEY_ID, Config.FEEDBACK_SURVEY_ID);
    parameterMap.add(PARAMETER_REGISTRANT_ID, Config.FEEDBACK_DUMMY_REGISTRANT_ID);
    int i = 1;
    for (String question : questions) {
        parameterMap.add("q" + i, question);
        i++;
    }

    HttpResponse response = httpClient.get(mUrl, parameterMap);

    if (response != null && response.getStatus() == HttpURLConnection.HTTP_OK) {
        LogUtils.LOGD(TAG, "Server returned HTTP_OK, so session posting was successful.");
        return true;
    } else {
        LogUtils.LOGE(TAG, "Error posting session: HTTP status " + response.getStatus());
        return false;
    }
}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:33,代码来源:EventFeedbackApi.java

示例2: sendSessionToServer

import com.turbomanage.httpclient.BasicHttpClient; //导入方法依赖的package包/类
/**
 * Posts a session to the event server.
 *
 * @param sessionId The ID of the session that was reviewed.
 * @return whether or not updating succeeded
 */
public boolean sendSessionToServer(String sessionId, List<String> questions) {

    BasicHttpClient httpClient = new BasicHttpClient();
    httpClient.addHeader(PARAMETER_EVENT_CODE, Config.FEEDBACK_API_CODE);
    httpClient.addHeader(PARAMETER_API_KEY, Config.FEEDBACK_API_KEY);

    ParameterMap parameterMap = httpClient.newParams();
    parameterMap.add(PARAMETER_SESSION_ID, sessionId);
    parameterMap.add(PARAMETER_SURVEY_ID, Config.FEEDBACK_SURVEY_ID);
    parameterMap.add(PARAMETER_REGISTRANT_ID, Config.FEEDBACK_DUMMY_REGISTRANT_ID);
    int i = 1;
    for (String question : questions) {
        parameterMap.add("q" + i, question);
        i++;
    }

    HttpResponse response = httpClient.get(mUrl, parameterMap);

    if (response != null && response.getStatus() == HttpURLConnection.HTTP_OK) {
        LOGD(TAG, "Server returned HTTP_OK, so session posting was successful.");
        return true;
    } else {
        LOGE(TAG, "Error posting session: HTTP status " + response.getStatus());
        return false;
    }
}
 
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:33,代码来源:EventFeedbackApi.java


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