本文整理汇总了Java中cz.msebera.android.httpclient.client.methods.HttpUriRequest.addHeader方法的典型用法代码示例。如果您正苦于以下问题:Java HttpUriRequest.addHeader方法的具体用法?Java HttpUriRequest.addHeader怎么用?Java HttpUriRequest.addHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cz.msebera.android.httpclient.client.methods.HttpUriRequest
的用法示例。
在下文中一共展示了HttpUriRequest.addHeader方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendRequest
import cz.msebera.android.httpclient.client.methods.HttpUriRequest; //导入方法依赖的package包/类
@Override
protected RequestHandle sendRequest(DefaultHttpClient client,
HttpContext httpContext, HttpUriRequest uriRequest,
String contentType, ResponseHandlerInterface responseHandler,
Context context) {
if (contentType != null) {
uriRequest.addHeader(AsyncHttpClient.HEADER_CONTENT_TYPE, contentType);
}
responseHandler.setUseSynchronousMode(true);
/*
* will execute the request directly
*/
newAsyncHttpRequest(client, httpContext, uriRequest, contentType, responseHandler, context).run();
// Return a Request Handle that cannot be used to cancel the request
// because it is already complete by the time this returns
return new RequestHandle(null);
}