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


Java DateParseException類代碼示例

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


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

示例1: revalidationResponseIsTooOld

import org.apache.http.impl.cookie.DateParseException; //導入依賴的package包/類
private boolean revalidationResponseIsTooOld(final HttpResponse backendResponse,
        final HttpCacheEntry cacheEntry) {
    final Header entryDateHeader = cacheEntry.getFirstHeader(HTTP.DATE_HEADER);
    final Header responseDateHeader = backendResponse.getFirstHeader(HTTP.DATE_HEADER);
    if (entryDateHeader != null && responseDateHeader != null) {
        try {
            final Date entryDate = DateUtils.parseDate(entryDateHeader.getValue());
            final Date respDate = DateUtils.parseDate(responseDateHeader.getValue());
            if (respDate.before(entryDate)) {
                return true;
            }
        } catch (final DateParseException e) {
            // either backend response or cached entry did not have a valid
            // Date header, so we can't tell if they are out of order
            // according to the origin clock; thus we can skip the
            // unconditional retry recommended in 13.2.6 of RFC 2616.
        }
    }
    return false;
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:21,代碼來源:CachingHttpClient.java

示例2: entryDateHeaderNewerThenResponse

import org.apache.http.impl.cookie.DateParseException; //導入依賴的package包/類
private boolean entryDateHeaderNewerThenResponse(HttpCacheEntry entry,
		HttpResponse response) {
	try {
		Date entryDate = DateUtils.parseDate(entry.getFirstHeader(
				HTTP.DATE_HEADER).getValue());
		Date responseDate = DateUtils.parseDate(response.getFirstHeader(
				HTTP.DATE_HEADER).getValue());

		if (!entryDate.after(responseDate)) {
			return false;
		}
	} catch (DateParseException e) {
		return false;
	}

	return true;
}
 
開發者ID:apigee,項目名稱:apigee-android-sdk,代碼行數:18,代碼來源:CacheEntryUpdater.java

示例3: alreadyHaveNewerCacheEntry

import org.apache.http.impl.cookie.DateParseException; //導入依賴的package包/類
private boolean alreadyHaveNewerCacheEntry(HttpHost target,
		HttpRequest request, HttpResponse backendResponse)
		throws IOException {
	HttpCacheEntry existing = null;
	try {
		existing = responseCache.getCacheEntry(target, request);
	} catch (IOException ioe) {
		// nop
	}
	if (existing == null)
		return false;
	Header entryDateHeader = existing.getFirstHeader("Date");
	if (entryDateHeader == null)
		return false;
	Header responseDateHeader = backendResponse.getFirstHeader("Date");
	if (responseDateHeader == null)
		return false;
	try {
		Date entryDate = DateUtils.parseDate(entryDateHeader.getValue());
		Date responseDate = DateUtils.parseDate(responseDateHeader
				.getValue());
		return responseDate.before(entryDate);
	} catch (DateParseException e) {
	}
	return false;
}
 
開發者ID:apigee,項目名稱:apigee-android-sdk,代碼行數:27,代碼來源:CachingHttpClient.java

示例4: parseDateAsEpoch

import org.apache.http.impl.cookie.DateParseException; //導入依賴的package包/類
/**
 * Parse date in RFC1123 format, and return its value as epoch
 */
public static long parseDateAsEpoch(String dateStr) {
    try {
        // Parse date in RFC1123 format if this header contains one
        return DateUtils.parseDate(dateStr).getTime();
    } catch (DateParseException e) {
        // Date in invalid format, fallback to 0
        return 0;
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:13,代碼來源:HttpHeaderParser.java

示例5: parseDateAsEpoch

import org.apache.http.impl.cookie.DateParseException; //導入依賴的package包/類
public static long parseDateAsEpoch(String dateStr) {
    try {
        return DateUtils.parseDate(dateStr).getTime();
    } catch (DateParseException e) {
        return 0;
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:8,代碼來源:HttpHeaderParser.java

示例6: parseDateAsEpoch

import org.apache.http.impl.cookie.DateParseException; //導入依賴的package包/類
public static long parseDateAsEpoch(String dateStr) {
    try {
        return DateUtils.parseDate(dateStr).getTime();
    } catch (DateParseException var2) {
        return 0L;
    }
}
 
開發者ID:pinguo-sunjianfei,項目名稱:Android-Application-ZJB,代碼行數:8,代碼來源:HttpHeaderParser.java

示例7: getFormatDate8

import org.apache.http.impl.cookie.DateParseException; //導入依賴的package包/類
/**
 * 將指定字符串轉換成日期
 *
 * @param date        String 日期字符串
 * @return Date
 */
public static Date getFormatDate8(String date) throws DateParseException {
    if(date == null || date.length() == 0) return null;
    date = date.replaceAll("[-\\s/:]+","");

    if(date.length()<8) throw new DateParseException("日期格式錯誤");
    if(date.length()>8) date = date.substring(0,8);

    SimpleDateFormat sd = new SimpleDateFormat("yyyyMMdd");
    return sd.parse(date, new java.text.ParsePosition(0));
}
 
開發者ID:autumnkuang,項目名稱:nenlvse1.0,代碼行數:17,代碼來源:DateUtil.java

示例8: parseDate

import org.apache.http.impl.cookie.DateParseException; //導入依賴的package包/類
protected Date parseDate(final String expires) {
	try {
		return DateUtils.parseDate(expires);
	} catch (DateParseException e) {
		throw MechanizeExceptionFactory.newException(e);
	}
}
 
開發者ID:Coffeeboys,項目名稱:RenewPass,代碼行數:8,代碼來源:InMemoryCacheEntry.java

示例9: parseDateAsEpoch

import org.apache.http.impl.cookie.DateParseException; //導入依賴的package包/類
/**
 * Parse date in RFC1123 format, and return its value as epoch
 */
/*
 * 解析時間,將 RFC1123 的時間格式,解析成 epoch 時間
 */
public static long parseDateAsEpoch(String dateStr) {
    try {
        // Parse date in RFC1123 format if this header contains one
        // 耦合了 Apache 的時間工具類
        return DateUtils.parseDate(dateStr).getTime();
    } catch (DateParseException e) {
        // Date in invalid format, fallback to 0
        return 0;
    }
}
 
開發者ID:CaMnter,項目名稱:SaveVolley,代碼行數:17,代碼來源:HttpHeaderParser.java

示例10: alreadyHaveNewerCacheEntry

import org.apache.http.impl.cookie.DateParseException; //導入依賴的package包/類
private boolean alreadyHaveNewerCacheEntry(final HttpHost target, final HttpRequest request,
        final HttpResponse backendResponse) {
    HttpCacheEntry existing = null;
    try {
        existing = responseCache.getCacheEntry(target, request);
    } catch (final IOException ioe) {
        // nop
    }
    if (existing == null) {
        return false;
    }
    final Header entryDateHeader = existing.getFirstHeader(HTTP.DATE_HEADER);
    if (entryDateHeader == null) {
        return false;
    }
    final Header responseDateHeader = backendResponse.getFirstHeader(HTTP.DATE_HEADER);
    if (responseDateHeader == null) {
        return false;
    }
    try {
        final Date entryDate = DateUtils.parseDate(entryDateHeader.getValue());
        final Date responseDate = DateUtils.parseDate(responseDateHeader.getValue());
        return responseDate.before(entryDate);
    } catch (final DateParseException e) {
        // Empty on Purpose
    }
    return false;
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:29,代碼來源:CachingHttpClient.java

示例11: parseDateAsEpoch

import org.apache.http.impl.cookie.DateParseException; //導入依賴的package包/類
private static long parseDateAsEpoch(String paramString)
{
  try
  {
    long l = DateUtils.parseDate(paramString).getTime();
    return l;
  }
  catch (DateParseException localDateParseException) {}
  return 0L;
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:11,代碼來源:HttpHeaderParser.java

示例12: zzg

import org.apache.http.impl.cookie.DateParseException; //導入依賴的package包/類
private static long zzg(String paramString)
{
  try
  {
    long l = DateUtils.parseDate(paramString).getTime();
    return l;
  }
  catch (DateParseException localDateParseException) {}
  return 0L;
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:11,代碼來源:zzx.java


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