Example usage for org.apache.http.impl.cookie DateParseException DateParseException

List of usage examples for org.apache.http.impl.cookie DateParseException DateParseException

Introduction

In this page you can find the example usage for org.apache.http.impl.cookie DateParseException DateParseException.

Prototype

public DateParseException(final String message) 

Source Link

Usage

From source file:edu.mit.mobile.android.locast.sync.SyncEngine.java

/**
 * Gets the server's time.//ww  w.  ja va  2  s .co m
 *
 * @param hr
 * @return the time that the response was generated, according to the server
 * @throws DateParseException
 *             if the header is missing or if it can't be parsed.
 */
private long getServerTime(HttpResponse hr) throws DateParseException {
    final Header hDate = hr.getFirstHeader("Date");
    if (hDate == null) {
        throw new DateParseException("No Date header in http response");
    }
    return DateUtils.parseDate(hDate.getValue()).getTime();
}