Package com.twelvemonkeys.net
Class HTTPUtil
- java.lang.Object
-
- com.twelvemonkeys.net.HTTPUtil
-
public class HTTPUtil extends java.lang.ObjectHTTPUtil- Version:
- $Id: HTTPUtil.java,v 1.0 08.09.13 13:57 haraldk Exp$
- Author:
- Harald Kuhr, last modified by $Author: haraldk$
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringformatHTTPDate(long pTime)Formats the time to a HTTP date, using the RFC 1123 format, as described in RFC 2616 (HTTP/1.1), sec.static java.lang.StringformatHTTPDate(java.util.Date pTime)Formats the time to a HTTP date, using the RFC 1123 format, as described in RFC 2616 (HTTP/1.1), sec.static longparseHTTPDate(java.lang.String pDate)Parses a HTTP date string into alongrepresenting milliseconds since January 1, 1970 GMT.
-
-
-
Method Detail
-
formatHTTPDate
public static java.lang.String formatHTTPDate(long pTime)
Formats the time to a HTTP date, using the RFC 1123 format, as described in RFC 2616 (HTTP/1.1), sec. 3.3.- Parameters:
pTime- the time- Returns:
- a
Stringrepresentation of the time
-
formatHTTPDate
public static java.lang.String formatHTTPDate(java.util.Date pTime)
Formats the time to a HTTP date, using the RFC 1123 format, as described in RFC 2616 (HTTP/1.1), sec. 3.3.- Parameters:
pTime- the time- Returns:
- a
Stringrepresentation of the time
-
parseHTTPDate
public static long parseHTTPDate(java.lang.String pDate) throws java.lang.NumberFormatExceptionParses a HTTP date string into alongrepresenting milliseconds since January 1, 1970 GMT.Use this method with headers that contain dates, such as
If-Modified-SinceorLast-Modified.The date string may be in either RFC 1123, RFC 850 or ANSI C asctime() format, as described in RFC 2616 (HTTP/1.1), sec. 3.3
- Parameters:
pDate- the date to parse- Returns:
- a
longvalue representing the date, expressed as the number of milliseconds since January 1, 1970 GMT, - Throws:
java.lang.NumberFormatException- if the date parameter is not parseable.java.lang.IllegalArgumentException- if the date paramter isnull
-
-