Example usage for org.apache.commons.httpclient.util DateParser parseDate

List of usage examples for org.apache.commons.httpclient.util DateParser parseDate

Introduction

In this page you can find the example usage for org.apache.commons.httpclient.util DateParser parseDate.

Prototype

public static Date parseDate(String paramString) throws DateParseException 

Source Link

Usage

From source file:org.apache.maven.proxy.config.HttpRepoConfiguration.java

private static long getLastModified(HttpMethod method) {
    Header lastModifiedHeader = method.getResponseHeader("Last-Modified");
    if (lastModifiedHeader == null) {
        return -1;
    }//from w w  w.  j  av a 2 s  .c  o  m
    String lastModifiedString = lastModifiedHeader.getValue();

    try {
        return DateParser.parseDate(lastModifiedString).getTime();
    } catch (DateParseException e) {
        LOGGER.warn("Unable to parse Last-Modified header : " + lastModifiedString);
        return System.currentTimeMillis();
    }
}