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


Java ParameterMap类代码示例

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


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

示例1: initWithStubbedSuccessfulConnection

import com.turbomanage.httpclient.ParameterMap; //导入依赖的package包/类
private void initWithStubbedSuccessfulConnection(){
    when(mMockHttpClient.addHeader(anyString(), anyString())).thenReturn(mMockHttpClient);
    when(mMockHttpClient.newParams()).thenReturn(mMockParameterMap);
    when(mMockParameterMap.add(anyString(),anyString())).thenReturn(mMockParameterMap);
    when(mMockHttpClient.get(eq(FAKE_URL), any(ParameterMap.class))).thenReturn(
            mMockHttpResponse);
    when(mMockHttpResponse.getStatus()).thenReturn(HttpURLConnection.HTTP_OK);
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:9,代码来源:FeedbackApiHelperTest.java

示例2: sendSessionToServer

import com.turbomanage.httpclient.ParameterMap; //导入依赖的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

示例3: sendSessionToServer

import com.turbomanage.httpclient.ParameterMap; //导入依赖的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

示例4: OnRun

import com.turbomanage.httpclient.ParameterMap; //导入依赖的package包/类
@Override
protected void OnRun() {
    String url = SignalAUtils.EnsureEndsWith(mConnection.getUrl(), "/");
	try {
		url += "abort?transport=LongPolling&connectionToken=" + URLEncoder.encode(mConnection.getConnectionToken(), "utf-8");
	} catch (UnsupportedEncodingException e) {
		Log.e(TAG, "Unsupported message encoding error, when encoding connectionToken.");
	}
	TransportHelper.AppendCustomQueryString(mConnection, url);

	AsyncCallback cb = new AsyncCallback() {
		
		@Override
		public void onComplete(HttpResponse httpResponse) {
			
			if(httpResponse.getStatus() != 200 || httpResponse.getBodyAsString() == null || httpResponse.getBodyAsString().isEmpty())
			{
				Log.e(TAG, "Clean disconnect failed. " + httpResponse.getStatus());
			}
			
			mConnection.SetNewState(new DisconnectedState(mConnection));
		}

        @Override
        public void onError(Exception ex) {
			mConnection.setError(ex);
			mConnection.SetNewState(new DisconnectedState(mConnection));
        }
	};

	ParallelHttpClient httpClient = new ParallelHttpClient();
	httpClient.setMaxRetries(1);
	ParameterMap params = httpClient.newParams();
	httpClient.post(url, params, cb);
}
 
开发者ID:yukozh,项目名称:CodeComb.Mobile.Android,代码行数:36,代码来源:DisconnectingState.java

示例5: notifyGcmDevices

import com.turbomanage.httpclient.ParameterMap; //导入依赖的package包/类
private void notifyGcmDevices() {
    String plusID = AccountUtils.getPlusProfileId(getApplicationContext());
    if (plusID != null) {
        LOGI(TAG, "Sending device sync notification");
        AndroidHttpClient httpClient = new AndroidHttpClient(Config.GCM_SERVER_URL);
        httpClient.setMaxRetries(1);
        ParameterMap params = httpClient.newParams()
                .add("key", Config.GCM_API_KEY)
                .add("squelch", ServerUtilities.getGcmId(this));
        String path = "/send/" + plusID + "/sync_user";
        httpClient.post(path, params, new AsyncCallback() {
            @Override
            public void onComplete(HttpResponse httpResponse) {
                LOGI(TAG, "Device sync notification sent");
            }

            @Override
            public void onError(Exception e) {
                LOGW(TAG, "Device sync notification failed", e);
            }
        });


    } else {
        LOGI(TAG, "No gPlusID, skipping device sync notification");
    }
}
 
开发者ID:TheDeltaProgram,项目名称:iosched2013,代码行数:28,代码来源:ScheduleUpdaterService.java

示例6: initWithStubbedUnsuccessfulConnection

import com.turbomanage.httpclient.ParameterMap; //导入依赖的package包/类
private void initWithStubbedUnsuccessfulConnection(){
    when(mMockHttpClient.addHeader(anyString(), anyString())).thenReturn(mMockHttpClient);
    when(mMockHttpClient.newParams()).thenReturn(mMockParameterMap);
    when(mMockParameterMap.add(anyString(),anyString())).thenReturn(mMockParameterMap);
    when(mMockHttpClient.get(eq(FAKE_URL), any(ParameterMap.class))).thenReturn(null);
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:7,代码来源:FeedbackApiHelperTest.java


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