本文整理匯總了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}