/** * Convert the supplied value to a String. * * @param value * the value of type <code>T</code> * @return a String representation of the value * @throws IllegalArgumentException * if the supplied object cannot be serialized * @see javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate#toString(java.lang.Object) */ public String toString(Date date) { // This method could be extended, if you have problems. Send an email to // discuss@restlet.tigris.org return DateUtils.format(date); } }
/** * Parses a formatted date into a Date object using the default HTTP format * (RFC 1123). * * @param date * The date to parse. * @return The parsed date. */ public static Date parse(String date) { return parse(date, FORMAT_RFC_1123); }
/** * Sets the moment associated with an event early in the life cycle of the * entry. * * @param published * The moment associated with an event early in the life cycle of * the entry. */ public void setPublished(Date published) { this.published = DateUtils.unmodifiable(published); }
result.setMaxAge(-1); } else if (pair.getName().equalsIgnoreCase(NAME_SET_EXPIRES)) { Date expires = DateUtils.parse(pair.getValue(), FORMAT_RFC_1036); expires = DateUtils.parse(pair.getValue(), FORMAT_RFC_1123); expires = DateUtils.parse(pair.getValue(), FORMAT_ASC_TIME); if (DateUtils.after(current, expires)) { result.setMaxAge((int) ((expires.getTime() - current.getTime()) / 1000)); } else {
&& (DateUtils.after(new Date(), modifiedSince) || (modificationDate == null) || DateUtils .after(modifiedSince, modificationDate)); matched = !isModifiedSince; boolean isModifiedSince = (DateUtils.after(new Date(), modifiedSince) || (modificationDate == null) || DateUtils .after(modifiedSince, modificationDate)); Date unModifiedSince = getUnmodifiedSince(); boolean isUnModifiedSince = ((unModifiedSince == null) || (modificationDate == null) || !DateUtils.before( modificationDate, unModifiedSince));
/** * Formats a Date in the default HTTP format (RFC 1123). * * @param date * The date to format. * @return The formatted date. */ public static String format(final Date date) { return format(date, DateUtils.FORMAT_RFC_1123.get(0)); }
/** * Parses a formatted date into a Date object using the default HTTP format * (RFC 1123). * * @param date * The date to parse. * @return The parsed date. */ public static Date parse(String date) { return parse(date, FORMAT_RFC_1123); }
/** * Sets the moment associated with an event early in the life cycle of the * entry. * * @param published * The moment associated with an event early in the life cycle of * the entry. */ public void setPublished(Date published) { this.published = DateUtils.unmodifiable(published); }
/** * Writes a date header. * * @param date * The date to write. * @param cookie * Indicates if the date should be in the cookie format. * @return The formatted date. */ public static String write(Date date, boolean cookie) { if (cookie) { return DateUtils.format(date, DateUtils.FORMAT_RFC_1036.get(0)); } return DateUtils.format(date); }
/** * Parses a date string. * * @param date * The date string to parse. * @param cookie * Indicates if the date is in the cookie format. * @return The parsed date. */ public static Date readDate(String date, boolean cookie) { if (cookie) { return DateUtils.parse(date, DateUtils.FORMAT_RFC_1036); } return DateUtils.parse(date, DateUtils.FORMAT_RFC_1123); }
/** * Sets the most recent moment when the entry was modified in a significant * way. * * @param updated * The most recent moment when the entry was modified in a * significant way. */ public void setUpdated(Date updated) { this.updated = DateUtils.unmodifiable(updated); }
/** * Formats a Date in the default HTTP format (RFC 1123). * * @param date * The date to format. * @return The formatted date. */ public static String format(final Date date) { return format(date, DateUtils.FORMAT_RFC_1123.get(0)); }
/** * Parse the supplied value and create an instance of <code>T</code>. * * @param contentType * the contentType * @return the newly created instance of <code>T</code> * @throws IllegalArgumentException * if the supplied string cannot be parsed * @see javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate#fromString(java.lang.String) */ public Date fromString(String date) throws IllegalArgumentException { // This method could be extended, if you have problems. Send an email to // discuss@restlet.tigris.org return DateUtils.parse(date); }
/** * Sets the most recent moment when the entry was modified in a significant * way. * * @param updated * The most recent moment when the entry was modified in a * significant way. */ public void setUpdated(Date updated) { this.updated = DateUtils.unmodifiable(updated); }
/** * Formats a Date according to the first format in the array. * * @param date * The date to format. * @param formats * The array of date formats to use. * @return The formatted date. */ public static String format(final Date date, final List<String> formats) { return format(date, formats != null ? formats.get(0) : null); }
final Date parsedDate = DateUtils.parse(formattedDate.trim(), DateUtils.FORMAT_RFC_3339);
/** * Sets the most recent moment when the entry was modified in a significant * way. * * @param updated * The most recent moment when the entry was modified in a * significant way. */ public void setUpdated(Date updated) { this.updated = DateUtils.unmodifiable(updated); }
/** * Formats a Date according to the first format in the array. * * @param date * The date to format. * @param formats * The array of date formats to use. * @return The formatted date. */ public static String format(final Date date, final List<String> formats) { return format(date, formats != null ? formats.get(0) : null); }
final Date parsedDate = DateUtils.parse(formattedDate.trim(), DateUtils.FORMAT_RFC_3339);
/** * Sets the most recent moment when the feed was modified in a significant * way. * * @param updated * The most recent moment when the feed was modified in a * significant way. */ public void setUpdated(Date updated) { this.updated = DateUtils.unmodifiable(updated); }