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


Java HttpHead類代碼示例

本文整理匯總了Java中ch.boye.httpclientandroidlib.client.methods.HttpHead的典型用法代碼示例。如果您正苦於以下問題:Java HttpHead類的具體用法?Java HttpHead怎麽用?Java HttpHead使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


HttpHead類屬於ch.boye.httpclientandroidlib.client.methods包,在下文中一共展示了HttpHead類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getRedirect

import ch.boye.httpclientandroidlib.client.methods.HttpHead; //導入依賴的package包/類
public HttpUriRequest getRedirect(
        final HttpRequest request,
        final HttpResponse response,
        final HttpContext context) throws ProtocolException {
    final URI uri = getLocationURI(request, response, context);
    final String method = request.getRequestLine().getMethod();
    if (method.equalsIgnoreCase(HttpHead.METHOD_NAME)) {
        return new HttpHead(uri);
    } else if (method.equalsIgnoreCase(HttpGet.METHOD_NAME)) {
        return new HttpGet(uri);
    } else {
        final int status = response.getStatusLine().getStatusCode();
        if (status == HttpStatus.SC_TEMPORARY_REDIRECT) {
            return RequestBuilder.copy(request).setUri(uri).build();
        } else {
            return new HttpGet(uri);
        }
    }
}
 
開發者ID:mozilla-mobile,項目名稱:FirefoxData-android,代碼行數:20,代碼來源:DefaultRedirectStrategy.java

示例2: isRedirectRequested

import ch.boye.httpclientandroidlib.client.methods.HttpHead; //導入依賴的package包/類
public boolean isRedirectRequested(
        final HttpResponse response,
        final HttpContext context) {
    Args.notNull(response, "HTTP response");

    final int statusCode = response.getStatusLine().getStatusCode();
    switch (statusCode) {
    case HttpStatus.SC_MOVED_TEMPORARILY:
    case HttpStatus.SC_MOVED_PERMANENTLY:
    case HttpStatus.SC_TEMPORARY_REDIRECT:
        final HttpRequest request = (HttpRequest) context.getAttribute(
                ExecutionContext.HTTP_REQUEST);
        final String method = request.getRequestLine().getMethod();
        return method.equalsIgnoreCase(HttpGet.METHOD_NAME)
            || method.equalsIgnoreCase(HttpHead.METHOD_NAME);
    case HttpStatus.SC_SEE_OTHER:
        return true;
    default:
        return false;
    } //end of switch
}
 
開發者ID:mozilla-mobile,項目名稱:FirefoxData-android,代碼行數:22,代碼來源:DefaultRedirectHandler.java

示例3: getRedirect

import ch.boye.httpclientandroidlib.client.methods.HttpHead; //導入依賴的package包/類
public HttpUriRequest getRedirect(
        final HttpRequest request,
        final HttpResponse response,
        final HttpContext context) throws ProtocolException {
    final URI uri = this.handler.getLocationURI(response, context);
    final String method = request.getRequestLine().getMethod();
    if (method.equalsIgnoreCase(HttpHead.METHOD_NAME)) {
        return new HttpHead(uri);
    } else {
        return new HttpGet(uri);
    }
}
 
開發者ID:mozilla-mobile,項目名稱:FirefoxData-android,代碼行數:13,代碼來源:DefaultRedirectStrategyAdaptor.java

示例4: exists

import ch.boye.httpclientandroidlib.client.methods.HttpHead; //導入依賴的package包/類
/**
 * (non-Javadoc)
 * 
 * @see de.aflx.sardine.Sardine#exists(java.lang.String)
 */
public boolean exists(String url) throws IOException {
	HttpHead head = new HttpHead(url);
	return this.execute(head, new ExistsResponseHandler());
}
 
開發者ID:starn,項目名稱:encdroidMC,代碼行數:10,代碼來源:SardineImpl.java


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