rabbit.http
Class HTTPDateParser

java.lang.Object
  extended byrabbit.http.HTTPDateParser

public class HTTPDateParser
extends java.lang.Object

A utility class that parses date in the HTTP headers. A date in HTTP may be written in many different formats so try them all.


Constructor Summary
HTTPDateParser()
          The default constructor.
 
Method Summary
static java.util.Date getDate(java.lang.String date)
          Try to get a date from the given string.
static java.lang.String getDateString(java.util.Date d)
          Get a String from the date.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTTPDateParser

public HTTPDateParser()
The default constructor.

Method Detail

getDate

public static java.util.Date getDate(java.lang.String date)
Try to get a date from the given string. According to RFC 2068 We have to read 3 formats.

Parameters:
date - the String we are trying to parse.
Returns:
a Date or null if parsing was not possible.

getDateString

public static java.lang.String getDateString(java.util.Date d)
Get a String from the date.

Parameters:
d - the Date to format.
Returns:
a String describing the date in the right way.