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


Java HttpEntityEnclosingRequestBase.setHeaders方法代碼示例

本文整理匯總了Java中org.apache.http.client.methods.HttpEntityEnclosingRequestBase.setHeaders方法的典型用法代碼示例。如果您正苦於以下問題:Java HttpEntityEnclosingRequestBase.setHeaders方法的具體用法?Java HttpEntityEnclosingRequestBase.setHeaders怎麽用?Java HttpEntityEnclosingRequestBase.setHeaders使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.http.client.methods.HttpEntityEnclosingRequestBase的用法示例。


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

示例1: syncPut

import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //導入方法依賴的package包/類
public String syncPut(String url, Header[] headers, HttpEntity entity, String contentType, String defaultEncoding)
		throws ClientProtocolException, IOException {
	HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPut(url), entity);
	if (headers != null)
		request.setHeaders(headers);
	if (contentType != null) {
		request.setHeader("Content-Type", contentType);
	}
	return parseResponse(syncExec(request), defaultEncoding);
}
 
開發者ID:ROKOLabs,項目名稱:ROKO.Stickers-Android,代碼行數:11,代碼來源:AsyncHttpClient.java

示例2: post

import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //導入方法依賴的package包/類
public void post(Context context, String url, Header[] headers, RequestParams params, String contentType, AsyncHttpResponseHandler responseHandler) {
    HttpEntityEnclosingRequestBase request = new HttpPost(url);
    if (params != null) {
        request.setEntity(paramsToEntity(params));
    }
    if (headers != null) {
        request.setHeaders(headers);
    }
    sendRequest(this.httpClient, this.httpContext, request, contentType, responseHandler, context);
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:11,代碼來源:AsyncHttpClient.java

示例3: post

import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //導入方法依賴的package包/類
public RequestHandle post(Context context, String url, Header[] headers, RequestParams
        params, String contentType, ResponseHandlerInterface responseHandler) {
    HttpEntityEnclosingRequestBase request = new HttpPost(getURI(url));
    if (params != null) {
        request.setEntity(paramsToEntity(params, responseHandler));
    }
    if (headers != null) {
        request.setHeaders(headers);
    }
    return sendRequest(this.httpClient, this.httpContext, request, contentType,
            responseHandler, context);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:13,代碼來源:AsyncHttpClient.java

示例4: put

import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //導入方法依賴的package包/類
public RequestHandle put(Context context, String url, Header[] headers, HttpEntity entity,
                         String contentType, ResponseHandlerInterface responseHandler) {
    HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPut(getURI(url)),
            entity);
    if (headers != null) {
        request.setHeaders(headers);
    }
    return sendRequest(this.httpClient, this.httpContext, request, contentType,
            responseHandler, context);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:11,代碼來源:AsyncHttpClient.java

示例5: patch

import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //導入方法依賴的package包/類
public RequestHandle patch(Context context, String url, Header[] headers, HttpEntity entity,
                           String contentType, ResponseHandlerInterface responseHandler) {
    HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPatch(getURI(url)
    ), entity);
    if (headers != null) {
        request.setHeaders(headers);
    }
    return sendRequest(this.httpClient, this.httpContext, request, contentType,
            responseHandler, context);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:11,代碼來源:AsyncHttpClient.java

示例6: syncPost

import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //導入方法依賴的package包/類
public String syncPost(String url, Header[] headers, HttpEntity entity, String contentType, String defaultEncoding)
		throws ClientProtocolException, IOException {
	HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPost(url), entity);
	if (headers != null)
		request.setHeaders(headers);
	if (contentType != null) {
		request.setHeader("Content-Type", contentType);
	}
	return parseResponse(syncExec(request), defaultEncoding);
}
 
開發者ID:ROKOLabs,項目名稱:ROKO.Stickers-Android,代碼行數:11,代碼來源:AsyncHttpClient.java

示例7: postSync

import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //導入方法依賴的package包/類
public String postSync(String url, Header[] headers, RequestParams params,
		String contentType) {
	HttpEntityEnclosingRequestBase request = new HttpPost(generateUrl(url));
	if (params != null)
		request.setEntity(invokeParamsToEntity(params, new DefaultHttpResponseHandler()));
	if (headers != null)
		request.setHeaders(headers);
	return sendSyncRequest(getHttpClient(), getHttpContext(), request,
			contentType);
}
 
開發者ID:ccliu2015,項目名稱:love,代碼行數:11,代碼來源:HttpManager.java

示例8: put

import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //導入方法依賴的package包/類
public RequestHandle put(Context context, String s, Header aheader[], HttpEntity httpentity, String s1, ResponseHandlerInterface responsehandlerinterface)
{
    HttpEntityEnclosingRequestBase httpentityenclosingrequestbase = a(new HttpPut(URI.create(s).normalize()), httpentity);
    if (aheader != null)
    {
        httpentityenclosingrequestbase.setHeaders(aheader);
    }
    return sendRequest(c, d, httpentityenclosingrequestbase, s1, responsehandlerinterface, context);
}
 
開發者ID:vishnudevk,項目名稱:MiBandDecompiled,代碼行數:10,代碼來源:AsyncHttpClient.java

示例9: post

import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //導入方法依賴的package包/類
public RequestHandle post(Context context, String s, Header aheader[], HttpEntity httpentity, String s1, ResponseHandlerInterface responsehandlerinterface)
{
    HttpEntityEnclosingRequestBase httpentityenclosingrequestbase = a(new HttpPost(URI.create(s).normalize()), httpentity);
    if (aheader != null)
    {
        httpentityenclosingrequestbase.setHeaders(aheader);
    }
    return sendRequest(c, d, httpentityenclosingrequestbase, s1, responsehandlerinterface, context);
}
 
開發者ID:vishnudevk,項目名稱:MiBandDecompiled,代碼行數:10,代碼來源:AsyncHttpClient.java

示例10: put

import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //導入方法依賴的package包/類
public void put(String url,Header[] headers, HttpEntity entity, String contentType, AjaxCallBack<? extends Object> callBack) {
    HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPut(url), entity);
    if(headers != null) request.setHeaders(headers);
    sendRequest(httpClient, httpContext, request, contentType, callBack);
}
 
開發者ID:cdkd321,項目名稱:pure,代碼行數:6,代碼來源:FinalHttp.java

示例11: postSync

import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //導入方法依賴的package包/類
public Object postSync( String url, Header[] headers, HttpEntity entity, String contentType) {
    HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPost(url), entity);
    if(headers != null) request.setHeaders(headers);
    return sendSyncRequest(httpClient, httpContext, request, contentType);
}
 
開發者ID:DuGuQiuBai,項目名稱:Android-Basics-Codes,代碼行數:6,代碼來源:FinalHttp.java

示例12: post

import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //導入方法依賴的package包/類
public <T> void post( String url, Header[] headers, AjaxParams params, String contentType,AjaxCallBack<T> callBack) {
    HttpEntityEnclosingRequestBase request = new HttpPost(url);
    if(params != null) request.setEntity(paramsToEntity(params));
    if(headers != null) request.setHeaders(headers);
    sendRequest(httpClient, httpContext, request, contentType, callBack);
}
 
開發者ID:cdkd321,項目名稱:pure,代碼行數:7,代碼來源:FinalHttp.java

示例13: putSync

import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //導入方法依賴的package包/類
public Object putSync(String url,Header[] headers, HttpEntity entity, String contentType) {
    HttpEntityEnclosingRequestBase request = addEntityToRequestBase(new HttpPut(url), entity);
    if(headers != null) request.setHeaders(headers);
    return sendSyncRequest(httpClient, httpContext, request, contentType);
}
 
開發者ID:cdkd321,項目名稱:pure,代碼行數:6,代碼來源:FinalHttp.java

示例14: post

import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //導入方法依賴的package包/類
/**
 * Perform getUrl HTTP POST request and track the Android Context which initiated the request. Set
 * headers only for this request
 *
 * @param context         the Android Context which initiated the request.
 * @param url             the URL to send the request to.
 * @param headers         set headers only for this request
 * @param params          additional POST parameters to send with the request.
 * @param contentType     the content type of the payload you are sending, for example
 *                        application/json if sending getUrl json payload.
 * @param responseHandler the response handler instance that should handle the response.
 * @return RequestHandle of future request process
 */
public RequestHandle post(Context context, String url, Header[] headers, RequestParams params, String contentType,
                          ResponseHandlerInterface responseHandler) {
    HttpEntityEnclosingRequestBase request = new HttpPost(URI.create(url).normalize());
    if (params != null) request.setEntity(paramsToEntity(params, responseHandler));
    if (headers != null) request.setHeaders(headers);
    return sendRequest(httpClient, httpContext, request, contentType,
            responseHandler, context);
}
 
開發者ID:yiwent,項目名稱:Mobike,代碼行數:22,代碼來源:AsyncHttpClient.java

示例15: post

import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; //導入方法依賴的package包/類
/**
 * Perform a HTTP POST request and track the Android Context which initiated
 * the request. Set headers only for this request
 *
 * @param context     the Android Context which initiated the request.
 * @param url         the URL to send the request to.
 * @param headers     set headers only for this request
 * @param params      additional POST parameters to send with the request.
 * @param contentType the content type of the payload you are sending, for example
 *                    application/json if sending a json payload.
 * @return String
 * @throws HttpException
 */
public String post(Context context, String url, Header[] headers, RequestParams params, String contentType) throws HttpException {
    HttpEntityEnclosingRequestBase request = new HttpPost(url);
    if (params != null) request.setEntity(paramsToEntity(params));
    if (headers != null) request.setHeaders(headers);
    return sendRequest(httpClient, httpContext, request, contentType, context);
}
 
開發者ID:LanguidSheep,項目名稱:sealtalk-android-master,代碼行數:20,代碼來源:SyncHttpClient.java


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