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


Java AbortableHttpRequest类代码示例

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


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

示例1: releaseConnection

import org.apache.http.client.methods.AbortableHttpRequest; //导入依赖的package包/类
/**
 * Forces the release of an HttpMethod's connection in a way that will
 * perform all the necessary cleanup through the correct use of HttpClient
 * methods.
 *
 * @throws IOException
 */
protected void releaseConnection() throws IOException {
    if (!alreadyReleased) {
        if (!underlyingStreamConsumed) {
            // Underlying input stream has not been consumed, abort method
            // to force connection to be closed and cleaned-up.
        	if (httpRequest instanceof AbortableHttpRequest) {
        		AbortableHttpRequest abortableHttpRequest = (AbortableHttpRequest)httpRequest;
        		abortableHttpRequest.abort();
        	}
        }
        inputStream.close();
        alreadyReleased = true;
    }
}
 
开发者ID:sinacloud,项目名称:sinacloud-sdk-java,代码行数:22,代码来源:HttpMethodReleaseInputStream.java

示例2: abortQuietly

import org.apache.http.client.methods.AbortableHttpRequest; //导入依赖的package包/类
private void abortQuietly(AbortableHttpRequest httpRequest) {
    if (httpRequest != null) {
        httpRequest.abort();
    }
}
 
开发者ID:rhq-project,项目名称:rhq-agent-plugin-plugin,代码行数:6,代码来源:UploadMojo.java


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