コード例 #1
0
  /**
   * This can be used to get the value of the first message header that has the specified name. This
   * will return the long value representing the named header value. If the named header does not
   * exist then this will return a value of minus one, -1.
   *
   * @param name the HTTP message header to get the value from
   * @return this returns the value that the HTTP message header
   */
  public long getDate(String name) {
    String value = getValue(name);

    if (value == null) {
      return -1;
    }
    return parser.convert(value);
  }
コード例 #2
0
 /**
  * This is used as a convenience method for adding a header that needs to be parsed into a
  * HTTPdate string. This will convert the date given into a date string defined in RFC 2616 sec
  * 3.3.1.
  *
  * @param name the name of the HTTP message header to be added
  * @param date the value constructed as an RFC 1123 date string
  */
 public void addDate(String name, long date) {
   addValue(name, parser.convert(date));
 }
コード例 #3
0
 /**
  * This is used as a convenience method for adding a header that needs to be parsed into a HTTP
  * date string. This will convert the date given into a date string defined in RFC 2616 sec 3.3.1.
  * This will perform a <code>remove</code> using the issued header name before the header value is
  * set.
  *
  * @param name the name of the HTTP message header to be added
  * @param date the value constructed as an RFC 1123 date string
  */
 public void setDate(String name, long date) {
   setValue(name, parser.convert(date));
 }